From 6906ae83fdae9c9bd3b0417a43441dc934fa3705 Mon Sep 17 00:00:00 2001 From: Bill Kable Date: Thu, 1 Apr 2021 12:00:59 -0500 Subject: [PATCH 1/5] Revert "updated with ghcr container image coordinate for TDC staging" This reverts commit 6722b81770d6ad95935e6ae95d4563daac14228f. --- deploy/platform/educates/workshop-deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/platform/educates/workshop-deploy.yaml b/deploy/platform/educates/workshop-deploy.yaml index 42dbf74..975e4ff 100644 --- a/deploy/platform/educates/workshop-deploy.yaml +++ b/deploy/platform/educates/workshop-deploy.yaml @@ -65,8 +65,8 @@ spec: spec: containers: - name: nginx - image: ghcr.io/platform-acceleration-lab/cnd-deploy-practices:staging - imagePullPolicy: Always + image: cnd-deploy-practices + imagePullPolicy: IfNotPresent - apiVersion: v1 kind: Service metadata: From d17cbeda2b1fb8549fdc7ba20677c5fd161e65e2 Mon Sep 17 00:00:00 2001 From: Ryan Schneider Date: Mon, 5 Apr 2021 12:20:29 -0400 Subject: [PATCH 2/5] separate release and deploy workflows --- .github/workflows/release-tag-push.yaml | 31 +++++++++++++++++++++++++ .github/workflows/release.yaml | 7 +----- Makefile | 1 + 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/release-tag-push.yaml diff --git a/.github/workflows/release-tag-push.yaml b/.github/workflows/release-tag-push.yaml new file mode 100644 index 0000000..6ff2abf --- /dev/null +++ b/.github/workflows/release-tag-push.yaml @@ -0,0 +1,31 @@ +name: Mark Release Image for Environment Deployment +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment' + required: true + default: 'staging' + # work around until release tags are available https://github.community/t/select-tag-release-when-running-workflow-dispatch/132970 + release: + description: 'Existing Release Tag' + required: true + default: 'vMajor.Minor.Bugfix' +jobs: + build: + name: Tag + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Login to GitHub Package Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Add environment tag to release + env: + VERSION: ${{ steps.extract_tag.outputs.tag }} + run: | + make release version=${{ github.event.inputs.environment }} environment=${{ github.event.inputs.environment }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6c45fad..9cb75be 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,7 +5,7 @@ on: jobs: build: - name: Staging Release + name: Release runs-on: ubuntu-20.04 steps: - name: Checkout Repo @@ -31,11 +31,6 @@ jobs: VERSION: ${{ steps.extract_tag.outputs.tag }} run: | make release version=$VERSION - - name: Publish staging tag to GitHub Package Registry - env: - VERSION: ${{ steps.extract_tag.outputs.tag }} - run: | - make deploy version=$VERSION environment=staging - name: Prune dangling images run: docker image prune -f - name: Upload Release Assets diff --git a/Makefile b/Makefile index 95c5dcd..a62e51a 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ release: docker push ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} deploy: + docker pull ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} docker tag ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${environment} docker push ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${environment} From c5d25a1670d0c8c5dba8032d91a78d77c5ac41b4 Mon Sep 17 00:00:00 2001 From: Ryan Schneider Date: Mon, 5 Apr 2021 12:30:42 -0400 Subject: [PATCH 3/5] trigger release workflow for all releases --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9cb75be..d82d090 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,7 +1,7 @@ name: Release on: release: - types: [prereleased] + types: [prereleased, published] jobs: build: From 2d75f557df882554dbdf6b13a2f5752276de31f9 Mon Sep 17 00:00:00 2001 From: Ryan Schneider Date: Mon, 5 Apr 2021 12:49:51 -0400 Subject: [PATCH 4/5] call "make deploy" instead of "make release" --- .github/workflows/release-tag-push.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-tag-push.yaml b/.github/workflows/release-tag-push.yaml index 6ff2abf..5230aed 100644 --- a/.github/workflows/release-tag-push.yaml +++ b/.github/workflows/release-tag-push.yaml @@ -24,8 +24,8 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Add environment tag to release + - name: Add environment tag to release and push env: VERSION: ${{ steps.extract_tag.outputs.tag }} run: | - make release version=${{ github.event.inputs.environment }} environment=${{ github.event.inputs.environment }} \ No newline at end of file + make deploy version=${{ github.event.inputs.environment }} environment=${{ github.event.inputs.environment }} \ No newline at end of file From ecb356d80ebc7cd08f809eef9e3ce9f7cc47a9ff Mon Sep 17 00:00:00 2001 From: Ryan Schneider Date: Mon, 5 Apr 2021 12:54:00 -0400 Subject: [PATCH 5/5] fix copy/paste error with tag-push workflow --- .github/workflows/release-tag-push.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-tag-push.yaml b/.github/workflows/release-tag-push.yaml index 5230aed..ef9b697 100644 --- a/.github/workflows/release-tag-push.yaml +++ b/.github/workflows/release-tag-push.yaml @@ -7,7 +7,7 @@ on: required: true default: 'staging' # work around until release tags are available https://github.community/t/select-tag-release-when-running-workflow-dispatch/132970 - release: + version: description: 'Existing Release Tag' required: true default: 'vMajor.Minor.Bugfix' @@ -28,4 +28,4 @@ jobs: env: VERSION: ${{ steps.extract_tag.outputs.tag }} run: | - make deploy version=${{ github.event.inputs.environment }} environment=${{ github.event.inputs.environment }} \ No newline at end of file + make deploy version=${{ github.event.inputs.version }} environment=${{ github.event.inputs.environment }} \ No newline at end of file