@@ -131,31 +131,20 @@ jobs:
131131 HEAD_REF : ${{ needs.configure-branch-name.outputs.gh_head_ref }}
132132 strategy :
133133 matrix :
134- include : ${{ fromJson(needs.pi-matrix.outputs.include ) }}
134+ app : ${{ fromJson(needs.pi-matrix.outputs.app ) }}
135135 steps :
136136 - name : Checkout repository
137137 uses : actions/checkout@v4
138138 with :
139139 token : ${{ secrets.GH_TOKEN }}
140- repository : ' ${{ github.repository_owner }}/refinery-${{ matrix.parent_image_type }} -parent-image '
140+ repository : ' ${{ github.repository_owner }}/refinery-submodule -parent-images '
141141 fetch-depth : 0
142- submodules : ' true'
143142
144143 - name : Set up Python
145144 uses : actions/setup-python@v5
146145 with :
147146 python-version : ${{ env.PYTHON_VERSION }}
148147
149- - name : Install Dependencies
150- if : matrix.parent_image_type != 'next'
151- run : python -m pip install pip-tools
152-
153- - name : Compile Requirements
154- run : |
155- cd ${{ github.workspace }}/submodules/parent-images
156- git checkout ${{ env.HEAD_REF }}
157- pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
158-
159148 - name : Clone cicd-deployment-scripts
160149 run : git clone https://oauth2:${{ secrets.GH_TOKEN }}@github.com/code-kern-ai/cicd-deployment-scripts.git
161150
@@ -169,49 +158,44 @@ jobs:
169158
170159 git checkout -b ${{ env.HEAD_REF }} || git checkout ${{ env.HEAD_REF }}
171160 git pull origin ${{ env.HEAD_REF }} || true
172-
173- - name : Compile Requirements (Python)
174- if : matrix.parent_image_type != 'next'
175- run : |
176- cd ${{ github.workspace }}/submodules/parent-images
177- git checkout ${{ env.HEAD_REF }}
178- pip-compile --quiet \
179- --output-file ${{ github.workspace }}/${{ matrix.app }}/requirements/${{ matrix.parent_image_type }}-requirements.txt \
180- requirements/${{ matrix.parent_image_type }}-requirements.in
181161
182- - name : Compile Requirements (Next)
183- if : matrix.parent_image_type == 'next'
162+ - name : Update parent requirements
184163 run : |
185- cd ${{ github.workspace }}
186- jq --slurp '.[0] * .[1]' \
187- package.json \
188- ${{ matrix.app }}/package.json \
189- > package.json.tmp
190- mv package.json.tmp ${{ matrix.app }}/package.json
164+ cd ${{ github.workspace }}/${{ matrix.app }}
165+ REQUIREMENTS_FILES=$(ls requirements/*.txt)
166+ for requirement_file in $REQUIREMENTS_FILES; do
167+ cp ${{ github.workspace }}/refinery-submodule-parent-images/$requirement_file $requirement_file
168+ done
191169
192170 - name : Perform Edit/Git Operations (Python)
193- if : matrix.parent_image_type != 'next'
194171 run : |
195172 cd ${{ github.workspace }}/${{ matrix.app }}
196173
197174 bash ${{ github.workspace }}/cicd-deployment-scripts/pi/edit_dockerfile.sh \
198175 -i "${{ env.PARENT_IMAGE_NAME }}" \
199- -t "${{ matrix.parent_image_type }}" \
200176 -l "${{ env.HEAD_REF }}" \
201177 -r "${{ env.DOCKERHUB_CONTAINER_REGISTRY }}" \
202178 -d "${{ env.DOCKERFILE }}"
203179
204180 bash ${{ github.workspace }}/cicd-deployment-scripts/pi/edit_dockerfile.sh \
205181 -i "${{ env.PARENT_IMAGE_NAME }}" \
206- -t "${{ matrix.parent_image_type }}" \
207182 -l "${{ env.HEAD_REF }}" \
208183 -r "${{ env.DOCKERHUB_CONTAINER_REGISTRY }}" \
209184 -d "dev.${{ env.DOCKERFILE }}"
185+
186+ if [ -f "gpu.${{ env.DOCKERFILE }}" ]; then
187+ bash ${{ github.workspace }}/cicd-deployment-scripts/pi/edit_dockerfile.sh \
188+ -i "${{ env.PARENT_IMAGE_NAME }}" \
189+ -l "${{ env.HEAD_REF }}" \
190+ -r "${{ env.DOCKERHUB_CONTAINER_REGISTRY }}" \
191+ -d "gpu.${{ env.DOCKERFILE }}"
192+ fi
210193
211- git add requirements/${{ matrix.parent_image_type }}-requirements.txt ${{ env.DOCKERFILE }} dev.${{ env.DOCKERFILE }}
212- git commit -m "ci: update ${{ matrix.parent_image_type }}-requirements.txt and Dockerfile" || true
194+ git add requirements/*.txt ${{ env.DOCKERFILE }} dev.${{ env.DOCKERFILE }}
195+ if [ -f "gpu.${{ env.DOCKERFILE }}" ]; then git add gpu.${{ env.DOCKERFILE }}; fi
196+ git commit -m "ci: update requirements and Dockerfile" || true
213197 git push origin ${{ env.HEAD_REF }}
214- echo "::notice::${{ matrix.app }} - updated ${{ matrix.parent_image_type }}-requirements.txt "
198+ echo "::notice::${{ matrix.app }} - updated requirement files and ${{ env.DOCKERFILE }}s "
215199
216200 export exitcode=0
217201 pip-compile --quiet \
@@ -234,35 +218,3 @@ jobs:
234218 --base dev \
235219 --head ${{ env.HEAD_REF }} \
236220 --repo ${{ github.repository_owner }}/${{ matrix.app }} || true
237-
238- - name : Perform Edit/Git Operations (Next)
239- if : matrix.parent_image_type == 'next'
240- run : |
241- cd ${{ github.workspace }}/${{ matrix.app }}
242-
243- bash ${{ github.workspace }}/cicd-deployment-scripts/pi/edit_dockerfile.sh \
244- -i "${{ env.PARENT_IMAGE_NAME }}" \
245- -t "${{ matrix.parent_image_type }}" \
246- -l "${{ env.HEAD_REF }}" \
247- -r "${{ env.DOCKERHUB_CONTAINER_REGISTRY }}" \
248- -d "${{ env.DOCKERFILE }}"
249-
250- bash ${{ github.workspace }}/cicd-deployment-scripts/pi/edit_dockerfile.sh \
251- -i "${{ env.PARENT_IMAGE_NAME }}" \
252- -t "${{ matrix.parent_image_type }}" \
253- -l "${{ env.HEAD_REF }}" \
254- -r "${{ env.DOCKERHUB_CONTAINER_REGISTRY }}" \
255- -d "dev.${{ env.DOCKERFILE }}"
256-
257- git add package.json
258- git commit -m "ci: update ${{ matrix.parent_image_type }} package.json" || true
259- git push origin ${{ env.HEAD_REF }}
260- echo "::notice::${{ matrix.app }} - updated ${{ matrix.parent_image_type }} package.json"
261-
262- gh pr create --draft \
263- --title "test: parent image updates" \
264- --body "${{ github.event.pull_request.body }}" \
265- --base dev \
266- --head ${{ env.HEAD_REF }} \
267- --repo ${{ github.repository_owner }}/${{ matrix.app }} || true
268-
0 commit comments