-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: race condition causing .status.accessmessage to not be setup (#46)
- Loading branch information
Showing
26 changed files
with
299 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,7 @@ name: Reusable Workflow | |
on: | ||
workflow_call: | ||
inputs: | ||
push: | ||
type: boolean | ||
default: false | ||
release: | ||
publish: | ||
type: boolean | ||
default: false | ||
|
||
|
@@ -21,26 +18,19 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Set up Go | ||
uses: ./.github/actions/setup-go | ||
|
||
- name: Build Binaries | ||
run: make build cli | ||
|
||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: all | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build Artifacts | ||
run: make build | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
|
@@ -49,50 +39,27 @@ jobs: | |
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: | | ||
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
# set latest tag for default branch | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{version}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
type=ref,event=pr | ||
type=ref,event=branch | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3.2.0 | ||
- if: ${{ ! inputs.publish }} | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
context: . | ||
push: ${{ inputs.push }} | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
|
||
# Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
distribution: goreleaser | ||
version: latest | ||
args: release --snapshot --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Just to make the .goreleaser.yml pass when not using `make ..` targets. | ||
IMG: img:local | ||
|
||
- name: Upload binaries to release | ||
if: ${{ inputs.release }} | ||
uses: svenstaro/upload-release-action@v2 | ||
- if: ${{ inputs.publish }} | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file_glob: true | ||
file: outputs/ozctl-* | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Just to make the .goreleaser.yml pass when not using `make ..` targets. | ||
IMG: img:local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ testbin/* | |
Dockerfile.cross | ||
|
||
# Binary outputs | ||
outputs/* | ||
dist | ||
|
||
# docker-buildx | ||
.buildx_cache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
before: | ||
# https://goreleaser.com/customization/hooks/ | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
# Manager | ||
- id: manager | ||
main: ./ | ||
binary: manager | ||
env: [CGO_ENABLED=0] | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
# CLI | ||
- id: cli | ||
main: ./ozctl | ||
binary: ozctl | ||
env: [CGO_ENABLED=0] | ||
goos: | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
universal_binaries: | ||
- id: cli | ||
name_template: ozctl | ||
replace: true | ||
|
||
dockers: | ||
# Local image only used for `make docker-load` | ||
- image_templates: ["{{ .Env.IMG }}"] | ||
dockerfile: Dockerfile | ||
use: buildx | ||
skip_push: true | ||
|
||
# Potential Release - AMD64 | ||
- image_templates: ["ghcr.io/diranged/{{ .ProjectName }}:{{ .Version }}-amd64"] | ||
dockerfile: Dockerfile | ||
goarch: amd64 | ||
use: buildx | ||
build_flag_templates: | ||
- --platform=linux/amd64 | ||
- --label=org.opencontainers.image.title={{ .ProjectName }} | ||
- --label=org.opencontainers.image.description={{ .ProjectName }} | ||
- --label=org.opencontainers.image.url=https://github.com/diranged/{{ .ProjectName }} | ||
- --label=org.opencontainers.image.source=https://github.com/diranged/{{ .ProjectName }} | ||
- --label=org.opencontainers.image.version={{ .Version }} | ||
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} | ||
- --label=org.opencontainers.image.revision={{ .FullCommit }} | ||
- --label=org.opencontainers.image.licenses=Apache-2.0 | ||
|
||
# Potential Release - ARM64 | ||
- image_templates: ["ghcr.io/diranged/{{ .ProjectName }}:{{ .Version }}-arm64v8"] | ||
goarch: arm64 | ||
dockerfile: Dockerfile | ||
use: buildx | ||
build_flag_templates: | ||
- --platform=linux/arm64/v8 | ||
- --label=org.opencontainers.image.title={{ .ProjectName }} | ||
- --label=org.opencontainers.image.description={{ .ProjectName }} | ||
- --label=org.opencontainers.image.url=https://github.com/diranged/{{ .ProjectName }} | ||
- --label=org.opencontainers.image.source=https://github.com/diranged/{{ .ProjectName }} | ||
- --label=org.opencontainers.image.version={{ .Version }} | ||
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} | ||
- --label=org.opencontainers.image.revision={{ .FullCommit }} | ||
- --label=org.opencontainers.image.licenses=Apache-2.0 | ||
|
||
docker_manifests: | ||
- id: | ||
name_template: ghcr.io/diranged/{{ .ProjectName }}:{{ .Version }} | ||
image_templates: | ||
- ghcr.io/diranged/{{ .ProjectName }}:{{ .Version }}-amd64 | ||
- ghcr.io/diranged/{{ .ProjectName }}:{{ .Version }}-arm64v8 | ||
|
||
- name_template: ghcr.io/diranged/{{ .ProjectName }}:latest | ||
image_templates: | ||
- ghcr.io/diranged/{{ .ProjectName }}:{{ .Version }}-amd64 | ||
- ghcr.io/diranged/{{ .ProjectName }}:{{ .Version }}-arm64v8 | ||
|
||
# https://goreleaser.com/customization/changelog/ | ||
changelog: | ||
use: github | ||
groups: | ||
- title: Features | ||
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' | ||
order: 0 | ||
- title: Bug fixes | ||
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' | ||
order: 1 | ||
- title: Others | ||
order: 999 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.