forked from kubeflow/kfp-tekton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
268 additions
and
0 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,63 @@ | ||
name: "Create a podman build" | ||
description: "This workflow can be used to create a podman build and push to quay.io from source branches." | ||
inputs: | ||
IMAGE_REPO: | ||
description: "Quay image repo name." | ||
required: true | ||
DOCKERFILE: | ||
description: "Path to Dockerfile." | ||
required: true | ||
GH_REPO: | ||
description: "GH org/repo that contains the dockerfile to source." | ||
required: true | ||
OVERWRITE: | ||
default: "false" | ||
description: "GH org/repo that contains the dockerfile to source." | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ inputs.GH_REPO }} | ||
ref: ${{ env.SOURCE_BRANCH }} | ||
path: build | ||
- name: Login to Quay.io | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
username: ${{ env.QUAY_ID }} | ||
password: ${{ env.QUAY_TOKEN }} | ||
registry: quay.io | ||
# Tags in quay stick around as objects in api, when deleted quay adds "end_ts" time stamp on the tag. | ||
# To determine a tag is deleted, we need to check for the presence of this tag. | ||
# Also note there can be multiple tags created/deleted, thus we have 4 cases: | ||
# Case 1: Only 1 tag was ever created "tags: [{name:..},]" -- no end_ts field | ||
# Case 2: No tag was ever created "tags: []" | ||
# Case 3: >1 tags were created, but they were all deleted at some point [{name:..., end_ts,..},....] -- note they all have "end_ts" field. | ||
# Case 4: >1 tags were created, but the most recent one was never deleted (same as case 3, but the latest tag does not have "end_ts". | ||
- name: Check if Image already exists | ||
shell: bash | ||
if: inputs.OVERWRITE == 'false' | ||
env: | ||
IMAGE: quay.io/${{ env.QUAY_ORG }}/${{ inputs.IMAGE_REPO }}:${{ env.TARGET_IMAGE_TAG }} | ||
run: | | ||
echo ${{ inputs.OVERWRITE }} | ||
tags=$(curl --request GET 'https://quay.io/api/v1/repository/${{ env.QUAY_ORG }}/${{ inputs.IMAGE_REPO }}/tag/?specificTag=${{ env.TARGET_IMAGE_TAG }}') | ||
latest_tag_has_end_ts=$(echo $tags | yq .tags - | yq 'sort_by(.start_ts) | reverse' - -P | yq .[0].end_ts -) | ||
notempty=$(echo ${tags} | yq .tags - | yq any) | ||
# Image only exists if there is a tag that does not have "end_ts" (i.e. it is still present). | ||
if [[ "$notempty" == "true" && $latest_tag_has_end_ts == "null" ]]; then | ||
echo "::error::The image ${{ env.IMAGE }} already exists" | ||
exit 1 | ||
else | ||
echo "Image does not exist...proceeding with build & push." | ||
fi | ||
- name: Build image | ||
shell: bash | ||
working-directory: build | ||
env: | ||
IMAGE: quay.io/${{ env.QUAY_ORG }}/${{ inputs.IMAGE_REPO }}:${{ env.TARGET_IMAGE_TAG }} | ||
run: | | ||
podman build . -f ${{ inputs.DOCKERFILE }} -t ${{ env.IMAGE }} && podman push ${{ env.IMAGE }} |
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,205 @@ | ||
name: Build images from sources. | ||
run-name: Build images from sources. | ||
on: | ||
workflow_call: | ||
inputs: | ||
src_branch: | ||
type: string | ||
default: 'v1.0.x' | ||
description: 'Source branch to build DSP from' | ||
required: true | ||
target_tag: | ||
type: string | ||
default: 'vx.y.z' | ||
description: 'Target Image Tag' | ||
required: true | ||
quay_org: | ||
type: string | ||
default: 'gmfrasca' | ||
description: 'Quay Organization' | ||
required: true | ||
overwrite_imgs: | ||
type: string | ||
default: 'true' | ||
description: 'Overwrite images in quay if they already exist for this release.' | ||
required: true | ||
workflow_dispatch: | ||
inputs: | ||
src_branch: | ||
type: string | ||
default: 'v1.0.x' | ||
description: 'Source branch to build DSP from' | ||
required: true | ||
target_tag: | ||
type: string | ||
default: 'vx.y.z' | ||
description: 'Target Image Tag' | ||
required: true | ||
quay_org: | ||
type: string | ||
default: 'gmfrasca' | ||
description: 'Quay Organization' | ||
required: true | ||
overwrite_imgs: | ||
type: string | ||
default: 'true' | ||
description: 'Overwrite images in quay if they already exist for this release.' | ||
required: true | ||
|
||
env: | ||
IMAGE_REPO_SERVER: ds-pipelines-api-server | ||
IMAGE_REPO_UI: ds-pipelines-frontend | ||
IMAGE_REPO_CACHE: ds-pipelines-cacheserver | ||
IMAGE_REPO_PA: ds-pipelines-persistenceagent | ||
IMAGE_REPO_SWF: ds-pipelines-scheduledworkflow | ||
IMAGE_REPO_VC: ds-pipelines-viewercontroller | ||
IMAGE_REPO_ARTIFACT: ds-pipelines-artifact-manager | ||
IMAGE_REPO_MLMD_WRITER: ds-pipelines-metadata-writer | ||
IMAGE_REPO_MLMD_ENVOY: ds-pipelines-metadata-envoy | ||
IMAGE_REPO_MLMD_GRPC: ds-pipelines-metadata-grpc | ||
SOURCE_BRANCH: ${{ inputs.src_branch }} | ||
QUAY_ORG: ${{ inputs.quay_org }} | ||
QUAY_ID: ${{ secrets.QUAY_ROBOT_USERNAME }} | ||
QUAY_TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
TARGET_IMAGE_TAG: ${{ inputs.target_tag }} | ||
OVERWRITE_IMAGES: ${{ inputs.overwrite_imgs }} | ||
jobs: | ||
SERVER-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_SERVER }} | ||
DOCKERFILE: backend/Dockerfile | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
UI-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_UI }} | ||
DOCKERFILE: frontend/Dockerfile | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
CACHE-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_CACHE }} | ||
DOCKERFILE: backend/Dockerfile.cacheserver | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
PA-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_PA }} | ||
DOCKERFILE: backend/Dockerfile.persistenceagent | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
SWF-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_SWF }} | ||
DOCKERFILE: backend/Dockerfile.scheduledworkflow | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
VC-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_VC }} | ||
DOCKERFILE: backend/Dockerfile.viewercontroller | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
ARTIFACT-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_ARTIFACT }} | ||
DOCKERFILE: backend/artifact_manager/Dockerfile | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
MLMD_WRITER-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_MLMD_WRITER }} | ||
DOCKERFILE: backend/metadata_writer/Dockerfile | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
MLMD_GRPC-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_MLMD_GRPC }} | ||
DOCKERFILE: third-party/ml-metadata/Dockerfile | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} | ||
|
||
MLMD_ENVOY-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/build | ||
name: Build Image | ||
with: | ||
IMAGE_REPO: ${{ env.IMAGE_REPO_MLMD_ENVOY }} | ||
DOCKERFILE: third-party/metadata_envoy/Dockerfile | ||
GH_REPO: ${{ github.repository }} | ||
OVERWRITE: ${{ env.OVERWRITE_IMAGES }} |