From cdad07b638b0011e4e3f99f73e254c9548041f74 Mon Sep 17 00:00:00 2001 From: Ellen Wittingen Date: Mon, 18 Mar 2024 17:53:42 +0100 Subject: [PATCH 1/9] added option to force execute all jobs to the delivery workflow --- .github/workflows/continuous-delivery.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 243a8c56c..223d8709e 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -7,6 +7,11 @@ on: description: Merge staging into master first? (y/N) required: false default: 'n' + ignore_metadata_diff: + type: boolean + description: Perform all jobs, regardless of whether there are actual changes? + required: false + default: false concurrency: group: cd-${{ github.ref_name }} @@ -79,11 +84,11 @@ jobs: fi - name: Checkout code - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Run merge - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f # tag=v1.4.0 with: type: now @@ -93,7 +98,7 @@ jobs: - name: Get merge commit SHA id: get_sha - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} run: | git fetch origin master echo 'sha='"$(git rev-parse origin/master)" >> "$GITHUB_OUTPUT" @@ -101,7 +106,7 @@ jobs: continuous_integration: name: Continuous Integration needs: [metadata, merge] - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} uses: csvalpha/amber-ui/.github/workflows/continuous-integration.yml@staging with: sha: ${{ needs.merge.outputs.sha }} @@ -109,7 +114,7 @@ jobs: publish_image: name: Publish Image needs: [metadata, merge] - if: fromJSON(needs.metadata.outputs.has_diff) + if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} uses: csvalpha/amber-ui/.github/workflows/publish-image.yml@staging with: sha: ${{ needs.merge.outputs.sha }} @@ -122,8 +127,8 @@ jobs: needs: [metadata, merge, continuous_integration, publish_image] if: | (github.ref_name == 'staging' || github.ref_name == 'master') && ((github.ref_name == 'master' && - github.event.inputs.merge == 'y' && fromJSON(needs.metadata.outputs.has_diff) && success()) || - ((github.event.inputs.merge != 'y' || !fromJSON(needs.metadata.outputs.has_diff)) && !cancelled())) + github.event.inputs.merge == 'y' && (fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }}) && success()) || + ((github.event.inputs.merge != 'y' || !(fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }})) && !cancelled())) steps: - name: Get environment URL id: get_url From d2edcec797689bac42c633563a67340eac0b79c4 Mon Sep 17 00:00:00 2001 From: Ellen Wittingen Date: Mon, 18 Mar 2024 18:04:13 +0100 Subject: [PATCH 2/9] added instructions about problem in the readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8c0b5652b..33c94fb5f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ Deployments are done using GitHub Actions. To deploy a branch, follow the follow - Choose a branch and if you want to merge the changes on the staging branch into the master branch (only possible when the branch chosen in previous step is master). - Click the green button "Run workflow". +*Note: If the workflow fails with an error message about blobs along the lines of the following: `buildx failed with: ERROR: failed to solve: [...] blob [...]`: remove all recent cache files for staging on the [Caches page](https://github.com/csvalpha/amber-ui/actions/caches) and try again. You might have to turn on the option `Perform all jobs, regardless of whether there are actual changes?` to force the workflow to re-execute all its jobs.* + ## Further Reading / Useful Links - [ember.js](https://emberjs.com/) From ae5a0b271c736a7fc219f7e0396c8419aa2015ab Mon Sep 17 00:00:00 2001 From: Ellen Wittingen Date: Mon, 18 Mar 2024 18:20:27 +0100 Subject: [PATCH 3/9] removed unneccesary braces --- .github/workflows/continuous-delivery.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 223d8709e..aedc0ec9b 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -84,11 +84,11 @@ jobs: fi - name: Checkout code - if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Run merge - if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f # tag=v1.4.0 with: type: now @@ -98,7 +98,7 @@ jobs: - name: Get merge commit SHA id: get_sha - if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff run: | git fetch origin master echo 'sha='"$(git rev-parse origin/master)" >> "$GITHUB_OUTPUT" @@ -106,7 +106,7 @@ jobs: continuous_integration: name: Continuous Integration needs: [metadata, merge] - if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff uses: csvalpha/amber-ui/.github/workflows/continuous-integration.yml@staging with: sha: ${{ needs.merge.outputs.sha }} @@ -114,7 +114,7 @@ jobs: publish_image: name: Publish Image needs: [metadata, merge] - if: fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }} + if: fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff uses: csvalpha/amber-ui/.github/workflows/publish-image.yml@staging with: sha: ${{ needs.merge.outputs.sha }} @@ -127,8 +127,8 @@ jobs: needs: [metadata, merge, continuous_integration, publish_image] if: | (github.ref_name == 'staging' || github.ref_name == 'master') && ((github.ref_name == 'master' && - github.event.inputs.merge == 'y' && (fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }}) && success()) || - ((github.event.inputs.merge != 'y' || !(fromJSON(needs.metadata.outputs.has_diff) || ${{ github.event.inputs.ignore_metadata_diff }})) && !cancelled())) + github.event.inputs.merge == 'y' && (fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff) && success()) || + ((github.event.inputs.merge != 'y' || !(fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff)) && !cancelled())) steps: - name: Get environment URL id: get_url From 9d323857ad82140148b6309b1722560be79c7779 Mon Sep 17 00:00:00 2001 From: lodewiges <131907615+lodewiges@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:42:43 +0100 Subject: [PATCH 4/9] change n/y to boolean --- .github/workflows/continuous-delivery.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index aedc0ec9b..e3d7afc09 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -4,9 +4,10 @@ on: workflow_dispatch: inputs: merge: - description: Merge staging into master first? (y/N) + type: boolean + description: Merge staging into master first? required: false - default: 'n' + default: false ignore_metadata_diff: type: boolean description: Perform all jobs, regardless of whether there are actual changes? From 7fbc05fccb25558173dd591c52bf9586e5fb7a03 Mon Sep 17 00:00:00 2001 From: lodewiges <131907615+lodewiges@users.noreply.github.com> Date: Sat, 9 Nov 2024 23:23:05 +0100 Subject: [PATCH 5/9] fixed comment --- .github/workflows/continuous-delivery.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index e3d7afc09..7ab738aab 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -49,7 +49,7 @@ jobs: INPUT_MERGE: ${{ github.event.inputs.merge }} run: | if [ "$GITHUB_REF_NAME" = 'master' ]; then - if [ "${INPUT_MERGE,,}" = 'y' ]; then + if [ "${INPUT_MERGE,,}" = 'true' ]; then git fetch origin staging if ! git diff origin/master origin/staging --exit-code; then echo 'has_diff=true' >> "$GITHUB_OUTPUT" From ae9befd4e1c724c6fb27cc11bfacc0ee5e19f9ae Mon Sep 17 00:00:00 2001 From: lodewiges <131907615+lodewiges@users.noreply.github.com> Date: Sat, 9 Nov 2024 23:29:37 +0100 Subject: [PATCH 6/9] fix part 2 --- .github/workflows/continuous-delivery.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 7ab738aab..6dd8bf2e6 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -49,7 +49,7 @@ jobs: INPUT_MERGE: ${{ github.event.inputs.merge }} run: | if [ "$GITHUB_REF_NAME" = 'master' ]; then - if [ "${INPUT_MERGE,,}" = 'true' ]; then + if [ "$INPUT_MERGE" = true ]; then git fetch origin staging if ! git diff origin/master origin/staging --exit-code; then echo 'has_diff=true' >> "$GITHUB_OUTPUT" From 433f4b21e43f47aea3c417296666e9ae30b03490 Mon Sep 17 00:00:00 2001 From: lodewiges <131907615+lodewiges@users.noreply.github.com> Date: Sat, 9 Nov 2024 23:33:26 +0100 Subject: [PATCH 7/9] fix part 3 --- .github/workflows/continuous-delivery.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 6dd8bf2e6..ea5e16cb4 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -67,7 +67,7 @@ jobs: name: Merge runs-on: ubuntu-latest needs: metadata - if: github.event.inputs.merge == 'y' + if: github.event.inputs.merge == true outputs: sha: ${{ steps.get_sha.outputs.sha }} steps: @@ -128,8 +128,8 @@ jobs: needs: [metadata, merge, continuous_integration, publish_image] if: | (github.ref_name == 'staging' || github.ref_name == 'master') && ((github.ref_name == 'master' && - github.event.inputs.merge == 'y' && (fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff) && success()) || - ((github.event.inputs.merge != 'y' || !(fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff)) && !cancelled())) + github.event.inputs.merge && (fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff) && success()) || + ((!github.event.inputs.merge || !(fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff)) && !cancelled())) steps: - name: Get environment URL id: get_url From 1087289a455583e012e2e821ecb77384b0503640 Mon Sep 17 00:00:00 2001 From: lodewiges <131907615+lodewiges@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:45:35 +0100 Subject: [PATCH 8/9] Update continuous-delivery.yml --- .github/workflows/continuous-delivery.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index ea5e16cb4..bb0653006 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -46,10 +46,10 @@ jobs: - name: Get metadata id: get_metadata env: - INPUT_MERGE: ${{ github.event.inputs.merge }} + INPUT_MERGE: ${{ inputs.merge }} run: | if [ "$GITHUB_REF_NAME" = 'master' ]; then - if [ "$INPUT_MERGE" = true ]; then + if [ "$INPUT_MERGE" ]; then git fetch origin staging if ! git diff origin/master origin/staging --exit-code; then echo 'has_diff=true' >> "$GITHUB_OUTPUT" @@ -67,7 +67,7 @@ jobs: name: Merge runs-on: ubuntu-latest needs: metadata - if: github.event.inputs.merge == true + if: inputs.merge outputs: sha: ${{ steps.get_sha.outputs.sha }} steps: @@ -128,8 +128,8 @@ jobs: needs: [metadata, merge, continuous_integration, publish_image] if: | (github.ref_name == 'staging' || github.ref_name == 'master') && ((github.ref_name == 'master' && - github.event.inputs.merge && (fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff) && success()) || - ((!github.event.inputs.merge || !(fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff)) && !cancelled())) + inputs.merge && (fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff) && success()) || + ((!inputs.merge || !(fromJSON(needs.metadata.outputs.has_diff) || github.event.inputs.ignore_metadata_diff)) && !cancelled())) steps: - name: Get environment URL id: get_url From d96386b3e3e280f4ad52256e002dd76c414cecd0 Mon Sep 17 00:00:00 2001 From: lodewiges <131907615+lodewiges@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:47:52 +0100 Subject: [PATCH 9/9] Update continuous-delivery.yml --- .github/workflows/continuous-delivery.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 97682581a..36a1b18f2 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -49,7 +49,7 @@ jobs: INPUT_MERGE: ${{ inputs.merge }} run: | if [ "$GITHUB_REF_NAME" = 'master' ]; then - if [ "$INPUT_MERGE" ]; then + if [ "$INPUT_MERGE" == 'true' ]; then git fetch origin staging if ! git diff origin/master origin/staging --exit-code; then echo 'has_diff=true' >> "$GITHUB_OUTPUT"