From 7f2bf3b32096f4b4c438b948e1bb0843c39e45d6 Mon Sep 17 00:00:00 2001 From: illuminatus Date: Wed, 29 Nov 2023 00:57:22 -0800 Subject: [PATCH] Add new inputs to workflow summary and correct conditional statement. (#1712) ## Description Use correct syntax to access workflow input variables for Docker Image workflow. Adds GUILD_DEPLOY_BRANCH and Push to GA Registry as the inverse of **testing** boolean. ## Where should the reviewer start? Check job summaries from the **How has this been tested?** section. ## Motivation and context Fixes a mistake in the if condition for the push and adds the details to the summary output. ## Which issue it fixes? N/A / CI ## How has this been tested? Jobs: * Inputs: [branch:alpha, testing=true](https://github.com/cardano-community/guild-operators/actions/runs/7015236578) * Step **docker push latest** not run * Summary **Push to GA Registry** False * Inputs: [branch:alpha, testing=false](https://github.com/cardano-community/guild-operators/actions/runs/7015458964/job/19084816266) * Step **docker push latest** not run * Summary **Push to GA Registry** False * Inputs: [branch:master, testing=true](https://github.com/cardano-community/guild-operators/actions/runs/7015459989) * Step **docker push latest** not run * Summary **Push to GA Registry** False * Inputs: [branch:master, testing=false](https://github.com/cardano-community/guild-operators/actions/runs/7015483984) * Step **docker push latest** run * Summary **Push to GA Registry** True ## Examples Summary for a GA Image build: ``` Summary Details Docker Image: docker.io/***/cardano-node:8.1.2 G_ACCOUNT: cardano-community GUILD_DEPLOY_BRANCH: master Push to GA Registry: true CNVERSION: 8.1.2 ``` Summary for a test Image build: ``` Summary Details Docker Image: docker.io/***/cardano-node:8.1.2 G_ACCOUNT: cardano-community GUILD_DEPLOY_BRANCH: alpha Push to GA Registry: false CNVERSION: 8.1.2 ``` --------- Co-authored-by: Ola [AHLNET] Co-authored-by: RdLrT <3169068+rdlrt@users.noreply.github.com> --- .github/workflows/docker_bin.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_bin.yml b/.github/workflows/docker_bin.yml index a56fe0bf6..d3872a78b 100644 --- a/.github/workflows/docker_bin.yml +++ b/.github/workflows/docker_bin.yml @@ -30,13 +30,14 @@ jobs: run: | echo "G_ACCOUNT=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV echo "CNVERSION=$(cat files/docker/node/release-versions/cardano-node-latest.txt)" >> $GITHUB_ENV + echo "PUSH_TO_GA=false" >> $GITHUB_ENV - name: Compiling new node software suite run: | DOCKER_BUILDKIT=1 docker build . \ --file files/docker/node/dockerfile_bin \ --compress \ --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --build-arg GUILD_DEPLOY_BRANCH=${{ env.guild_deploy_branch }} \ + --build-arg GUILD_DEPLOY_BRANCH=${{ github.event.inputs.guild_deploy_branch }} \ --tag ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:latest # Workaround to provide additional free space for builds. # https://github.com/actions/virtual-environments/issues/2840 @@ -53,9 +54,10 @@ jobs: sudo rm -rf "/usr/local/share/boost" sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: docker push latest - if: env.testing == 'false' && env.guild_deploy_branch == 'master' + if: github.event.inputs.testing == 'false' && github.event.inputs.guild_deploy_branch == 'master' run: | CNVERSION=`cat files/docker/node/release-versions/cardano-node-latest.txt` + echo "PUSH_TO_GA=true" >> $GITHUB_ENV docker push ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:latest docker tag ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:latest ${{ secrets.DOCKER_USER }}/cardano-node:${{ env.CNVERSION }} docker push ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:${{ env.CNVERSION }} @@ -65,4 +67,6 @@ jobs: echo "## Summary Details" >> $GITHUB_STEP_SUMMARY echo "* Docker Image: ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:${{ env.CNVERSION }}" >> $GITHUB_STEP_SUMMARY echo "* G_ACCOUNT: ${GITHUB_REPOSITORY_OWNER}" >> $GITHUB_STEP_SUMMARY + echo "* GUILD_DEPLOY_BRANCH: ${{ github.event.inputs.guild_deploy_branch }}" >> $GITHUB_STEP_SUMMARY + echo "* Push to GA Registry: ${{ env.PUSH_TO_GA }}" >> $GITHUB_STEP_SUMMARY echo "* CNVERSION: ${{ env.CNVERSION }}" >> $GITHUB_STEP_SUMMARY