1313 GH_TOKEN : ${{ secrets.GH_TOKEN }}
1414
1515jobs :
16+ configure-branch-name :
17+ name : ' Configure Head Branch Name'
18+ runs-on : ubuntu-latest
19+ outputs :
20+ gh_head_ref : ${{ steps.configure-branch-name.outputs.gh_head_ref }}
21+ steps :
22+ - name : Configure branch name
23+ id : configure-branch-name
24+ run : echo "gh_head_ref=$(echo "${{ github.event.pull_request.head.ref }}" | sed 's|/|-|g')" >> $GITHUB_OUTPUT
25+
1626 pi-matrix :
1727 uses : code-kern-ai/cicd-deployment-scripts/.github/workflows/pi_matrix.yml@dev
1828 secrets : inherit
29+ needs : [configure-branch-name]
1930 with :
20- checkout_ref : ${{ github.event.pull_request.head.ref }}
31+ checkout_ref : ${{ needs.configure-branch-name.outputs.gh_head_ref }}
2132 repository : " ${{ github.repository_owner }}/refinery-submodule-parent-images"
2233
2334 pi-build :
2435 name : ' Parent Images: Docker Build'
2536 runs-on : ubuntu-latest
26- needs : [pi-matrix]
37+ needs : [pi-matrix, configure-branch-name ]
2738 environment : dev
2839 env :
2940 PYTHON_VERSION : ${{ vars.PYTHON_VERSION }}
3041 DEV_CONTAINER_REGISTRY : ${{ vars.DEV_CONTAINER_REGISTRY }}
3142 DEV_LOGIN_USERNAME : ${{ secrets.DEV_LOGIN_USERNAME }}
3243 DEV_LOGIN_PASSWORD : ${{ secrets.DEV_LOGIN_PASSWORD }}
33- IMAGE_TAG : ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.pull_request.head.ref }}
44+ IMAGE_TAG : ${{ github.event_name == 'release' && github.event.release.tag_name || needs.configure-branch-name.outputs.gh_head_ref }}
3445 strategy :
3546 matrix :
3647 parent_image_type : ${{ fromJson(needs.pi-matrix.outputs.parent_image_type) }}
5465 - name : Compile Requirements
5566 run : |
5667 cd ${{ github.workspace }}/submodules/parent-images
57- git checkout ${{ github.event.pull_request.head.ref }}
68+ git checkout ${{ needs.configure-branch-name.outputs.gh_head_ref }}
5869 pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
5970
6071 - name : Set up Docker Buildx
@@ -74,29 +85,29 @@ jobs:
7485 username : " ${{ env.DEV_LOGIN_USERNAME }}"
7586 password : " ${{ env.DEV_LOGIN_PASSWORD }}"
7687
77- - name : Build & Push refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}
88+ - name : Build & Push refinery-parent-images:${{ needs.configure-branch-name.outputs.gh_head_ref }}-${{ matrix.parent_image_type }}
7889 uses : docker/build-push-action@v5
7990 with :
8091 context : .
81- cache-from : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-cache
82- cache-to : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-cache,mode=max,image-manifest=true
92+ cache-from : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ needs.configure-branch-name.outputs.gh_head_ref }}-${{ matrix.parent_image_type }}-cache
93+ cache-to : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ needs.configure-branch-name.outputs.gh_head_ref }}-${{ matrix.parent_image_type }}-cache,mode=max,image-manifest=true
8394 platforms : linux/amd64
8495 file : Dockerfile
85- tags : ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}
96+ tags : ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ needs.configure-branch-name.outputs.gh_head_ref }}-${{ matrix.parent_image_type }}
8697 push : true
8798 build-args : |
8899 platform=linux/amd64
89100 label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
90101
91- - name : Build & Push refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64
102+ - name : Build & Push refinery-parent-images:${{ needs.configure-branch-name.outputs.gh_head_ref }}-${{ matrix.parent_image_type }}-arm64
92103 uses : docker/build-push-action@v5
93104 with :
94105 context : .
95- cache-from : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64-cache
96- cache-to : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64-cache,mode=max,image-manifest=true
106+ cache-from : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ needs.configure-branch-name.outputs.gh_head_ref }}-${{ matrix.parent_image_type }}-arm64-cache
107+ cache-to : type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ needs.configure-branch-name.outputs.gh_head_ref }}-${{ matrix.parent_image_type }}-arm64-cache,mode=max,image-manifest=true
97108 platforms : linux/arm64
98109 file : Dockerfile
99- tags : ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64
110+ tags : ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ needs.configure-branch-name.outputs.gh_head_ref }}-${{ matrix.parent_image_type }}-arm64
100111 push : true
101112 build-args : |
102113 platform=linux/arm64
0 commit comments