Skip to content

Commit b87862d

Browse files
committed
(CDPE-6528) Input image tag name to Build-Test-Push
Add optional input to the Build-Test-Push job for supplying an image tag to create in addition to the latest and timestamp-sha tags. This enables workflows to call this and reliable know the name of the resulting image, and is a result of that fact that GitHub does not have a native way to run a workflow on a remote repository and get some sort of string-like output from it. Since there's no way to get data back from the called workflow, instead let the calling workflow decide what name to use for the image tag. Overall this enables this workflow to be called in automation by the CD4PE release workflows so the developer doing the CD4PE release doesn't have to manually trigger this first, find the image tag it created, then supply that image tag to a different workflow.
1 parent 676bc57 commit b87862d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/build-test-push.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
name: Build-Test-Push
2+
23
on:
34
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: Optional tag to create in addition to the `latest` and `<timestamp>-<sha>` image tags.
8+
required: false
49
push:
510
branches:
611
- main
12+
713
jobs:
814
Build-Test-Push:
915
runs-on: ubuntu-latest
@@ -29,6 +35,11 @@ jobs:
2935
run: |
3036
docker tag puppet-dev-tools:latest-rootless ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD)-rootless
3137
docker tag puppet-dev-tools:latest ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD)
38+
- name: Additional Tag
39+
if: inputs.tag
40+
run: |
41+
docker tag puppet-dev-tools:latest-rootless ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:${{ inputs.tag }}-rootless
42+
docker tag puppet-dev-tools:latest ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:${{ inputs.tag }}
3243
- name: List Docker images
3344
run: docker images --filter "reference=puppet-dev-tools*" --filter "reference=*/puppet-dev-tools*"
3445
- name: Show Docker image labels
@@ -40,3 +51,8 @@ jobs:
4051
run: |
4152
docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD)-rootless
4253
docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD)
54+
- name: Push Additional Tag
55+
if: inputs.tag
56+
run: |
57+
docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:${{ inputs.tag }}-rootless
58+
docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:${{ inputs.tag }}

0 commit comments

Comments
 (0)