Compare commits

..
7 Commits
Author SHA1 Message Date
Terraform User 1fdfec73a1 Managed by Terraform 2026-04-27 18:39:00 +00:00
Vitor Rodrigo Vezani aee298e2e0 add notice to include registry change and immutable images notice (#1191)
* add notice to include registry change and immutable images notice

* try to fix tests

* Refactor goreleaser script to conditionally skip Docker tags based on release status

* remove if
2026-04-27 12:42:05 -03:00
Vitor Rodrigo Vezani 0444cf92bc unify release process along with others OSS projects (#1192)
* unify release process along with others OSS projects

* remove docker loging

* override polaris image repository for tests

* fix polaris

* adding snapshot back

* store snapshot version into circleci workspace and load with kind on k8s cluster

* add test back

* add test back

* fix polaris config
2026-04-27 12:24:11 -03:00
Terraform User 50e4c63079 Managed by Terraform 2026-04-24 20:23:41 +00:00
Terraform User 7d053a6cbd Managed by Terraform 2026-04-23 15:34:04 +00:00
Terraform User d50336387b Managed by Terraform 2026-04-23 14:42:23 +00:00
Vitor Rodrigo Vezani 1554c90ece Add GCR support (#1189) 2026-04-22 10:45:37 -03:00
9 changed files with 240 additions and 150 deletions
+112 -12
View File
@@ -13,10 +13,10 @@ commands:
install_goreleaser_dependencies:
description: Installs dependencies for CI scripts
steps:
- run: apk update
# Register other docker platforms, to build arm64.
# This shouldn't be needed, why TBD.
- run: docker run --privileged --rm tonistiigi/binfmt --install all
- run: apk update
# Register other docker platforms, to build arm64.
# This shouldn't be needed, why TBD.
- run: docker run --privileged --rm tonistiigi/binfmt --install all
references:
set_environment_variables: &set_environment_variables
@@ -105,6 +105,26 @@ references:
sha256sum vault_1.13.2_linux_amd64.zip | grep f7930279de8381de7c532164b4a4408895d9606c0d24e2e9d2f9acb5dfe99b3c
unzip vault_1.13.2_linux_amd64.zip
mv vault /usr/bin/vault
setup_qemu_binfmt: &setup_qemu_binfmt
run:
name: Setup QEMU for multi-arch Docker builds
command: |
sudo apt-get update -y
sudo apt-get install -y qemu-user-static binfmt-support
docker buildx create --use || true
docker buildx inspect --bootstrap
load_polaris_image_into_kind: &load_polaris_image_into_kind
run:
name: Load Polaris snapshot image into Kind
command: |
TAR="/tmp/workspace/docker_save/polaris_${CIRCLE_SHA1}.tar"
if [ -f "$TAR" ]; then
echo "Loading snapshot image from $TAR"
docker load -i "$TAR"
kind load docker-image "us-docker.pkg.dev/fairwinds-ops/oss/polaris:${CIRCLE_SHA1}"
else
echo "No snapshot tar (tag workflow); tests will pull the image from the registry."
fi
jobs:
test_k8s:
working_directory: ~/polaris
@@ -113,7 +133,10 @@ jobs:
steps:
- checkout
- *set_environment_variables
- attach_workspace:
at: /tmp/workspace
- *install_k8s
- *load_polaris_image_into_kind
- *test_k8s
test:
@@ -126,7 +149,7 @@ jobs:
- run: go test ./... -coverprofile=coverage.txt -covermode=count
- *test_binary_dashboard
build_and_push:
release:
working_directory: /go/src/github.com/fairwindsops/polaris/
resource_class: large
shell: /bin/bash
@@ -144,35 +167,112 @@ jobs:
- rok8s/get_vault_env:
vault_path: repo/polaris/env
- *set_environment_variables
- run: docker login quay.io -u="${FAIRWINDS_QUAY_USER}" -p="${FAIRWINDS_QUAY_TOKEN}"
- run:
name: docker login Google Artifact Registry
command: |
docker login -u _json_key -p "$(echo $GCP_ARTIFACTREADWRITE_JSON_KEY | base64 -d)" us-docker.pkg.dev
- install_goreleaser_dependencies
- run: scripts/goreleaser.sh
- run: echo 'export GORELEASER_CURRENT_TAG="${CIRCLE_TAG}"' >> $BASH_ENV
- run: goreleaser release --clean
- run: mkdir -p /tmp/workspace/docker_save && touch /tmp/workspace/docker_save/.release-workspace-marker
- persist_to_workspace:
root: /tmp/workspace
paths:
- docker_save
snapshot:
working_directory: /home/circleci/project
machine:
image: ubuntu-2204:current
resource_class: large
shell: /bin/bash
steps:
- checkout
- *setup_qemu_binfmt
- run:
name: goreleaser release (snapshot, local only)
environment:
GORELEASER_SKIP_RELEASE: "true"
command: |
set -euo pipefail
REPO_ROOT="${HOME}/project"
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "${REPO_ROOT}:/workspace" -w /workspace \
-e GORELEASER_SKIP_RELEASE=true \
-e CIRCLE_SHA1 \
-e CIRCLE_BRANCH \
-e CIRCLE_TAG \
--entrypoint sh \
goreleaser/goreleaser:v2.15.4 \
-c 'git config --global --add safe.directory /workspace && cd /workspace && goreleaser release --snapshot --clean --skip=sign,homebrew'
- run: mkdir -p /tmp/workspace/docker_save/
- run:
name: Tag and save amd64 image for Kind
command: |
set -euo pipefail
docker tag "us-docker.pkg.dev/fairwinds-ops/oss/polaris:${CIRCLE_SHA1}-amd64" "us-docker.pkg.dev/fairwinds-ops/oss/polaris:${CIRCLE_SHA1}"
docker save "us-docker.pkg.dev/fairwinds-ops/oss/polaris:${CIRCLE_SHA1}" -o "/tmp/workspace/docker_save/polaris_${CIRCLE_SHA1}.tar"
- persist_to_workspace:
root: /tmp/workspace
paths:
- docker_save
- store_artifacts:
path: dist
destination: snapshot
workflows:
version: 2
release:
branch:
jobs:
- test:
filters:
tags:
ignore: /.*/
- snapshot:
filters:
branches:
ignore: /pull\/[0-9]+/
tags:
ignore: /.*/
- test_k8s:
requires:
- snapshot
filters:
branches:
ignore: /pull\/[0-9]+/
tags:
ignore: /.*/
tag_release:
jobs:
- test:
filters:
tags:
only: /.*/
- build_and_push:
branches:
ignore: /.*/
- release:
requires:
- test
context: org-global
filters:
branches:
ignore: /pull\/[0-9]+/
ignore: /.*/
tags:
ignore: /^testing-.*/
- test_k8s:
requires:
- build_and_push
- release
filters:
branches:
ignore: /pull\/[0-9]+/
ignore: /.*/
tags:
ignore: /^testing-.*/
- oss-docs/publish-docs:
requires:
- test_k8s
repository: polaris
filters:
branches:
+79 -76
View File
@@ -1,14 +1,8 @@
## DO NOT EDIT - Managed by Terraform
# yaml-language-server: $$schema=https://goreleaser.com/static/schema.json
version: 2
checksum:
name_template: 'checksums.txt'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
env:
- GOBIN={{ .Env.TMPDIR }}/go-bin
project_name: polaris
before:
hooks:
- go mod download
@@ -30,31 +24,13 @@ builds:
goarm:
- "6"
- "7"
# Go does not support windows/arm (32-bit); only windows/arm64 is supported.
ignore:
- goos: windows
goarch: arm
archives:
- id: polaris
builds: ["polaris"]
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
signs:
- cmd: cosign
args: ["sign-blob", "--key=hashivault://cosign", "-output-signature=${signature}", "${artifact}"]
artifacts: checksum
release:
# Branch/PR builds set GORELEASER_SKIP_RELEASE=true; tag builds set false.
disable: '{{ eq .Env.GORELEASER_SKIP_RELEASE "true" }}'
prerelease: auto
footer: |
You can verify the signature of the checksums.txt file using [cosign](https://github.com/sigstore/cosign).
```
cosign verify-blob checksums.txt --signature=checksums.txt.sig --key https://artifacts.fairwinds.com/cosign.pub
```
- goos: windows
goarch: arm64
brews:
- name: polaris
skip_upload: '{{ eq .Env.GORELEASER_SKIP_RELEASE "true" }}'
repository:
owner: FairwindsOps
name: homebrew-tap
@@ -63,51 +39,78 @@ brews:
url_template: "https://github.com/FairwindsOps/polaris/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
test: |
system "#{bin}/polaris version"
release:
disable: '{{ eq (envOrDefault "GORELEASER_SKIP_RELEASE" "false") "true" }}'
prerelease: auto
github:
owner: FairwindsOps
name: polaris
footer: |
You can verify the signatures of both the checksums.txt file and the published docker images using [cosign](https://github.com/sigstore/cosign).
```bash
cosign verify-blob checksums.txt --bundle=checksums.txt.sigstore.json --key https://artifacts.fairwinds.com/cosign-p256.pub
```
```bash
cosign verify us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .Tag }} --key https://artifacts.fairwinds.com/cosign-p256.pub
```
checksum:
name_template: "checksums.txt"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
signs:
- cmd: cosign
signature: "${artifact}.sigstore.json"
args:
- "sign-blob"
- "--key=hashivault://cosign-p256"
- "--bundle=${signature}"
- "${artifact}"
- "--yes"
artifacts: all
docker_signs:
- artifacts: all
args: ["sign", "--key=hashivault://cosign-p256", "us-docker.pkg.dev/fairwinds-ops/oss/polaris@${digest}", "-r", "--yes"]
dockers:
# There are multiple images to match the `--platform` docker build flag with
# combinations of `GOOS`, `GOARCH`, and `GOARM`
- image_templates:
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-amd64"
use: buildx
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-arm64"
use: buildx
goarch: arm64
goos: linux
build_flag_templates:
- "--platform=linux/arm64"
- image_templates:
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .FullCommit }}-amd64"
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .Tag }}-amd64"
use: buildx
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .FullCommit }}-arm64v8"
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .Tag }}-arm64v8"
use: buildx
goarch: arm64
goos: linux
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm64/v8"
- image_templates:
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .FullCommit }}-armv7"
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .Tag }}-armv7"
use: buildx
goarch: arm
goarm: 7
goos: linux
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm/v7"
docker_manifests:
# Create Docker manifests that make multiple architectures available within a tag,
# and provide partial-version tags like 2, and 2.2.
- name_template: quay.io/fairwinds/polaris:{{ .FullCommit }}
image_templates:
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-amd64"
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-arm64"
- name_template: 'quay.io/fairwinds/polaris:{{ envOrDefault "FEATURE_DOCKER_TAG" "none" }}'
# Tag builds set GORELEASER_SKIP_FEATURE_DOCKER_TAGS=true; feature branches set false.
skip_push: '{{ eq .Env.GORELEASER_SKIP_FEATURE_DOCKER_TAGS "true" }}'
image_templates:
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-amd64"
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-arm64"
- name_template: quay.io/fairwinds/polaris:latest
skip_push: '{{ eq .Env.GORELEASER_SKIP_RELEASE "true" }}'
image_templates:
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-amd64"
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-arm64"
- name_template: quay.io/fairwinds/polaris:{{ .Tag }}
skip_push: '{{ eq .Env.GORELEASER_SKIP_RELEASE "true" }}'
image_templates:
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-amd64"
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-arm64"
- name_template: quay.io/fairwinds/polaris:{{ .Major }}
skip_push: '{{ eq .Env.GORELEASER_SKIP_RELEASE "true" }}'
image_templates:
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-amd64"
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-arm64"
- name_template: quay.io/fairwinds/polaris:{{ .Major }}.{{ .Minor }}
skip_push: '{{ eq .Env.GORELEASER_SKIP_RELEASE "true" }}'
image_templates:
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-amd64"
- "quay.io/fairwinds/polaris:{{ .FullCommit }}-arm64"
- name_template: us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .Tag }}
image_templates:
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .Tag }}-amd64"
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .Tag }}-arm64v8"
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .Tag }}-armv7"
- name_template: us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .FullCommit }}
image_templates:
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .FullCommit }}-amd64"
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .FullCommit }}-arm64v8"
- "us-docker.pkg.dev/fairwinds-ops/oss/polaris:{{ .FullCommit }}-armv7"
+38
View File
@@ -29,6 +29,44 @@ Polaris can be run in three different modes:
## Documentation
Check out the [documentation at docs.fairwinds.com](https://polaris.docs.fairwinds.com)
## Notice: Registry Migration and Immutable Images (v10.1.8 → v10.2.0)
Starting with **v10.2.0**:
- Images moved to `us-docker.pkg.dev/fairwinds-ops/oss/polaris`
- `quay.io/fairwinds/polaris` is deprecated
### Required action
```diff
- quay.io/fairwinds/polaris:<tag>
+ us-docker.pkg.dev/fairwinds-ops/oss/polaris:<tag>
```
---
## Immutable and signed images
* Images are now **signed**
* Tags are **immutable**
* No more floating tags:
* `v10`
* `v10.1`
* `latest`
Use full version tags:
```
us-docker.pkg.dev/fairwinds-ops/oss/polaris:v<major>.<minor>.<patch>
```
Or pin by digest:
```
us-docker.pkg.dev/fairwinds-ops/oss/polaris@sha256:<digest>
```
<!-- Begin boilerplate -->
## Join the Fairwinds Open Source Community
+3 -3
View File
@@ -46,11 +46,11 @@ go test ./pkg/... -v -coverprofile cover.out
### Webhook tests
```bash
kind create cluster --wait=90s --image kindest/node:v1.15.11 --name polaris-test
docker build -t quay.io/fairwinds/polaris:debug . # or use your own registry
docker push quay.io/fairwinds/polaris:debug
docker build -t us-docker.pkg.dev/fairwinds-ops/oss/polaris:debug . # or use your own registry
docker push us-docker.pkg.dev/fairwinds-ops/oss/polaris:debug
helm repo add jetstack https://charts.jetstack.io
helm install cert-manager jetstack/cert-manager --namespace cert-manager --version v1.12.1 --set "installCRDs=true" --wait
POLARIS_IMAGE=quay.io/fairwinds/polaris:debug ./test/webhook_test.sh
POLARIS_IMAGE=us-docker.pkg.dev/fairwinds-ops/oss/polaris:debug ./test/webhook_test.sh
```
to avoid the final cleanup for debugging purposes, you can run
```bash
+1 -1
View File
@@ -42,7 +42,7 @@ polaris dashboard --port 8080 --audit-path=./deploy/
### Local Docker container
```
docker run -d -p8080:8080 -v ~/.kube/config:/opt/app/config:ro quay.io/fairwinds/polaris:1.2 polaris dashboard --kubeconfig /opt/app/config
docker run -d -p8080:8080 -v ~/.kube/config:/opt/app/config:ro us-docker.pkg.dev/fairwinds-ops/oss/polaris:1.2 polaris dashboard --kubeconfig /opt/app/config
```
## Using the Dashboard
+1 -1
View File
@@ -4,4 +4,4 @@ options:
images:
docker:
- quay.io/fairwinds/polaris:$CI_SHA1
- us-docker.pkg.dev/fairwinds-ops/oss/polaris:$CI_SHA1
-55
View File
@@ -1,55 +0,0 @@
#!/usr/bin/env sh
# Wrap goreleaser with branch/tag-specific env (see .goreleaser.yml templates)
# and, on non-tag CI runs, a temporary git tag.
cleanup() {
if [ "${CIRCLE_TAG}" == "" ] ; then
echo "${this_script} deleting git tag ${temporary_git_tag} for goreleaser"
unset GORELEASER_CURRENT_TAG
git tag -d ${temporary_git_tag}
fi
}
set -eE # errexit and errtrace
trap 'cleanup' ERR
this_script="$(basename $0)"
hash goreleaser
if [ "${TMPDIR}" == "" ] ; then
export TMPDIR="/tmp"
echo "${this_script} temporarily set the TMPDIR environment variable to ${TMPDIR}, used for a temporary GOBIN environment variable"
fi
export GORELEASER_SKIP_FEATURE_DOCKER_TAGS=false
export GORELEASER_SKIP_RELEASE=true
if [ "${CIRCLE_TAG}" == "" ] ; then
# Create a temporary tag for goreleaser, incrementing the last tag.
last_git_tag="$(git describe --tags --abbrev=0 2>/dev/null)"
if [ "${last_git_tag}" == "" ] ; then
echo "${this_script} is unable to determine the last git tag so a temporary tag can be created, using: git describe --tags --abbrev=0"
exit 1
fi
if [ "$(git config user.email)" == "" ] ; then
# git will use this env var as its user.email.
# git tag -m is used in case tags are manually pushed by accident,
# however git tag -m requires an email.
export EMAIL='goreleaser_ci@fairwinds.com'
echo "${this_script} using ${EMAIL} temporarily as the git user.email"
fi
temporary_git_tag=$(echo "${last_git_tag}" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')-rc
echo "${this_script} creating temporary git tag ${temporary_git_tag} for goreleaser, the last real tag is ${last_git_tag}"
# The -f is included to overwrite existing tags, perhaps from previous CI jobs.
git tag -f -m "temporary local tag for goreleaser" ${temporary_git_tag}
export GORELEASER_CURRENT_TAG=${temporary_git_tag}
# Use an adjusted git feature branch name as a docker tag; export so goreleaser receives .Env.FEATURE_DOCKER_TAG.
export FEATURE_DOCKER_TAG=$(echo "${CIRCLE_BRANCH:0:26}" | sed 's/[^a-zA-Z0-9]/-/g' | sed 's/-\+$//')
echo "${this_script} also using docker tag ${FEATURE_DOCKER_TAG} since ${CIRCLE_BRANCH} is a feature branch"
else
export GORELEASER_CURRENT_TAG=${CIRCLE_TAG}
echo "${this_script} setting GORELEASER_SKIP_RELEASE to false, and GORELEASER_SKIP_FEATURE_DOCKER_TAGS to true, because CIRCLE_TAG is set"
export GORELEASER_SKIP_FEATURE_DOCKER_TAGS=true
export GORELEASER_SKIP_RELEASE=false
fi
echo "${this_script} using git tag ${GORELEASER_CURRENT_TAG}"
goreleaser --skip=sign "$@"
cleanup
+3 -1
View File
@@ -22,7 +22,9 @@ function check_timeout() {
helm repo add fairwinds-stable https://charts.fairwinds.com/stable
helm install polaris fairwinds-stable/polaris --namespace polaris --create-namespace \
--set image.tag=$CI_SHA1
--set image.repository=us-docker.pkg.dev/fairwinds-ops/oss/polaris \
--set image.tag=$CI_SHA1 \
--set image.pullPolicy=IfNotPresent
check_dashboard_is_ready
+3 -1
View File
@@ -88,7 +88,9 @@ helm install polaris fairwinds-stable/polaris --namespace polaris --create-names
--set dashboard.enable=false \
--set webhook.enable=true \
--set webhook.mutate=true \
--set image.tag=$CI_SHA1
--set image.repository=us-docker.pkg.dev/fairwinds-ops/oss/polaris \
--set image.tag=$CI_SHA1 \
--set image.pullPolicy=IfNotPresent
echo "Waiting for the webhook to come online"
check_webhook_is_ready