-
Notifications
You must be signed in to change notification settings - Fork 65
ci: add container builds and publish workflow #605
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
google-oss-prow
merged 5 commits into
kubeflow:notebooks-v2
from
andyatmiami:chore/publish_controller_workflow
Oct 2, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
828230d
ci: add publish workflow for controller
andyatmiami 288d0cf
mathew: example rewrite 1
thesuperzapper 225b47d
fix registry path to include owner and repo name
andyatmiami 3e2c437
ci: fix ws-publish.yml
andyatmiami 284cc8f
fix: semver with references
andyatmiami File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Build Image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image_name: | ||
required: true | ||
description: "the name of the image" | ||
type: string | ||
|
||
tag_with_latest: | ||
default: false | ||
description: "if true, image tags will include 'latest'" | ||
type: boolean | ||
tag_with_semver: | ||
default: false | ||
description: "if true, image tags will include the version (from semver_raw, without 'v' prefix)" | ||
type: boolean | ||
tag_with_sha: | ||
default: false | ||
description: "if true, image tags will include the commit SHA (both short and long)" | ||
type: boolean | ||
|
||
semver_raw: | ||
default: "UNSET_SEMVER" | ||
description: "the raw semver version (e.g., from VERSION file), used if tag_with_semver is true" | ||
type: string | ||
|
||
build_file: | ||
required: true | ||
description: "path to Dockerfile" | ||
type: string | ||
build_context: | ||
required: true | ||
description: "path to build context folder" | ||
type: string | ||
build_platforms: | ||
required: true | ||
description: "list of target platforms for build, comma separated (e.g., linux/amd64,linux/arm64/v8)" | ||
type: string | ||
|
||
push_to_registry: | ||
default: false | ||
description: "if true, push the built image to the registry" | ||
type: boolean | ||
|
||
env: | ||
IMAGE_REGISTRY: ghcr.io/${{ github.repository }} | ||
|
||
jobs: | ||
build_image: | ||
name: Build '${{ inputs.image_name }}' Image | ||
runs-on: ubuntu-latest | ||
andyatmiami marked this conversation as resolved.
Show resolved
Hide resolved
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v5 | ||
|
||
- name: Install QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
andyatmiami marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Install Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
if: ${{ inputs.push_to_registry }} | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Generate Image Metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.IMAGE_REGISTRY }}/${{ inputs.image_name }} | ||
flavor: | | ||
latest=${{ inputs.tag_with_latest }} | ||
tags: | | ||
type=semver,priority=1000,pattern={{version}},enable=${{ inputs.tag_with_semver }},value=${{ inputs.semver_raw }} | ||
type=semver,priority=900,pattern={{major}}.{{minor}},enable=${{ inputs.tag_with_semver }},value=${{ inputs.semver_raw }} | ||
andyatmiami marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type=sha,priority=200,prefix=sha-,format=short,enable=${{ inputs.tag_with_sha }} | ||
type=sha,priority=100,prefix=sha-,format=long,enable=${{ inputs.tag_with_sha }} | ||
|
||
- name: Build and Push Image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
annotations: ${{ steps.meta.outputs.annotations }} | ||
context: ${{ inputs.build_context }} | ||
file: ${{ inputs.build_file }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ inputs.build_platforms }} | ||
push: ${{ inputs.push_to_registry }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
andyatmiami marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Publish | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- notebooks-v2 | ||
- v*-branch | ||
paths: | ||
- releasing/version/VERSION | ||
## NOTE: we publish container images on any commit to all components, so the tags are consistent across components | ||
- workspaces/** | ||
|
||
jobs: | ||
check_version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version_changed: ${{ steps.filter.outputs.version }} | ||
version_raw: ${{ steps.get_version.outputs.version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: dorny/paths-filter@v3 | ||
id: filter | ||
with: | ||
base: ${{ github.ref }} | ||
filters: | | ||
version: | ||
- 'releasing/version/VERSION' | ||
|
||
- name: Get Version | ||
id: get_version | ||
run: echo "version=$(cat releasing/version/VERSION)" >> $GITHUB_OUTPUT | ||
andyatmiami marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
images: | ||
uses: ./.github/workflows/ws-build-image.yml | ||
needs: check_version | ||
secrets: inherit | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- image_name: workspaces-backend | ||
build_file: ./workspaces/backend/Dockerfile | ||
## NOTE: we build the backend from the parent folder so it can COPY from controller | ||
build_context: ./workspaces | ||
|
||
- image_name: workspaces-controller | ||
build_file: ./workspaces/controller/Dockerfile | ||
build_context: ./workspaces/controller | ||
|
||
- image_name: workspaces-frontend | ||
build_file: ./workspaces/frontend/Dockerfile | ||
build_context: ./workspaces/frontend | ||
with: | ||
image_name: ${{ matrix.image_name }} | ||
tag_with_latest: false # we don't use 'latest' tags for workspace images | ||
tag_with_semver: ${{ needs.check_version.outputs.version_changed == 'true' }} | ||
tag_with_sha: true | ||
semver_raw: ${{ needs.check_version.outputs.version_raw }} | ||
build_file: ${{ matrix.build_file }} | ||
build_context: ${{ matrix.build_context }} | ||
build_platforms: linux/amd64,linux/ppc64le,linux/arm64/v8 | ||
push_to_registry: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.