1- name : Build images from sources.
1+ name : Build and Push images
22run-name : Build images
33on :
44 workflow_call :
55 inputs :
66 src_branch :
77 type : string
8- default : ' release-X.Y '
8+ default : ' '
99 description : ' Source branch to build KFP from'
10- required : true
10+ required : false
1111 target_tag :
1212 type : string
1313 default : ' X.Y.Z'
1414 description : ' Target Image Tag'
1515 required : true
16- fail_fast :
17- type : string
18- default : ' true'
19- description : ' Stop running entire Workflow if a single build fails'
20- required : true
2116 overwrite_imgs :
2217 type : string
2318 default : ' true'
2419 description : ' Overwrite images in GHCR if they already exist for this tag.'
25- required : true
20+ required : false
2621 set_latest :
2722 type : string
2823 default : ' true'
2924 description : ' Set latest tag on build images.'
30- required : true
25+ required : false
3126 add_sha_tag :
3227 type : string
3328 default : ' true'
3429 description : ' Add a sha image tag.'
3530 required : false
31+ app_to_build :
32+ type : string
33+ default : ' '
34+ description : ' Provide the app name to build'
35+ required : true
36+ image_context :
37+ type : string
38+ default : ' '
39+ description : ' Provide the docker file path'
40+ required : true
41+ docker_file :
42+ type : string
43+ default : ' '
44+ description : ' Provide the docker file name'
45+ required : true
46+ push :
47+ type : boolean
48+ default : false
49+ description : ' Whether to push image to CR or not'
50+ required : false
3651 workflow_dispatch :
3752 inputs :
3853 src_branch :
3954 type : string
40- default : ' release-X.Y '
55+ default : ' '
4156 description : ' Source branch to build KFP from'
4257 required : true
4358 target_tag :
6580 default : ' true'
6681 description : ' Add a sha image tag.'
6782 required : false
83+ app_to_build :
84+ type : string
85+ default : ' '
86+ description : ' Provide the app name to build'
87+ required : true
88+ image_context :
89+ type : string
90+ default : ' '
91+ description : ' Provide the docker file path'
92+ required : true
93+ docker_file :
94+ type : string
95+ default : ' '
96+ description : ' Provide the docker file name'
97+ required : true
98+ push :
99+ type : boolean
100+ default : false
101+ description : ' Whether to push image to CR or not'
102+ required : true
68103env :
69104 SOURCE_BRANCH : ${{ inputs.src_branch }}
70105 TARGET_IMAGE_TAG : ${{ inputs.target_tag }}
71106 OVERWRITE_IMAGES : ${{ inputs.overwrite_imgs }}
72107 IMAGE_REGISTRY : ghcr.io
73- IMAGE_ORG : ${{ github.repository_owner }}
108+ IMAGE_ORG : ${{ github.repository }}
74109 SET_LATEST : ${{ inputs.set_latest }}
75110 ADD_SHA_TAG : ${{ inputs.add_sha_tag }}
111+ CACHE_PATH : ' /tmp/.buildx-cache'
112+
76113jobs :
77- build-images-with-tag :
114+ build-and-push-images :
115+ if : inputs.push && inputs.src_branch
78116 continue-on-error : false
79117 runs-on : ubuntu-latest
80118 permissions :
81119 contents : read
82120 packages : write
83121 attestations : write
84122 id-token : write
85- strategy :
86- fail-fast : ${{ inputs.fail_fast == 'true' }}
87- matrix :
88- include :
89- - image : kfp-api-server
90- dockerfile : backend/Dockerfile
91- context : .
92- - image : kfp-frontend
93- dockerfile : frontend/Dockerfile
94- context : .
95- - image : kfp-persistence-agent
96- dockerfile : backend/Dockerfile.persistenceagent
97- context : .
98- - image : kfp-scheduled-workflow-controller
99- dockerfile : backend/Dockerfile.scheduledworkflow
100- context : .
101- - image : kfp-viewer-crd-controller
102- dockerfile : backend/Dockerfile.viewercontroller
103- context : .
104- - image : kfp-visualization-server
105- dockerfile : backend/Dockerfile.visualization
106- context : .
107- - image : kfp-launcher
108- dockerfile : backend/Dockerfile.launcher
109- context : .
110- - image : kfp-driver
111- dockerfile : backend/Dockerfile.driver
112- context : .
113- - image : kfp-cache-deployer
114- dockerfile : backend/src/cache/deployer/Dockerfile
115- context : .
116- - image : kfp-cache-server
117- dockerfile : backend/Dockerfile.cacheserver
118- context : .
119- - image : kfp-metadata-writer
120- dockerfile : backend/metadata_writer/Dockerfile
121- context : .
122- - image : kfp-metadata-envoy
123- dockerfile : third_party/metadata_envoy/Dockerfile
124- context : .
125- - image : kfp-inverse-proxy-agent
126- dockerfile : proxy/Dockerfile
127- context : ./proxy
128123 steps :
129124 - name : Checkout repository
130125 uses : actions/checkout@v4
131126 with :
132127 ref : ${{env.SOURCE_BRANCH}}
128+
133129 - name : Log in to the Container registry
134130 uses : docker/login-action@v3
135131 with :
@@ -140,7 +136,7 @@ jobs:
140136 - name : Check if image tag already exists
141137 id : check_tag
142138 env :
143- IMAGE : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/${{ matrix.image }}:${{env.TARGET_IMAGE_TAG}}
139+ IMAGE : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/${{ inputs.app_to_build }}:${{env.TARGET_IMAGE_TAG}}
144140 OVERWRITE : ${{ env.OVERWRITE_IMAGES }}
145141 run : |
146142 if docker manifest inspect ${IMAGE} > /dev/null 2>&1; then
@@ -164,7 +160,7 @@ jobs:
164160 uses : docker/metadata-action@v5
165161 if : steps.check_tag.outcome == 'success'
166162 with :
167- images : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/${{ matrix.image }}
163+ images : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/${{ inputs.app_to_build }}
168164 tags : |
169165 type=raw,value=${{env.TARGET_IMAGE_TAG}}
170166 type=raw,value=latest,enable=${{ env.SET_LATEST == 'true'}}
@@ -178,8 +174,8 @@ jobs:
178174 uses : docker/build-push-action@v6
179175 if : steps.check_tag.outcome == 'success'
180176 with :
181- context : ${{ matrix.context }}
182- file : ${{ matrix.dockerfile }}
177+ context : ${{ inputs.image_context }}
178+ file : ${{ inputs.docker_file }}
183179 push : true
184180 tags : ${{ steps.meta.outputs.tags }}
185181 labels : ${{ steps.meta.outputs.labels }}
@@ -193,6 +189,5 @@ jobs:
193189 uses : actions/attest-build-provenance@v1
194190 if : steps.check_tag.outcome == 'success'
195191 with :
196- subject-name : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/${{ matrix.image }}
197- subject-digest : ${{ steps.push.outputs.digest }}
198-
192+ subject-name : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/${{ inputs.app_to_build }}
193+ subject-digest : ${{ steps.push.outputs.digest }}
0 commit comments