From 5e487ceaf3912da19fca728138e3188e7ec995ba Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Wed, 30 Oct 2024 15:11:54 -0700 Subject: [PATCH] Fix the docker workflow (#505) Two issues... first, moved the docker workflow to be triggered exclusively through interactive request. The policy for automated triggering can be determined at a later time. Second, fixed a couple bugs in the docker workflow. Now that the workflow is a part of the main branch, debugging is far easier. Note that this is been tested on a personal repository but not on an organizational repository such as hyperledger. Signed-off-by: Mic Bowman --- .github/workflows/docker.yml | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e3eaf1b7..81dd80c7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,22 +2,32 @@ # SPDX-License-Identifier: Apache-2.0 # +# This workflow will generate docker images for the +# current branch and push those images into the +# repository owners resources. + name: Build and Push PDO Docker Images on: workflow_dispatch: - pull_request: - types: [closed] - branches: [main] + # This section is commented out for the moment until a + # reasonable policy is determined for automated generation. + # The conditional execution must be evaluated as well. These + # are left here to serve as potential documentation for how + # the policy may be implemented. + + # pull_request: + # types: [closed] + # branches: [main] jobs: docker_build: - if: > - github.event.name == 'workflow_dispatch' || - github.event.name == 'pull_request' && github.event.pull_request.merged == true + # if: > + # github.event.name == 'workflow_dispatch' || + # github.event.name == 'pull_request' && github.event.pull_request.merged == true name: Build PDO Images runs-on: ubuntu-22.04 @@ -54,10 +64,13 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Tag and push the images + env: + OWNER: ${{ github.repository_owner }} run: | + echo "Push images to ghcr.io/$OWNER" for image in pdo_services pdo_ccf pdo_client do - docker image tag ghcr.io/{{ github.repository_owner }}/$image:$PDO_VERSION - docker image tag ghcr.io/{{ github.repository_owner }}/$image:latest - docker image push --all-tags ghcr.io/{{ github.repository_owner }}/$image + docker image tag $image:$PDO_VERSION ghcr.io/$OWNER/$image:$PDO_VERSION + docker image tag $image:$PDO_VERSION ghcr.io/$OWNER/$image:latest + docker image push --all-tags ghcr.io/$OWNER/$image done