Skip to content

Commit

Permalink
Fix the docker workflow (#505)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
cmickeyb authored Oct 30, 2024
1 parent 832f89f commit 5e487ce
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 5e487ce

Please sign in to comment.