Skip to content

ci: split out build image and push from release into seperate WF #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/image-build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Notebook Image Build and Push

on:
workflow_dispatch:
inputs:
release-version:
type: string
required: true
description: 'Version number (for example: 0.1.0)'
is-stable:
description: 'Select if the built image should be tagged as latest'
required: true
type: boolean
quay-organization:
description: 'Quay organization used to push the built images to'
required: true
default: 'project-codeflare'
python_version:
type: string
default: "3.8"
required: true
poetry_version:
type: string
default: "1.5.1"
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ github.event.inputs.python_version }}
- name: Image Build
run: |
cd custom-nb-image
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 }} .
- name: Login to Quay.io
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_ID }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Image Push
run: podman push quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }}
- name: Image Push Stable
if: ${{ inputs.is-stable }}
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
32 changes: 18 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ on:
type: string
default: "1.5.1"
required: true
codeflare-repository-organization:
type: string
default: "project-codeflare"

jobs:
release:
Expand Down Expand Up @@ -81,18 +84,19 @@ jobs:
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Image Build
- name: Notebook Image Build and Push
run: |
cd custom-nb-image
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 }} .
- name: Login to Quay.io
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_ID }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Image Push
run: podman push quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }}
- name: Image Push Latest
if: ${{ inputs.is-latest }}
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
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 }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash

- name: Wait for Notebook image build and push to finish
run: |
# wait for a while for Run to be started
sleep 5
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)
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --interval 10 --exit-status
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash