Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
thardeck committed Jan 23, 2025
1 parent 985adf7 commit 572134e
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 32 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/release-fleet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,43 +44,15 @@ jobs:
secrets: |
secret/data/github/repo/${{ github.repository }}/fossa/credential token | FOSSA_API_KEY
- name: Run FOSSA scan
uses: fossas/[email protected]
with:
api-key: ${{ env.FOSSA_API_KEY }}

- name: Run FOSSA tests
uses: fossas/[email protected]
with:
api-key: ${{ env.FOSSA_API_KEY }}
run-tests: false

- name: Check for code changes
continue-on-error: ${{ contains(github.ref, 'rc') }}
run: |
./.github/scripts/check-for-auto-generated-changes.sh
go mod verify
- name: Run unit tests
continue-on-error: ${{ contains(github.ref, 'rc') }}
run: go test -cover -tags=test $(go list ./... | grep -v -e /e2e -e /integrationtests -e /benchmarks)

- name: Install Ginkgo CLI
run: go install github.com/onsi/ginkgo/v2/ginkgo

- name: Run integration tests
continue-on-error: ${{ contains(github.ref, 'rc') }}
env:
SETUP_ENVTEST_VER: v0.0.0-20240115093953-9e6e3b144a69
ENVTEST_K8S_VERSION: 1.28
run: ./.github/scripts/run-integration-tests.sh

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Install Cosign
uses: sigstore/[email protected]

- name: "Read Vault Secrets"
uses: rancher-eio/read-vault-secrets@main
with:
Expand All @@ -89,6 +61,9 @@ jobs:
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-stg-registry/credentials username | STAGE_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-stg-registry/credentials password | STAGE_REGISTRY_PASSWORD ;
secret/data/github/repo/${{ github.repository}}/rancher-prime-registry/credentials username | PRIME_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository}}/rancher-prime-registry/credentials password | PRIME_REGISTRY_PASSWORD ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials registry | PRIME_REGISTRY;
- name: Log into Docker Container registry
uses: docker/login-action@v3
Expand All @@ -105,6 +80,13 @@ jobs:
password: ${{ env.STAGE_REGISTRY_PASSWORD }}
registry: ${{ env.REGISTRY }}

- name: Log into Prime registry
uses: docker/login-action@v3
with:
username: ${{ env.PRIME_REGISTRY_USERNAME }}
password: ${{ env.PRIME_REGISTRY_PASSWORD }}
registry: ${{ env.PRIME_REGISTRY }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
id: goreleaser
Expand All @@ -114,7 +96,8 @@ jobs:
args: release --clean --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
GORELEASER_CURRENT_TAG: "v0.12.0-alpha.0"
PRIME_REGISTRY: ${{ env.PRIME_REGISTRY }}

- name: Upload charts to release
env:
Expand Down
129 changes: 129 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ dockers:
# fleet-controller images
-
use: buildx
id: fleet-amd64-public

# GOOS of the built binaries/packages that should be used.
goos: linux
Expand Down Expand Up @@ -121,6 +122,7 @@ dockers:
extra_files: [ "package/log.sh" ]
-
use: buildx
id: fleet-arm64-public
goos: linux
goarch: arm64
ids:
Expand All @@ -143,6 +145,7 @@ dockers:
# fleet-agent images
-
use: buildx
id: fleet-agent-amd64-public
goos: linux
goarch: amd64
ids:
Expand All @@ -162,6 +165,7 @@ dockers:
- "--platform=linux/amd64"
-
use: buildx
id: fleet-agent-arm64-public
goos: linux
goarch: arm64
ids:
Expand All @@ -180,14 +184,139 @@ dockers:
- "--build-arg=BUILD_ENV=goreleaser"
- "--platform=linux/arm64/v8"

# fleet-controller images
-
use: buildx
id: fleet-amd64-private

# GOOS of the built binaries/packages that should be used.
goos: linux

# GOARCH of the built binaries/packages that should be used.
goarch: amd64

# IDs to filter the binaries/packages.
ids:
- fleet-controller
- fleet-cli

# Templates of the Docker image names.
image_templates:
- "{{ .Env.PRIME_REGISTRY }}/rancher/fleet:{{ .Tag }}-linux-amd64"

# Path to the Dockerfile (from the project root).
dockerfile: package/Dockerfile

# Template of the docker build flags.
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/rancher/fleet"
- "--build-arg=ARCH=amd64"
- "--build-arg=BUILD_ENV=goreleaser"
- "--platform=linux/amd64"
- "--sbom=true"
- "--provenance=true"
- "--provenance=mode=max"
extra_files: [ "package/log.sh" ]
-
use: buildx
id: fleet-arm64-private
goos: linux
goarch: arm64
ids:
- fleet-controller
- fleet-cli
image_templates:
- "{{ .Env.PRIME_REGISTRY }}/rancher/fleet:{{ .Tag }}-linux-arm64"
dockerfile: package/Dockerfile
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/rancher/fleet"
- "--build-arg=ARCH=arm64"
- "--build-arg=BUILD_ENV=goreleaser"
- "--platform=linux/arm64/v8"
- "--sbom=true"
- "--provenance=true"
- "--provenance=mode=max"
extra_files: [ "package/log.sh" ]
# fleet-agent images
-
use: buildx
id: fleet-agent-amd64-private
goos: linux
goarch: amd64
ids:
- fleet-agent
image_templates:
- "{{ .Env.PRIME_REGISTRY }}/rancher/fleet-agent:{{ .Tag }}-linux-amd64"
dockerfile: package/Dockerfile.agent
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/rancher/fleet"
- "--build-arg=ARCH=amd64"
- "--build-arg=BUILD_ENV=goreleaser"
- "--platform=linux/amd64"
- "--sbom=true"
- "--provenance=true"
- "--provenance=mode=max"
-
use: buildx
id: fleet-agent-arm64-private
goos: linux
goarch: arm64
ids:
- fleet-agent
image_templates:
- "{{ .Env.PRIME_REGISTRY }}/rancher/fleet-agent:{{ .Tag }}-linux-arm64"
dockerfile: package/Dockerfile.agent
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/rancher/fleet"
- "--build-arg=ARCH=arm64"
- "--build-arg=BUILD_ENV=goreleaser"
- "--platform=linux/arm64/v8"
- "--sbom=true"
- "--provenance=true"
- "--provenance=mode=max"

docker_manifests:
# https://goreleaser.com/customization/docker_manifest/
- name_template: "{{ .Env.REGISTRY }}/rancher/fleet:{{ .Tag }}"
id: fleet-manifest-public
image_templates:
- "{{ .Env.REGISTRY }}/rancher/fleet:{{ .Tag }}-linux-amd64"
- "{{ .Env.REGISTRY }}/rancher/fleet:{{ .Tag }}-linux-arm64"

- name_template: "{{ .Env.PRIME_REGISTRY }}/rancher/fleet:{{ .Tag }}"
id: fleet-manifest-private
image_templates:
- "{{ .Env.PRIME_REGISTRY }}/rancher/fleet:{{ .Tag }}-linux-amd64"
- "{{ .Env.PRIME_REGISTRY }}/rancher/fleet:{{ .Tag }}-linux-arm64"

- name_template: "{{ .Env.REGISTRY }}/rancher/fleet-agent:{{ .Tag }}"
id: fleet-agent-manifest-public
image_templates:
- "{{ .Env.REGISTRY }}/rancher/fleet-agent:{{ .Tag }}-linux-amd64"
- "{{ .Env.REGISTRY }}/rancher/fleet-agent:{{ .Tag }}-linux-arm64"

- name_template: "{{ .Env.PRIME_REGISTRY }}/rancher/fleet-agent:{{ .Tag }}"
id: fleet-agent-manifest-private
image_templates:
- "{{ .Env.PRIME_REGISTRY }}/rancher/fleet-agent:{{ .Tag }}-linux-amd64"
- "{{ .Env.PRIME_REGISTRY }}/rancher/fleet-agent:{{ .Tag }}-linux-arm64"

0 comments on commit 572134e

Please sign in to comment.