Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor release workflow
Browse files Browse the repository at this point in the history
sgalsaleh committed Dec 11, 2023
1 parent 42da70b commit 02e450c
Showing 4 changed files with 70 additions and 41 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/regression.yaml
Original file line number Diff line number Diff line change
@@ -90,15 +90,10 @@ jobs:
with:
name: kots
path: ./automation/jumpbox/bin
- name: Download kotsadm image
- name: Download kotsadm release
uses: actions/download-artifact@v3
with:
name: kotsadm-image
path: ./automation/jumpbox/docker-archive
- name: Download migrations
uses: actions/download-artifact@v3
with:
name: migrations-image
name: kotsadm-release
path: ./automation/jumpbox/docker-archive
- name: Make kotsadm airgap archive with minio image
working-directory: automation/jumpbox
97 changes: 65 additions & 32 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ jobs:
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
build-schema-migrations:
build-kotsadm-migrations:
runs-on: ubuntu-20.04
needs: [generate-tag]
steps:
@@ -80,11 +80,6 @@ jobs:
GIT_TAG: ${{ needs.generate-tag.outputs.tag }}
DOCKER_CONFIG: ./.docker
run: mapfile -t envs < <(grep -v '#.*' < .image.env) && export "${envs[@]}" && make -C migrations schema-release
- name: Upload airgap image
uses: actions/upload-artifact@v3
with:
name: migrations-image
path: ./migrations/bin/docker-archive

build-web:
runs-on: ubuntu-20.04
@@ -157,11 +152,8 @@ jobs:
name: kots
path: ./bin/kots

build-kotsadm:
build-minio:
runs-on: ubuntu-20.04
needs: [generate-tag]
permissions:
id-token: write # required to be able to assume the GCP SA identity to pull private Chainguard packages.
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -172,47 +164,93 @@ jobs:
with:
path: .image.env

- uses: ./.github/actions/build-push-kotsadm-image
with:
chainguard-gcp-wif-pool: ${{ secrets.CHAINGUARD_GCP_WIF_POOL }}
chainguard-gcp-sa: ${{ secrets.CHAINGUARD_GCP_SA }}
chainguard-gcp-project-id: ${{ secrets.CHAINGUARD_GCP_PROJECT_ID }}
image-name: index.docker.io/kotsadm/kotsadm:${{ needs.generate-tag.outputs.tag }}
git-tag: ${{ needs.generate-tag.outputs.tag }}
registry-username: ${{ secrets.DOCKERHUB_USER }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}

- uses: ./.github/actions/build-push-image-with-apko
with:
apko-config: deploy/minio/apko.yaml
image-name: index.docker.io/kotsadm/minio:${{ steps.dotenv.outputs.MINIO_TAG }}
registry-username: ${{ secrets.DOCKERHUB_USER }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}

build-rqlite:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Read image tags from env file
uses: falti/dotenv-action@v1
id: dotenv
with:
path: .image.env

- uses: ./.github/actions/build-push-image-with-apko
with:
apko-config: deploy/rqlite/apko.yaml
image-name: index.docker.io/kotsadm/rqlite:${{ steps.dotenv.outputs.RQLITE_TAG }}
registry-username: ${{ secrets.DOCKERHUB_USER }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}

build-dex:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Read image tags from env file
uses: falti/dotenv-action@v1
id: dotenv
with:
path: .image.env

- uses: ./.github/actions/build-push-image-with-apko
with:
apko-config: deploy/dex/apko.yaml
image-name: index.docker.io/kotsadm/dex:${{ steps.dotenv.outputs.DEX_TAG }}
registry-username: ${{ secrets.DOCKERHUB_USER }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}

build-kotsadm:
runs-on: ubuntu-20.04
needs: [generate-tag]
permissions:
id-token: write # required to be able to assume the GCP SA identity to pull private Chainguard packages.
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ./.github/actions/build-push-kotsadm-image
with:
chainguard-gcp-wif-pool: ${{ secrets.CHAINGUARD_GCP_WIF_POOL }}
chainguard-gcp-sa: ${{ secrets.CHAINGUARD_GCP_SA }}
chainguard-gcp-project-id: ${{ secrets.CHAINGUARD_GCP_PROJECT_ID }}
image-name: index.docker.io/kotsadm/kotsadm:${{ needs.generate-tag.outputs.tag }}
git-tag: ${{ needs.generate-tag.outputs.tag }}
registry-username: ${{ secrets.DOCKERHUB_USER }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}

build-release:
runs-on: ubuntu-20.04
needs: [build-kotsadm-migrations, build-kotsadm, build-minio, build-rqlite, build-dex]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Read image tags from env file
uses: falti/dotenv-action@v1
id: dotenv
with:
path: .image.env

- name: Build tagged release
env:
GIT_TAG: ${{ needs.generate-tag.outputs.tag }}
DOCKER_CONFIG: ./.docker
run: mapfile -t envs < <(grep -v '#.*' < .image.env) && export "${envs[@]}" && make build-release

- name: Upload airgap image
- name: Upload kotsadm release
uses: actions/upload-artifact@v3
with:
name: kotsadm-image
name: kotsadm-release
path: ./bin/docker-archive

goreleaser:
@@ -275,7 +313,7 @@ jobs:

generate-kurl-addon:
runs-on: ubuntu-20.04
needs: [ generate-tag, build-kurl-proxy, build-schema-migrations, build-kots, build-kotsadm ]
needs: [ generate-tag, build-kurl-proxy, build-kots, build-release ]
outputs:
addon_package_url: ${{ steps.addon-generate.outputs.addon_package_url }}
env:
@@ -384,17 +422,12 @@ jobs:
build-airgap:
runs-on: ubuntu-20.04
if: github.ref_type != 'branch'
needs: [build-kotsadm, goreleaser, build-schema-migrations, generate-tag]
needs: [goreleaser, generate-tag, build-release]
steps:
- name: Download migrations
uses: actions/download-artifact@v3
with:
name: migrations-image
path: ./docker-archive
- name: Download kotsadm image
- name: Download kotsadm release
uses: actions/download-artifact@v3
with:
name: kotsadm-image
name: kotsadm-release
path: ./docker-archive
- name: Make kotsadm airgap archive with minio image
run: |
@@ -442,7 +475,7 @@ jobs:
regression-test:
if: github.ref_type == 'branch'
needs: [ regression-test-setup, generate-tag, build-kots, build-kotsadm, generate-kurl-addon ]
needs: [ regression-test-setup, generate-tag, build-kots, generate-kurl-addon, build-release ]
uses: ./.github/workflows/regression.yaml
with:
version_tag_old: ${{ needs.regression-test-setup.outputs.last_release_tag }}
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -131,6 +131,9 @@ build-release:
mkdir -p bin/docker-archive/kotsadm
skopeo copy docker://kotsadm/kotsadm:${GIT_TAG} docker-archive:bin/docker-archive/kotsadm/${GIT_TAG}

mkdir -p bin/docker-archive/kotsadm-migrations
skopeo copy docker://kotsadm/kotsadm-migrations:${GIT_TAG} docker-archive:bin/docker-archive/kotsadm-migrations/${GIT_TAG}

mkdir -p bin/docker-archive/dex
skopeo copy docker://kotsadm/dex:${DEX_TAG} docker-archive:bin/docker-archive/dex/${DEX_TAG}

2 changes: 0 additions & 2 deletions migrations/Makefile
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@ schema-alpha: build_schema
.PHONY: schema-release
schema-release: IMAGE = kotsadm/${PROJECT_NAME}:${GIT_TAG}
schema-release: build_schema
mkdir -p bin/docker-archive/${PROJECT_NAME}
skopeo copy docker-daemon:kotsadm/${PROJECT_NAME}:${GIT_TAG} docker-archive:bin/docker-archive/${PROJECT_NAME}/${GIT_TAG}

build_schema:
docker build --pull --build-arg SCHEMAHERO_TAG=${SCHEMAHERO_TAG} -f deploy/Dockerfile -t ${IMAGE} .

0 comments on commit 02e450c

Please sign in to comment.