Skip to content

Commit 8307ba7

Browse files
committed
feat: add merge, release workflows
1 parent 51a26ee commit 8307ba7

File tree

6 files changed

+383
-261
lines changed

6 files changed

+383
-261
lines changed

.github/workflows/pi_build.yml

Lines changed: 87 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -14,200 +14,115 @@ env:
1414

1515
jobs:
1616
pi-matrix:
17-
name: 'Parent Images: Generate Matrix'
18-
runs-on: ubuntu-latest
19-
environment: dev
20-
env:
21-
PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
22-
outputs:
23-
include: ${{ steps.gen-matrix.outputs.include }}
24-
steps:
25-
- name: Checkout Repository
26-
uses: actions/checkout@v4
27-
with:
28-
repository: ${{ github.repository_owner }}/refinery-submodule-parent-images
29-
ref: ${{ github.event.pull_request.head.ref }}
30-
31-
- name: GitHub Configuration
32-
run: git config --global url."https://oauth2:${{ secrets.GH_TOKEN }}@github.com".insteadOf https://github.com
17+
uses: code-kern-ai/cicd-deployment-scripts/.github/workflows/pi_matrix.yml@parent-images
18+
secrets: inherit
3319

34-
- name: Clone cicd-deployment-scripts
35-
run: git clone --branch parent-images https://github.com/code-kern-ai/cicd-deployment-scripts.git
36-
37-
- name: Generate Matrix
38-
id: gen-matrix
39-
run: |
40-
bash cicd-deployment-scripts/pi/generate_matrix.sh \
41-
-p "${{ github.event.pull_request.number }}" \
42-
-s cicd-deployment-scripts/pi/settings.sh
43-
44-
pi-update-app:
45-
name: 'Parent Images: Update'
20+
pi-build:
21+
name: 'Parent Images: Docker Build'
4622
runs-on: ubuntu-latest
4723
needs: [pi-matrix]
4824
environment: dev
49-
continue-on-error: true
5025
env:
5126
PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
27+
DEV_CONTAINER_REGISTRY: ${{ vars.DEV_CONTAINER_REGISTRY }}
28+
DEV_LOGIN_USERNAME: ${{ secrets.DEV_LOGIN_USERNAME }}
29+
DEV_LOGIN_PASSWORD: ${{ secrets.DEV_LOGIN_PASSWORD }}
30+
IMAGE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.pull_request.head.ref }}
5231
strategy:
53-
matrix:
54-
include: ${{ fromJson(needs.pi-matrix.outputs.include) }}
32+
matrix:
33+
parent_image_type: ${{ fromJson(needs.pi-matrix.outputs.parent_image_type) }}
5534
steps:
56-
- name: Checkout Repository
35+
- name: Checkout repository
5736
uses: actions/checkout@v4
5837
with:
38+
token: ${{ secrets.GH_TOKEN }}
5939
repository: '${{ github.repository_owner }}/refinery-${{ matrix.parent_image_type }}-parent-image'
40+
fetch-depth: 0
6041
submodules: 'true'
61-
42+
6243
- name: Set up Python
6344
uses: actions/setup-python@v5
6445
with:
6546
python-version: ${{ env.PYTHON_VERSION }}
66-
47+
6748
- name: Install Dependencies
6849
run: python -m pip install pip-tools
6950

70-
- name: Clone ${{ matrix.app }}
71-
run: git clone https://oauth2:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository_owner }}/${{ matrix.app }}.git
72-
7351
- name: Compile Requirements
7452
run: |
75-
pip-compile --quiet \
76-
--output-file ${{ matrix.app }}/requirements/${{ matrix.parent_image_type }}-requirements.txt \
77-
submodules/parent-images/requirements/${{ matrix.parent_image_type }}-requirements.in
78-
79-
pip-compile --quiet \
80-
--output-file ${{ matrix.app }}/requirements.txt \
81-
${{ matrix.app }}/requirements/requirements.in
82-
83-
- name: Perform Edit/Git Operations
84-
run: |
85-
cd ${{ matrix.app }}
86-
87-
git config user.email "devtools@kern.ai"
88-
git config user.name "GitHub Actions"
53+
cd ${{ github.workspace }}/submodules/parent-images
54+
git checkout ${{ github.event.pull_request.head.ref }}
55+
pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
8956
90-
git checkout -b ${{ github.event.pull_request.head.ref }} || git checkout ${{ github.event.pull_request.head.ref }}
91-
git push origin ${{ github.event.pull_request.head.ref }} && git pull origin ${{ github.event.pull_request.head.ref }}
92-
93-
git add requirements*
94-
git commit -m "ci: update ${{ matrix.parent_image_type }}-requirements.txt"
95-
git push origin ${{ github.event.pull_request.head.ref }}
96-
echo "::notice::${{ matrix.app }} updated to origin/${{ github.event.pull_request.head.ref }}"
97-
98-
gh pr create \
99-
--title "${{ github.event.pull_request.title }}" \
100-
--body "${{ github.event.pull_request.body }}" \
101-
--base dev \
102-
--head ${{ github.event.pull_request.head.ref }} \
103-
--repo ${{ github.repository_owner }}/${{ matrix.app }}
104-
105-
# pi-build:
106-
# name: 'Parent Images: Docker Build'
107-
# runs-on: ubuntu-latest
108-
# needs: [pi-matrix]
109-
# environment: dev
110-
# env:
111-
# PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
112-
# DEV_CONTAINER_REGISTRY: ${{ vars.DEV_CONTAINER_REGISTRY }}
113-
# DEV_LOGIN_USERNAME: ${{ secrets.DEV_LOGIN_USERNAME }}
114-
# DEV_LOGIN_PASSWORD: ${{ secrets.DEV_LOGIN_PASSWORD }}
115-
# IMAGE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.pull_request.head.ref }}
116-
# strategy:
117-
# matrix:
118-
# parent_image_type: ${{ fromJson(needs.pi-matrix.outputs.updated_parent_types) }}
119-
# steps:
120-
# - name: Checkout repository
121-
# uses: actions/checkout@v4
122-
# with:
123-
# token: ${{ secrets.GH_TOKEN }}
124-
# repository: '${{ github.repository_owner }}/refinery-${{ matrix.parent_image_type }}-parent-image'
125-
# fetch-depth: 0
126-
# submodules: 'true'
127-
128-
# - name: Set up Python
129-
# uses: actions/setup-python@v5
130-
# with:
131-
# python-version: ${{ env.PYTHON_VERSION }}
132-
133-
# - name: Install Dependencies
134-
# run: python -m pip install pip-tools
135-
136-
# - name: Compile Requirements
137-
# run: |
138-
# cd ${{ github.workspace }}/submodules/parent-images
139-
# git checkout ${{ github.event.pull_request.head.ref }}
140-
# pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
141-
142-
# - name: Set up Docker Buildx
143-
# uses: docker/setup-buildx-action@v3
144-
# with:
145-
# platforms: linux/amd64,linux/arm64
146-
147-
# - name: Set up QEMU
148-
# uses: docker/setup-qemu-action@v3
149-
# with:
150-
# platforms: arm64,arm
151-
152-
# - name: Log into DEV registry
153-
# uses: docker/login-action@v3
154-
# with:
155-
# registry: "${{ env.DEV_CONTAINER_REGISTRY }}"
156-
# username: "${{ env.DEV_LOGIN_USERNAME }}"
157-
# password: "${{ env.DEV_LOGIN_PASSWORD }}"
158-
159-
# - name: Build & Push refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}
160-
# uses: docker/build-push-action@v5
161-
# with:
162-
# context: .
163-
# cache-from: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-cache
164-
# 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
165-
# platforms: linux/amd64
166-
# file: Dockerfile
167-
# tags: ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}
168-
# push: true
169-
# build-args: |
170-
# platform=linux/amd64
171-
# label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
57+
- name: Set up Docker Buildx
58+
uses: docker/setup-buildx-action@v3
59+
with:
60+
platforms: linux/amd64,linux/arm64
17261

173-
# - name: Build & Push refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64
174-
# uses: docker/build-push-action@v5
175-
# with:
176-
# context: .
177-
# cache-from: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64-cache
178-
# 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
179-
# platforms: linux/arm64
180-
# file: Dockerfile
181-
# tags: ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64
182-
# push: true
183-
# build-args: |
184-
# platform=linux/arm64
185-
# label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
62+
- name: Set up QEMU
63+
uses: docker/setup-qemu-action@v3
64+
with:
65+
platforms: arm64,arm
18666

187-
# - name: Build & Push refinery-parent-images:sha-${{ matrix.parent_image_type }}
188-
# uses: docker/build-push-action@v5
189-
# with:
190-
# context: .
191-
# cache-from: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-cache
192-
# cache-to: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-cache,mode=max,image-manifest=true
193-
# platforms: linux/amd64
194-
# file: Dockerfile
195-
# tags: ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}
196-
# push: true
197-
# build-args: |
198-
# platform=linux/amd64
199-
# label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
67+
- name: Log into DEV registry
68+
uses: docker/login-action@v3
69+
with:
70+
registry: "${{ env.DEV_CONTAINER_REGISTRY }}"
71+
username: "${{ env.DEV_LOGIN_USERNAME }}"
72+
password: "${{ env.DEV_LOGIN_PASSWORD }}"
20073

201-
# - name: Build & Push refinery-parent-images:sha-${{ matrix.parent_image_type }}-arm64
202-
# uses: docker/build-push-action@v5
203-
# with:
204-
# context: .
205-
# cache-from: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-arm64-cache
206-
# cache-to: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-arm64-cache,mode=max,image-manifest=true
207-
# platforms: linux/arm64
208-
# file: Dockerfile
209-
# tags: ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-arm64
210-
# push: true
211-
# build-args: |
212-
# platform=linux/arm64
213-
# label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
74+
- name: Build & Push refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}
75+
uses: docker/build-push-action@v5
76+
with:
77+
context: .
78+
cache-from: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-cache
79+
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
80+
platforms: linux/amd64
81+
file: Dockerfile
82+
tags: ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}
83+
push: true
84+
build-args: |
85+
platform=linux/amd64
86+
label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
87+
88+
- name: Build & Push refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64
89+
uses: docker/build-push-action@v5
90+
with:
91+
context: .
92+
cache-from: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64-cache
93+
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
94+
platforms: linux/arm64
95+
file: Dockerfile
96+
tags: ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.event.pull_request.head.ref }}-${{ matrix.parent_image_type }}-arm64
97+
push: true
98+
build-args: |
99+
platform=linux/arm64
100+
label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
101+
102+
- name: Build & Push refinery-parent-images:sha-${{ matrix.parent_image_type }}
103+
uses: docker/build-push-action@v5
104+
with:
105+
context: .
106+
cache-from: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-cache
107+
cache-to: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-cache,mode=max,image-manifest=true
108+
platforms: linux/amd64
109+
file: Dockerfile
110+
tags: ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}
111+
push: true
112+
build-args: |
113+
platform=linux/amd64
114+
label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile
115+
116+
- name: Build & Push refinery-parent-images:sha-${{ matrix.parent_image_type }}-arm64
117+
uses: docker/build-push-action@v5
118+
with:
119+
context: .
120+
cache-from: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-arm64-cache
121+
cache-to: type=registry,ref=${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-arm64-cache,mode=max,image-manifest=true
122+
platforms: linux/arm64
123+
file: Dockerfile
124+
tags: ${{ env.DEV_CONTAINER_REGISTRY }}/refinery-parent-images:${{ github.sha }}-${{ matrix.parent_image_type }}-arm64
125+
push: true
126+
build-args: |
127+
platform=linux/arm64
128+
label=dockerfile-path=https://github.com/refinery-${{ matrix.parent_image_type }}-parent-image/blob/${{ github.sha }}/Dockerfile

0 commit comments

Comments
 (0)