forked from google/ml-metadata
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: automate image build and tag (#5)
- Loading branch information
Showing
4 changed files
with
124 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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,33 @@ | ||
name: "Create a container build" | ||
description: "This workflow can be used to create a container build from source branches." | ||
inputs: | ||
QUAY_ORG: | ||
description: "Quay organization." | ||
default: "opendatahub" | ||
required: false | ||
IMAGE_REPO: | ||
description: "Quay image repo name." | ||
required: true | ||
IMAGE_TAG: | ||
description: "Quay image tag." | ||
required: true | ||
DOCKERFILE: | ||
description: "Dockerfile." | ||
default: "Dockerfile.redhat" | ||
required: false | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.SOURCE_BRANCH }} | ||
path: build | ||
- name: Build image | ||
shell: bash | ||
working-directory: build | ||
env: | ||
DOCKER_IMAGE_REPO: quay.io/${{ inputs.QUAY_ORG }}/${{ inputs.IMAGE_REPO }} | ||
DOCKER_IMAGE_TAG: ${{ inputs.IMAGE_TAG }} | ||
DOCKER_FILE: ${{ inputs.DOCKERFILE }} | ||
run: | | ||
./ml_metadata/tools/docker_server/build_docker_image.sh |
This file contains 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,51 @@ | ||
name: Build MLMD gRPC Server image for Master branch | ||
on: | ||
push: | ||
branches: | ||
- master | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
QUAY_ORG: opendatahub | ||
QUAY_ID: ${{ secrets.QUAY_USERNAME }} | ||
QUAY_TOKEN: ${{ secrets.QUAY_PASSWORD }} | ||
MLMD_IMAGE_REPO: mlmd-grpc-server | ||
MLMD_IMAGE_DOCKERFILE: Dockerfile.redhat | ||
SOURCE_BRANCH: master | ||
|
||
jobs: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Generate Tag | ||
shell: bash | ||
id: tags | ||
run: | | ||
commit_sha=${{ github.event.after }} | ||
tag=main-${commit_sha:0:7} | ||
echo "tag=${tag}" >> $GITHUB_OUTPUT | ||
- name: Build Image | ||
uses: ./.github/actions/build | ||
with: | ||
QUAY_ORG: ${{ env.QUAY_ORG }} | ||
IMAGE_REPO: ${{ env.MLMD_IMAGE_REPO }} | ||
IMAGE_TAG: ${{ steps.tags.outputs.tag }} | ||
DOCKERFILE: ${{ env.MLMD_IMAGE_DOCKERFILE }} | ||
- name: Login to Quay | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ env.QUAY_ID }} | ||
password: ${{ env.QUAY_TOKEN }} | ||
- name: Push Images | ||
env: | ||
IMG: quay.io/${{ env.QUAY_ORG }}/${{ env.MLMD_IMAGE_REPO }} | ||
MAIN_HASH_TAG: ${{ steps.tags.outputs.tag }} | ||
run: | | ||
docker push ${IMG}:${MAIN_HASH_TAG} | ||
docker tag ${IMG}:${MAIN_HASH_TAG} ${IMG}:latest | ||
docker push ${IMG}:latest | ||
docker tag ${IMG}:${MAIN_HASH_TAG} ${IMG}:main | ||
docker push ${IMG}:main |
This file contains 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,40 @@ | ||
name: Container Image Build | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'LICENSE*' | ||
- '**.gitignore' | ||
- '**.md' | ||
- '**.txt' | ||
- '.github/ISSUE_TEMPLATE/**' | ||
- '.github/dependabot.yml' | ||
- 'docs/**' | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
env: | ||
QUAY_ORG: opendatahub | ||
QUAY_ID: ${{ secrets.QUAY_USERNAME }} | ||
QUAY_TOKEN: ${{ secrets.QUAY_PASSWORD }} | ||
MLMD_IMAGE_REPO: mlmd-grpc-server | ||
MLMD_IMAGE_DOCKERFILE: Dockerfile.redhat | ||
SOURCE_BRANCH: ${{ github.ref }} | ||
jobs: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Generate Tag | ||
shell: bash | ||
id: tags | ||
run: | | ||
commit_sha=${{ github.event.after }} | ||
tag=main-${commit_sha:0:7} | ||
echo "tag=${tag}" >> $GITHUB_OUTPUT | ||
- name: Build Image | ||
uses: ./.github/actions/build | ||
with: | ||
QUAY_ORG: ${{ env.QUAY_ORG }} | ||
IMAGE_REPO: ${{ env.MLMD_IMAGE_REPO }} | ||
IMAGE_TAG: ${{ steps.tags.outputs.tag }} | ||
DOCKERFILE: ${{ env.MLMD_IMAGE_DOCKERFILE }} |
This file was deleted.
Oops, something went wrong.