Skip to content

Commit 89aa9ce

Browse files
committed
perf: update streamline process
1 parent ec15a5b commit 89aa9ce

File tree

5 files changed

+151
-144
lines changed

5 files changed

+151
-144
lines changed

.github/workflows/pi_build.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,29 @@ env:
1313
GH_TOKEN: ${{ secrets.GH_TOKEN }}
1414

1515
jobs:
16-
configure-branch-name:
17-
name: 'Configure Head Branch Name'
16+
validate-branch-name:
17+
name: 'Validate Head Branch Name'
1818
runs-on: ubuntu-latest
19-
outputs:
20-
gh_head_ref: ${{ steps.configure-branch-name.outputs.gh_head_ref }}
2119
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
20+
- name: Validate branch name
21+
run: |
22+
if [ "${{ github.event.pull_request.head.ref }}" != "parent-image-updates" ]; then
23+
echo "::error::Branch name must be 'parent-image-updates'. Current branch name: ${{ github.event.pull_request.head.ref }}"
24+
exit 1
25+
fi
2526
2627
pi-matrix:
2728
uses: code-kern-ai/cicd-deployment-scripts/.github/workflows/pi_matrix.yml@dev
2829
secrets: inherit
29-
needs: [configure-branch-name]
30+
needs: [validate-branch-name]
3031
with:
31-
checkout_ref: ${{ needs.configure-branch-name.outputs.gh_head_ref }}
32+
checkout_ref: parent-image-updates
3233
repository: "${{ github.repository_owner }}/refinery-submodule-parent-images"
3334

3435
pi-build:
3536
name: 'Parent Images: Docker Build'
3637
runs-on: ubuntu-latest
37-
needs: [pi-matrix, configure-branch-name]
38+
needs: [pi-matrix, validate-branch-name]
3839
environment: dev
3940
env:
4041
PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
@@ -43,8 +44,8 @@ jobs:
4344
DEV_LOGIN_PASSWORD: ${{ secrets.DEV_LOGIN_PASSWORD }}
4445
PARENT_IMAGE_NAME: ${{ vars.PARENT_IMAGE_NAME }}
4546
DOCKERFILE: ${{ vars.DOCKERFILE }}
46-
HEAD_REF: ${{ needs.configure-branch-name.outputs.gh_head_ref }}
47-
IMAGE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || needs.configure-branch-name.outputs.gh_head_ref }}
47+
HEAD_REF: parent-image-updates
48+
IMAGE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || 'parent-image-updates' }}
4849
strategy:
4950
matrix:
5051
parent_image_type: ${{ fromJson(needs.pi-matrix.outputs.parent_image_type) }}
@@ -120,15 +121,15 @@ jobs:
120121
pi-update-app:
121122
name: 'Parent Images: App'
122123
runs-on: ubuntu-latest
123-
needs: [pi-matrix, pi-build, configure-branch-name]
124+
needs: [pi-matrix, pi-build, validate-branch-name]
124125
environment: dev
125126
continue-on-error: true
126127
env:
127128
PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
128129
DOCKERHUB_CONTAINER_REGISTRY: ${{ vars.DOCKERHUB_CONTAINER_REGISTRY }}
129130
PARENT_IMAGE_NAME: ${{ vars.PARENT_IMAGE_NAME }}
130131
DOCKERFILE: ${{ vars.DOCKERFILE }}
131-
HEAD_REF: ${{ needs.configure-branch-name.outputs.gh_head_ref }}
132+
HEAD_REF: parent-image-updates
132133
strategy:
133134
matrix:
134135
app: ${{ fromJson(needs.pi-matrix.outputs.app) }}

.github/workflows/pi_merge_parent_image.yml

Lines changed: 107 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ env:
1313
GH_TOKEN: ${{ secrets.GH_TOKEN }}
1414

1515
jobs:
16-
pi-matrix:
17-
uses: code-kern-ai/cicd-deployment-scripts/.github/workflows/pi_matrix.yml@dev
18-
secrets: inherit
19-
with:
20-
checkout_ref: ${{ github.event.pull_request.base.ref }}
21-
repository: "${{ github.repository_owner }}/refinery-submodule-parent-images"
22-
parent_image_type: ${{ vars.PARENT_IMAGE_TYPE }}
16+
# pi-matrix:
17+
# uses: code-kern-ai/cicd-deployment-scripts/.github/workflows/pi_matrix.yml@dev
18+
# secrets: inherit
19+
# with:
20+
# checkout_ref: ${{ github.event.pull_request.base.ref }}
21+
# repository: "${{ github.repository_owner }}/refinery-submodule-parent-images"
22+
# parent_image_type: ${{ vars.PARENT_IMAGE_TYPE }}
2323

2424
pi-build:
2525
name: 'Parent Images: Docker Build'
@@ -47,10 +47,10 @@ jobs:
4747
- name: Install Dependencies
4848
run: python -m pip install pip-tools
4949

50-
- name: Compile Requirements
51-
run: |
52-
cd ${{ github.workspace }}/submodules/parent-images
53-
pip-compile requirements/${{ env.PARENT_IMAGE_TYPE }}-requirements.in
50+
# - name: Compile Requirements
51+
# run: |
52+
# cd ${{ github.workspace }}/submodules/parent-images
53+
# pip-compile requirements/${{ env.PARENT_IMAGE_TYPE }}-requirements.in
5454

5555
- name: Set up Docker Buildx
5656
uses: docker/setup-buildx-action@v3
@@ -127,108 +127,108 @@ jobs:
127127
# platform=linux/arm64
128128
# label=dockerfile-path=https://github.com/refinery-${{ env.PARENT_IMAGE_TYPE }}-parent-image/blob/${{ github.sha }}/Dockerfile
129129

130-
pi-update-app:
131-
name: 'Parent Images: App'
132-
runs-on: ubuntu-latest
133-
needs: [pi-matrix, pi-build]
134-
environment: dev
135-
continue-on-error: true
136-
env:
137-
PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
138-
HEAD_REF: parent-image-updates
139-
strategy:
140-
matrix:
141-
include: ${{ fromJson(needs.pi-matrix.outputs.include) }}
142-
steps:
143-
- name: Checkout Repository
144-
uses: actions/checkout@v4
145-
with:
146-
submodules: 'true'
130+
# pi-update-app:
131+
# name: 'Parent Images: App'
132+
# runs-on: ubuntu-latest
133+
# needs: [pi-matrix, pi-build]
134+
# environment: dev
135+
# continue-on-error: true
136+
# env:
137+
# PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
138+
# HEAD_REF: parent-image-updates
139+
# strategy:
140+
# matrix:
141+
# include: ${{ fromJson(needs.pi-matrix.outputs.include) }}
142+
# steps:
143+
# - name: Checkout Repository
144+
# uses: actions/checkout@v4
145+
# with:
146+
# submodules: 'true'
147147

148-
- name: Set up Python
149-
if: matrix.parent_image_type != 'next'
150-
uses: actions/setup-python@v5
151-
with:
152-
python-version: ${{ env.PYTHON_VERSION }}
148+
# - name: Set up Python
149+
# if: matrix.parent_image_type != 'next'
150+
# uses: actions/setup-python@v5
151+
# with:
152+
# python-version: ${{ env.PYTHON_VERSION }}
153153

154-
- name: Install Dependencies
155-
if: matrix.parent_image_type != 'next'
156-
run: python -m pip install pip-tools
154+
# - name: Install Dependencies
155+
# if: matrix.parent_image_type != 'next'
156+
# run: python -m pip install pip-tools
157157

158-
- name: Clone ${{ matrix.app }}
159-
run: |
160-
git clone --recurse-submodules https://oauth2:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository_owner }}/${{ matrix.app }}.git
161-
cd ${{ github.workspace }}/${{ matrix.app }}
162-
163-
git config user.email "devtools@kern.ai"
164-
git config user.name "GitHub Actions"
165-
166-
git checkout -b ${{ env.HEAD_REF }} || git checkout ${{ env.HEAD_REF }}
167-
168-
- name: Compile Requirements (Python)
169-
if: matrix.parent_image_type != 'next'
170-
run: |
171-
pip-compile --quiet \
172-
--output-file ${{ matrix.app }}/requirements/${{ matrix.parent_image_type }}-requirements.txt \
173-
submodules/parent-images/requirements/${{ matrix.parent_image_type }}-requirements.in
158+
# - name: Clone ${{ matrix.app }}
159+
# run: |
160+
# git clone --recurse-submodules https://oauth2:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository_owner }}/${{ matrix.app }}.git
161+
# cd ${{ github.workspace }}/${{ matrix.app }}
162+
163+
# git config user.email "devtools@kern.ai"
164+
# git config user.name "GitHub Actions"
165+
166+
# git checkout -b ${{ env.HEAD_REF }} || git checkout ${{ env.HEAD_REF }}
167+
168+
# - name: Compile Requirements (Python)
169+
# if: matrix.parent_image_type != 'next'
170+
# run: |
171+
# pip-compile --quiet \
172+
# --output-file ${{ matrix.app }}/requirements/${{ matrix.parent_image_type }}-requirements.txt \
173+
# submodules/parent-images/requirements/${{ matrix.parent_image_type }}-requirements.in
174174

175-
- name: Compile Requirements (Next)
176-
if: matrix.parent_image_type == 'next'
177-
run: |
178-
jq --slurp '.[0] * .[1]' \
179-
package.json \
180-
${{ matrix.app }}/package.json \
181-
> package.json.tmp
182-
mv package.json.tmp ${{ matrix.app }}/package.json
183-
184-
- name: Perform Edit/Git Operations (Python)
185-
if: matrix.parent_image_type != 'next'
186-
run: |
187-
cd ${{ github.workspace }}/${{ matrix.app }}
188-
189-
git add requirements/${{ matrix.parent_image_type }}-requirements.txt
190-
git commit -m "ci: update ${{ matrix.parent_image_type }}-requirements.txt" || true
191-
git push origin ${{ env.HEAD_REF }}
192-
echo "::notice::${{ matrix.app }} - updated ${{ matrix.parent_image_type }}-requirements.txt"
193-
194-
export exitcode=0
195-
pip-compile --quiet \
196-
--output-file requirements.txt \
197-
requirements/requirements.in || export exitcode=$?
175+
# - name: Compile Requirements (Next)
176+
# if: matrix.parent_image_type == 'next'
177+
# run: |
178+
# jq --slurp '.[0] * .[1]' \
179+
# package.json \
180+
# ${{ matrix.app }}/package.json \
181+
# > package.json.tmp
182+
# mv package.json.tmp ${{ matrix.app }}/package.json
183+
184+
# - name: Perform Edit/Git Operations (Python)
185+
# if: matrix.parent_image_type != 'next'
186+
# run: |
187+
# cd ${{ github.workspace }}/${{ matrix.app }}
188+
189+
# git add requirements/${{ matrix.parent_image_type }}-requirements.txt
190+
# git commit -m "ci: update ${{ matrix.parent_image_type }}-requirements.txt" || true
191+
# git push origin ${{ env.HEAD_REF }}
192+
# echo "::notice::${{ matrix.app }} - updated ${{ matrix.parent_image_type }}-requirements.txt"
193+
194+
# export exitcode=0
195+
# pip-compile --quiet \
196+
# --output-file requirements.txt \
197+
# requirements/requirements.in || export exitcode=$?
198198

199-
if [ $exitcode -ne 0 ]; then
200-
echo "::error::pip-compile failed with exit code $exitcode"
201-
exit $exitcode
202-
else
203-
git add requirements.txt
204-
git commit -m "ci: update requirements.txt" || true
205-
git push origin ${{ env.HEAD_REF }}
206-
echo "::notice::${{ matrix.app }} - updated requirements.txt"
207-
fi
208-
209-
gh pr create --draft \
210-
--title "${{ github.event.pull_request.title }}" \
211-
--body "${{ github.event.pull_request.body }}" \
212-
--base dev \
213-
--head ${{ env.HEAD_REF }} \
214-
--repo ${{ github.repository_owner }}/${{ matrix.app }} || true
199+
# if [ $exitcode -ne 0 ]; then
200+
# echo "::error::pip-compile failed with exit code $exitcode"
201+
# exit $exitcode
202+
# else
203+
# git add requirements.txt
204+
# git commit -m "ci: update requirements.txt" || true
205+
# git push origin ${{ env.HEAD_REF }}
206+
# echo "::notice::${{ matrix.app }} - updated requirements.txt"
207+
# fi
208+
209+
# gh pr create --draft \
210+
# --title "${{ github.event.pull_request.title }}" \
211+
# --body "${{ github.event.pull_request.body }}" \
212+
# --base dev \
213+
# --head ${{ env.HEAD_REF }} \
214+
# --repo ${{ github.repository_owner }}/${{ matrix.app }} || true
215215

216-
- name: Perform Edit/Git Operations (Next)
217-
if: matrix.parent_image_type == 'next'
218-
run: |
219-
cd ${{ github.workspace }}/${{ matrix.app }}
220-
221-
git add package.json
222-
git commit -m "ci: update ${{ matrix.parent_image_type }} package.json" || true
223-
git push origin ${{ env.HEAD_REF }}
224-
echo "::notice::${{ matrix.app }} - updated ${{ matrix.parent_image_type }} package.json"
225-
226-
gh pr create --draft \
227-
--title "${{ github.event.pull_request.title }}" \
228-
--body "${{ github.event.pull_request.body }}" \
229-
--base dev \
230-
--head ${{ env.HEAD_REF }} \
231-
--repo ${{ github.repository_owner }}/${{ matrix.app }} || true
216+
# - name: Perform Edit/Git Operations (Next)
217+
# if: matrix.parent_image_type == 'next'
218+
# run: |
219+
# cd ${{ github.workspace }}/${{ matrix.app }}
220+
221+
# git add package.json
222+
# git commit -m "ci: update ${{ matrix.parent_image_type }} package.json" || true
223+
# git push origin ${{ env.HEAD_REF }}
224+
# echo "::notice::${{ matrix.app }} - updated ${{ matrix.parent_image_type }} package.json"
225+
226+
# gh pr create --draft \
227+
# --title "${{ github.event.pull_request.title }}" \
228+
# --body "${{ github.event.pull_request.body }}" \
229+
# --base dev \
230+
# --head ${{ env.HEAD_REF }} \
231+
# --repo ${{ github.repository_owner }}/${{ matrix.app }} || true
232232

233233
gh-delete-branch:
234234
name: 'GitHub: Delete Branch'

.github/workflows/pi_merge_submodule.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,21 @@ jobs:
9999
shell: bash
100100
run: git push origin --delete ${{ github.event.pull_request.head.ref }}
101101

102-
gh-delete-app-branches:
103-
name: 'GitHub: Delete App Branch'
104-
needs: [configure-branch-name, pi-matrix, gh-delete-submodule-branches]
105-
if: ${{ !failure() }}
106-
runs-on: ubuntu-latest
107-
strategy:
108-
matrix:
109-
include: ${{ fromJson(needs.pi-matrix.outputs.include) }}
110-
steps:
111-
- name: Checkout repository
112-
uses: actions/checkout@v4
113-
with:
114-
token: ${{ secrets.GH_TOKEN }}
115-
repository: ${{ github.repository_owner }}/${{ matrix.app }}
102+
# gh-delete-app-branches:
103+
# name: 'GitHub: Delete App Branch'
104+
# needs: [configure-branch-name, pi-matrix, gh-delete-submodule-branches]
105+
# if: ${{ !failure() }}
106+
# runs-on: ubuntu-latest
107+
# strategy:
108+
# matrix:
109+
# include: ${{ fromJson(needs.pi-matrix.outputs.include) }}
110+
# steps:
111+
# - name: Checkout repository
112+
# uses: actions/checkout@v4
113+
# with:
114+
# token: ${{ secrets.GH_TOKEN }}
115+
# repository: ${{ github.repository_owner }}/${{ matrix.app }}
116116

117-
- name: Delete Branch
118-
shell: bash
119-
run: git push origin --delete ${{ needs.configure-branch-name.outputs.gh_head_ref }} || true
117+
# - name: Delete Branch
118+
# shell: bash
119+
# run: git push origin --delete ${{ needs.configure-branch-name.outputs.gh_head_ref }} || true

.github/workflows/pi_release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
HEAD_REF: parent-image-updates
3838
strategy:
3939
matrix:
40-
include: ${{ fromJson(needs.pi-matrix.outputs.include) }}
40+
app: ${{ fromJson(needs.pi-matrix.outputs.app) }}
4141
steps:
4242
- name: Checkout repository
4343
uses: actions/checkout@v4
@@ -51,7 +51,7 @@ jobs:
5151

5252
- name: Perform Edit/Git Operations
5353
run: |
54-
RELEASE_IMAGE="${{ env.DOCKERHUB_CONTAINER_REGISTRY }}/${{ env.PARENT_IMAGE_NAME }}:${{ github.event.release.tag_name }}-${{ matrix.parent_image_type }}"
54+
RELEASE_IMAGE="${{ env.DOCKERHUB_CONTAINER_REGISTRY }}/${{ env.PARENT_IMAGE_NAME }}:${{ github.event.release.tag_name }}-${{ vars.PARENT_IMAGE_TYPE }}"
5555
BASE_REF="dev"
5656
PR_TITLE="ci(pi): $RELEASE_IMAGE"
5757
@@ -60,10 +60,10 @@ jobs:
6060
6161
bash cicd-deployment-scripts/pi/edit_dockerfile.sh \
6262
-i "${{ env.PARENT_IMAGE_NAME }}" \
63-
-t "${{ matrix.parent_image_type }}" \
6463
-l "${{ github.event.release.tag_name }}" \
6564
-r "${{ env.DOCKERHUB_CONTAINER_REGISTRY }}" \
66-
-d "${{ env.DOCKERFILE }}"
65+
-d "${{ env.DOCKERFILE }}" \
66+
-h "${{ env.HEAD_REF }}"
6767
6868
git config user.email "devtools@kern.ai"
6969
git config user.name "GitHub Actions"

0 commit comments

Comments
 (0)