Skip to content

Commit 42e7e21

Browse files
committed
ci: split out build image and push from release into seperate WF
1 parent 89e6c5b commit 42e7e21

File tree

2 files changed

+69
-14
lines changed

2 files changed

+69
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Notebook Image Build and Push
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-version:
7+
type: string
8+
required: true
9+
description: 'Version number (for example: 0.1.0)'
10+
is-stable:
11+
description: 'Select if the built image should be tagged as latest'
12+
required: true
13+
type: boolean
14+
quay-organization:
15+
description: 'Quay organization used to push the built images to'
16+
required: true
17+
default: 'project-codeflare'
18+
python_version:
19+
type: string
20+
default: "3.8"
21+
required: true
22+
poetry_version:
23+
type: string
24+
default: "1.5.1"
25+
required: true
26+
27+
jobs:
28+
release:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout the repository
32+
uses: actions/checkout@v3
33+
- name: Install Python
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: ${{ github.event.inputs.python_version }}
37+
- name: Image Build
38+
run: |
39+
cd custom-nb-image
40+
podman build --build-arg SDK_VERSION="${{ github.event.inputs.release-version }}" -t quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }} .
41+
- name: Login to Quay.io
42+
uses: redhat-actions/podman-login@v1
43+
with:
44+
registry: quay.io
45+
username: ${{ secrets.QUAY_ID }}
46+
password: ${{ secrets.QUAY_TOKEN }}
47+
- name: Image Push
48+
run: podman push quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }}
49+
- name: Image Push Stable
50+
if: ${{ inputs.is-stable }}
51+
run: podman push quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }} quay.io/${{ github.event.inputs.quay-organization }}/notebook:stable

.github/workflows/release.yaml

+18-14
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ on:
2323
type: string
2424
default: "1.5.1"
2525
required: true
26+
codeflare-repository-organization:
27+
type: string
28+
default: "project-codeflare"
2629

2730
jobs:
2831
release:
@@ -81,18 +84,19 @@ jobs:
8184
- name: Publish package distributions to PyPI
8285
uses: pypa/gh-action-pypi-publish@release/v1
8386

84-
- name: Image Build
87+
- name: Notebook Image Build and Push
8588
run: |
86-
cd custom-nb-image
87-
podman build --build-arg SDK_VERSION="${{ github.event.inputs.release-version }}" -t quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }} .
88-
- name: Login to Quay.io
89-
uses: redhat-actions/podman-login@v1
90-
with:
91-
registry: quay.io
92-
username: ${{ secrets.QUAY_ID }}
93-
password: ${{ secrets.QUAY_TOKEN }}
94-
- name: Image Push
95-
run: podman push quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }}
96-
- name: Image Push Latest
97-
if: ${{ inputs.is-latest }}
98-
run: podman push quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }} quay.io/${{ github.event.inputs.quay-organization }}/notebook:latest
89+
gh workflow run image-build-and-push.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field release-version=${{ github.event.inputs.release-version }} --field quay-organization=${{ github.event.inputs.quay-organization }}
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
92+
shell: bash
93+
94+
- name: Wait for Notebook image build and push to finish
95+
run: |
96+
# wait for a while for Run to be started
97+
sleep 5
98+
run_id=$(gh run list --workflow image-build-and-push.yaml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --limit 1 --json databaseId --jq .[].databaseId)
99+
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --interval 10 --exit-status
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
102+
shell: bash

0 commit comments

Comments
 (0)