Commit Graph

318 Commits

Author SHA1 Message Date
Ashutosh Narkar eade10ae0e build: Remove rootless image variant
All published OPA images now run with a non-root uid/gid.
The uid:gid is set to 1000:1000 for all images. As a result
there is no longer a need for the --rootless image variant
hence it will not be published as part of future releases.
This change is in line with container security best practices.
OPA can still be run with root privileges by explicitly setting the user,
either with the --user argument for docker run, or by specifying
the securityContext in the Kubernetes Pod specification.

Fixes: #4295

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2023-11-02 08:55:09 -07:00
Johan Fylling d062d5f356 Prepare v0.55.0 development (#6066)
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2023-06-29 21:37:47 +02:00
Zoran Regvart 1ad399285b build: more SELinux labels for Docker volumes (#6061)
Ref #6054

Signed-off-by: Zoran Regvart <zoran@regvart.com>
Co-authored-by: Johan Fylling <johan.dev@fylling.se>
2023-06-29 19:35:35 +02:00
Stephan Renatus 372293e79f build: use -bullseye golang image (#6063)
Signed-off-by: Stephan Renatus <stephan@styra.com>
2023-06-29 16:03:17 +02:00
Zoran Regvart a50c134f4f build: configure SELinux labels for Docker volumes (#6055)
When SELinux is enforced the mounted volumes to spun Docker containers
are not writable unless the `:z` or `:Z` flag is set[1].

This opts not to share the mounts by using `:Z`.

[1] https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label

Fixes #6054

Signed-off-by: Zoran Regvart <zoran@regvart.com>
Co-authored-by: Johan Fylling <johan.dev@fylling.se>
2023-06-29 11:17:35 +02:00
Ashutosh Narkar 917bc9ce7b Disable provenance attestations in buildx
Buildx version >=0.10 generates a new OCI format
with support for provenance. As a result the
following error is generated on M1/M2 while inspecting
the manifest

> OCI manifest found, but accept header does not support OCI manifests

The suggested fix is to temporarily disable provenance.

Fixes: #5877

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2023-06-27 16:31:30 -07:00
Charlie Egan 2ade22958a Update to glibc-dynamic image (#6049)
cc-dynamic has been deprecated.

https://github.com/chainguard-images/images/blame/main/images/cc-dynamic/README.md#L23

Fixes https://github.com/open-policy-agent/opa/issues/6037

Needs https://github.com/chainguard-images/images/pull/937 before
merging.

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-06-26 14:51:29 +01:00
Charlie Egan 2f8c0cda7c Update debug build base images to remove openssl (#5787)
This completes the work started in https://github.com/open-policy-agent/opa/pull/5540

Fixes https://github.com/open-policy-agent/opa/issues/5544

We can't use distroless since they don't have a nossl cc image: https://github.com/GoogleContainerTools/distroless/issues/1210

Chainguard have added this (-dev rather than :debug) to their image collection: https://github.com/chainguard-images/images/issues/187

Following advice here, using their busybox is the best replacement for `gcr.io/distroless/static:debug` https://github.com/chainguard-images/images/pull/368#issuecomment-1478221177

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-03-23 15:58:32 +00:00
Ashutosh Narkar 5c183f5ecb Update OPA images to use non-root uid/gid by default
Currently all OPA image variants except "rootless" use
uid/gid 0 (i.e. root). Per container security best
practices it is better to run as non-root. So now OPA
defaults to non-root uid/gid in images. If root user
if needed, it can be explicitly set.

The "rootless" image variant is no longer needed and
will be not published in future releases.

Also currently the debug variant is published
for `linux/amd64` platform. For `linux/arm64` only static
images are generated. The debug variant can be useful
for debugging purposes and hence this change adds that
to the static image which can then be used on amd64 and arm64 arch.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2023-03-02 08:46:09 -08:00
Stephan Renatus c9ec05d3fe bump: go 1.19.5 -> 1.20.1
This PR bumps go to 1.20.1 (https://go.dev/doc/go1.20) which
addresses the following vulnerabilities:
https://pkg.go.dev/vuln/GO-2023-1571
https://pkg.go.dev/vuln/GO-2023-1570
https://pkg.go.dev/vuln/GO-2023-1568

As part of the migration, general Golang
stdlib deprecations and test failures were addressed as well.
Some of those changes are:

* Bump golangci-lint for support with go1.20
* Migrate rand.Seed() calls to the newer rand.New(rand.NewSource(seed))

Co-authored-by: Stephan Renatus <stephan@styra.com>
Co-authored-by: Philip Conrad <philipaconrad@gmail.com>

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2023-02-21 13:51:23 -08:00
Stephan Renatus 548e667bc3 ci: pin golang image
Signed-off-by: Stephan Renatus <stephan@styra.com>
2023-02-07 09:43:36 -08:00
Charlie Egan 43be06eecd Update base images for non debug builds (#5540)
New base images don't contain openssl and are sourced from
https://github.com/chainguard-images/images#chainguard-images.

I have also updated the static images to use their static base, though
it is not impacted by the openssl issue.

Remaining to do, perhaps as part of this PR is to update the debug
base images to something that doesn't contain openssl too. Currently
there is no cc image in the chainguard collection that contains a
busybox shell.

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-01-05 14:07:29 +00:00
Stephan Renatus fb9875f770 test/cli: add simple bundle build tests (#5346)
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-11-04 18:02:25 +01:00
Anders Eknert 50d4e31d6b chore: Use t.Setenv in tests (#5321)
And enable the `tenv` linter for the future.

Also, bump version of golangci-lint and fix some new
warnings that came from that.

Signed-off-by: Anders Eknert <anders@eknert.com>
2022-10-27 17:44:56 +02:00
Stephan Renatus 482769dd12 nightly: address recent findings, update trivyignore (#5287)
This is a bit of a bag of a few smaller things:

* workflows/nightly: skip imported gqlparser package.json
   It is not used anywhere.

* .trivyignore: remove docker CVE
   This has been bumped away when updating ORAS.

* website/livescripts: bump minimatch
   This also updated the lockfile version... I think that's OK.

* workflows/pull-request: don't setup opa for docker image smoke test
* address netlify ignore script failure on large output

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-10-21 12:06:38 +02:00
Stephan Renatus a8f8b0ef78 cmd/exec: convert slashes of explicit bundles (#5219)
The incoming relative path is now converted as follows:

1. filepath.Abs:     foo/bar          -> c:\a\b\c\foo\bar
2. filepath.ToShasl: c:\a\b\c\foo\bar -> c:/a/b/c/foo/bar
3. prepend `file://`

That's something the runtime can make sense of, and the smoke test passes.

Fixes #5134.

Includes:
* ci: add smoke test with a bundle

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-10-10 13:06:09 +02:00
Stephan Renatus 4b0309fd78 version: use runtime/debug.BuildInfo (#5111)
Two small moving parts less. The commit will now be included unabbreviated, but
I think that's OK.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-09-08 13:55:36 +02:00
Philip Conrad e8d488f77f Prepare v0.44.0 release (#5109)
Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
2022-09-07 19:33:31 -04:00
Stephan Renatus 1bcf82cd06 build: bump golang: 1.19 -> 1.19.1 (#5099)
Golang Announcement: https://groups.google.com/g/golang-announce/c/x49AQzIVX-s

Notably:
* CVE-2022-27664 and Go issue https://go.dev/issue/54658

Also adding 'opa version' output to the binary smoke tests for easier
verification here.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-09-07 10:25:35 +02:00
Stephan Renatus 7f78653f9c build: run 'make generate' in release container (#4934)
This replaces the docker image so that we get one that has all of these
commands available: make, git, go, python2 and perl.

We can now run `make generate` in the steps used to generate the release patch,
so the release patch contains the builtin_metadata.json changes.

Before, we had been running `make generate` in the working directory, and
copied the file into the container's workdir; but that left the working
directory modified, and hindered patch application before cleaning up.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-07-26 12:43:59 +02:00
Stephan Renatus e9d8353591 ci: pass --region to 'aws s3 sync' command (#4819)
This is an attempt to fix an obscure condition that started last week:
the `aws s3 sync` command in our `deploy-ci` make target started failing,
with only this output:

    <botocore.awsrequest.AWSRequest object at 0x7f3198832f70>

A promising google hit suggests that it's got to do with "what's the best
region for me?" auto-discovery failing. Passing any region should then do
the trick.

Ref: https://florian.ec/blog/github-actions-awscli-errors/

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-06-28 09:41:02 +02:00
Stephan Renatus 9413dff1a0 ci: bump golangci-lint to v1.46.2, fix some issues (#4809)
Fixes #4765

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-06-24 09:29:45 +02:00
Stephan Renatus 687beb7541 build: integrate builtin_metadata.json handling in release process (#4763)
Fixes #4754.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-06-20 10:57:17 +02:00
Stephan Renatus a940cb636e ci: misc test-related fixes (#4549)
* topdown: fix TestRego: run for all go versions, excluding the x509 error

That error has a different message on go1.16.

The previous attempt to exclude them from running caused _all tests_
to not be run.

* topdown_test/TestTopDownQueryCancellationEvery: up wait time for macos flakey tests

We've often seen this fail with "0 notes". Waiting for 10x the time
we previous waited for still seems to do the trick but should
hopefully remove the amount of failures we see in CE because of
slow macos runners.

* ci: don't run wasm build again in compat builds

The build is docker-based, and doesn't differ at all if run from a
different version of golang. So instead of re-building it in the
separate matrix jobs, we'll use the artifacts downloaded from the
artifact build job.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-04-05 13:57:04 +02:00
Stephan Renatus 14c2906afb ci: remove go-fuzz, use native go 1.18 fuzzer
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-03-28 07:24:21 +02:00
Stephan Renatus f4324f05d3 website: don't run generate twice (#4488)
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-03-25 15:00:39 +01:00
Stephan Renatus e09b04f2a9 website: make local dev and PR preview not build everything (#4474)
With this change, the work done for local development, and the per-PR netlify preview changes:

It will no longer include the website stuff for versions other than edge, the current working tree.

We thus save us the time, and the flakiness, involved with

- checking if github has release binaries for all the versions
- checking out their sources
- fetching the release binaries to pre-hydrate old versions' live-blocks.

The previously-used, documented make target should still be intact.

Fixes #4379 to some extent, I hope.

* docs/website: remove "latest" binary from opa versions cache

Having a stale binary here -- one called "latest" but not actually
being "latest" -- causes issues like this: when building the website
content for the (real) latest version, the script would take the
old (previous-latest) binary, and fail because that binary didn't
know the latest future keywords.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-03-25 09:59:44 +01:00
Anders Eknert d2684b995c Use gid=1000 in -rootless images (#4407)
Fixes #4380

Signed-off-by: Anders Eknert <anders@eknert.com>
2022-03-04 13:19:48 +01:00
Anders Eknert d60e83f387 make: Disable WASM by default on darwin/arm64 (#4382)
Signed-off-by: Anders Eknert <anders@eknert.com>
2022-02-25 08:11:34 +01:00
Stephan Renatus 26610645a0 build: work around issues (#4298)
* Makefile: temporary disable "delete" for edge bucket sync

This is a bandaid to be reverted when we've fixed the IAM policy
protecting the bucket to allow for deletions.

* workflow: re-enable token in checkout

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-01-28 13:53:03 +01:00
Stephan Renatus 19d6bc4026 build: don't build and push non-static edge arm64 binaries (#4293)
* build: don't push arm64 binaries to edge releases

They're not built for a release, but we'd still be publishing
them to the edge S3 bucket post-merge.

* build: silence 'aws s3 sync' output

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-01-27 11:59:32 +01:00
Stephan Renatus ba27caa1af build: only build/publish/test static binaries/images for linux/arm64 (#4282)
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-01-27 09:46:59 +01:00
Nick Graef db4d9872cc ci: publish multi-arch image manifest lists (#4254)
This change adds linux/arm64 binaries to the release. It also publishes an arm64
container image for all variants (standard, debug, rootless, static) and releases
(dev, edge, latest).

The build and push process uses buildx in order to push the individual
images by digest (i.e. untagged) and reference them in a single, tagged manifest
list. This avoids cluttering Docker Hub's tag list with `<tag>-<arch>` tags.

Fixes #2233

Signed-off-by: Nick Graef <1031317+ngraef@users.noreply.github.com>
2022-01-24 19:00:09 +01:00
Shuhei Kitagawa 06664d0f02 ci: Update golangci-lint to v1.43.0 (#4173)
Signed-off-by: shuheiktgw <s-kitagawa@mercari.com>
2021-12-28 08:43:28 +01:00
Johannes Larsson 9ec964b857 binary/checksum: Add sha256 checksums of ci-builds to release directory
Fixes #3448
Signed-off-by: Johannes Larsson <johannes.a.larsson@gmail.com>
2021-12-08 13:52:10 -08:00
Anders Eknert c56bc2f8f3 release: add Darwin ARM64 release target (#4060)
Somewhat experimental, but now that pretty much all new macs
run with the ARM64 architecture it would be nice to add it as
a target to our releases. Since there is currently no runner
for GitHub Actions (https://github.com/actions/runner/issues/805)
we can't yet run the binary smoke test for this architecture,
but I'm tracking the issue and hoping that can be resolved soon.

Feel free to dismiss this if you think this should wait until later.

Signed-off-by: Anders Eknert <anders@eknert.com>
2021-12-01 11:05:45 +01:00
Torin Sandall 6e7f271bb7 build: Improve CHANGELOG mentions and token usage
This commit improves the release-patch target to mention users in the
Miscellaneous section and warn if a GitHub token is not provided.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-11-30 09:04:54 -08:00
Martin Besozzi 84014945b8 build: Add support for building images based on processor architecture (#4044)
Signed-off-by: Martin Besozzi <embesozzi@gmail.com>
2021-11-24 08:15:45 +01:00
Torin Sandall 2f7a9e2dab ci: Tweak the post-tag workflow
* Do not run ci-release-tag target--the tests have already been run
  pre-merge and post-merge so there is little reason to run them again
  post-tag. The only thing this would do is find non-deterministic
  test failures--which begs the question: what do we do with the
  release? We already run tests pre-merge, post-merge, and nightly so
  it's unlikely that post-tag will help improve quality.

* Use the RELEASE_DIR from the makefile for the `hub release` asset
  parameter rather than assuming the TAG <=> RELEASE_DIR (this is not
  always true if tagging an arbitrary commit.) This enables us to cut
  release candidates without commiting changes to the repo.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-11-05 16:33:41 -07:00
Stephan Renatus 8b52a08b74 ci: check go proxy mod checksums (#3810)
This extra check is meant to catch go module proxy checksum mismatches,
like the one we've released 0.32.1 to fix, earlier.

It causes the go mod tooling to fetch all modules from their external sources,
most likely all github references, and compares the contents' checksums with
what we have in go.sum. It deliberately bypasses the "sumdb" service that is
part of the golang infrastructure.

The event of a mismatch would happen if a git tag was published, and later
changed, and the golang infrastructure's module proxy (and sumdb service)
had picked up the first tag. This is rather unlikely, and this test is thus a bit
over-cautious. The idea is that if it becomes invisible, it's fine to keep, and
gives us a bit of extra safety. However, if it becomes annoying (it's a giant
network dependency in our CI runs), it's not critical enough to be kept and
is OK to disable again.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-09-21 09:29:13 +02:00
Stephan Renatus 4a4185d799 ci: ensure we can build with different go versions
We only check the build, not the tests.
And we only check the latest release of the 1.15 and 1.16 series.
since 1.17 is what we build and test with anyways.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-08-30 16:56:53 -07:00
Torin Sandall cdc54e021d build: Add static image variant (#3635)
Fixes #3633

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-07-12 20:13:39 +02:00
Stephan Renatus 3877595601 ci: add binary smoke tests (windows, macos)
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-06-21 09:29:55 -04:00
Torin Sandall e1451a0db3 Update make image target to build static binary
Fixes #3531

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-06-04 15:05:28 -04:00
Torin Sandall f58815c247 Update check target to test if docker is running
This way `make` does not bomb out if docker not installed/running. This
is similar to what we do for the wasm library build.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-06-03 18:33:23 -04:00
Will Beason 52cf5b84b5 use golangci-lint run --fix instead of goimports
Signed-off-by: Will Beason <willbeason@google.com>
2021-06-03 16:09:02 -04:00
Will Beason 1281473250 Run dockerized golangci-lint
This means that "make lint" will work the same for everyone and the
workflow without additional coordination. Before this PR, it was
possible for maintainers to be on a different version of golangci-lint
than the one used by the GitHub workflow and so "make check" would
provide inconsistent results.

Also add timeout to configuration so we don't time out.`

Signed-off-by: Will Beason <willbeason@google.com>
2021-06-03 16:09:02 -04:00
Stephan Renatus d02eb0025a build: publish edge binaries for linux-static (#3515)
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-05-31 12:32:43 +02:00
Stephan Renatus f8ef59c184 build: add static (wasm-disabled) linux build (#3511)
* build: add static (wasm-disabled) linux build

Fixes #3499.

Also:

* build: deprecate 'release' and 'release-local' targets that aren't used in
   our build anymore, and will go away eventually.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-05-31 11:18:32 +02:00
Stephan Renatus e173a7722a build: ensure the binaries in docker images are executable (#3433)
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-05-05 18:48:14 +02:00