feat(deps): Update dependency kfp to v2.8.0 #3602
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
name: Build Notebook Images | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
build-matrix: | |
name: Create Build Matrix | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
id: set-matrix | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # No shallow clone, we need all history | |
token: ${{ secrets.PLURAL_BOT_PAT }} | |
- name: 'Setup Node' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.18.0 | |
- name: Install Semantic Release Plus | |
run: npm install -g semantic-release-plus @semantic-release/exec | |
- name: generate matrix | |
id: generate-matrix | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.PLURAL_BOT_PAT }} | |
run: | | |
if [ ${{ github.event_name }} == 'pull_request' ]; | |
then | |
CHANGED_DIRS=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | xargs -I {} dirname {}) | |
else | |
CHANGED_DIRS=$(git diff --name-only ${{ github.event.before }}..${{ github.event.after }} | xargs -I {} dirname {}) | |
fi | |
echo "${CHANGED_DIRS}" | |
CONTAINER_FOLDERS=$(for CHANGED_DIR in ${CHANGED_DIRS}; do echo ${CHANGED_DIR} | awk -F "/" '{print $1}'; done | sort -u) | |
for CONTAINER_FOLDER in ${CONTAINER_FOLDERS}; do | |
if [[ "${CONTAINER_FOLDER}" != "."* ]]; then | |
APP_NAME="${CONTAINER_FOLDER}" semantic-release | |
if [ -f "release_version" ]; then | |
mv release_version ${CONTAINER_FOLDER}/release_version | |
else | |
echo "pr" > ${CONTAINER_FOLDER}/release_version | |
fi | |
fi | |
done | |
DOCKERFILES=$(for CONTAINER_FOLDER in ${CONTAINER_FOLDERS}; do if [[ "${CONTAINER_FOLDER}" != "."* ]]; then find ${CONTAINER_FOLDER} -name "*Dockerfile"; fi; done | sort -u) | |
echo "${DOCKERFILES}" | |
MATRIX_PROJECTS_JSON="[" | |
MATRIX_INCLUDE_JSON="[" | |
for DOCKERFILE in ${DOCKERFILES}; do | |
DIR=$(dirname ${DOCKERFILE}) | |
RELEASE=$(cat ${DIR}/release_version) | |
if [[ "$(basename ${DOCKERFILE})" == *"cuda"* ]] | |
then | |
MATRIX_PROJECTS_JSON+=$(sed 's/^/"/;s/$/"/' <<< "${DIR}"-cuda) | |
PROJECT="${DIR}"-cuda | |
else | |
MATRIX_PROJECTS_JSON+=$(sed 's/^/"/;s/$/"/' <<< "${DIR}") | |
PROJECT="${DIR}" | |
fi | |
echo "{$MATRIX_PROJECTS_JSON}" | |
MATRIX_INCLUDE_JSON+="{\"path\": \"${DIR}\", \"project\": \"${PROJECT}\", \"dockerfile\": \"${DOCKERFILE}\", \"version\": \"${RELEASE}\"}" | |
echo "${MATRIC_INCLUDE_JSON}" | |
done | |
echo "{$MATRIX_PROJECTS_JSON}" | |
echo "${MATRIC_INCLUDE_JSON}" | |
MATRIX_INCLUDE_JSON="${MATRIX_INCLUDE_JSON//\}\{/\}, \{}" | |
MATRIX_INCLUDE_JSON+="]" | |
MATRIX_PROJECTS_JSON="${MATRIX_PROJECTS_JSON//\"\"/\", \"}" | |
MATRIX_PROJECTS_JSON+="]" | |
MATRIX_JSON="{\"include\": ${MATRIX_INCLUDE_JSON}}" | |
echo "${MATRIX_JSON}" | |
CONTINUE_DOCKER_JOB="no" | |
if [[ "${MATRIX_PROJECTS_JSON}" != "[]" ]]; then | |
CONTINUE_DOCKER_JOB="yes" | |
fi | |
echo "${CONTINUE_DOCKER_JOB}" | |
echo "continue=${CONTINUE_DOCKER_JOB}" >> $GITHUB_OUTPUT | |
echo "matrix=${MATRIX_JSON}" >> $GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.generate-matrix.outputs.matrix }} | |
continue: ${{ steps.generate-matrix.outputs.continue }} | |
build-images: | |
if: needs.build-matrix.outputs.continue == 'yes' | |
name: Build and push notebook images | |
runs-on: ubuntu-latest | |
needs: build-matrix | |
strategy: | |
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/pluralsh/kubeflow-notebooks-${{ matrix.project }} | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{raw}},value=${{ matrix.version }} | |
type=sha | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.path }} | |
file: ${{ matrix.dockerfile }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
if: contains(matrix.project, 'cuda') == false && github.event_name != 'pull_request' | |
with: | |
scan-type: 'image' | |
image-ref: ${{ fromJSON(steps.meta.outputs.json).tags[0] }} | |
hide-progress: false | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
scanners: 'vuln' | |
ignore-unfixed: true | |
#severity: 'CRITICAL,HIGH' | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
if: github.event_name == 'pull_request' | |
with: | |
scan-type: 'fs' | |
scan-ref: '.' | |
hide-progress: false | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
scanners: 'vuln' | |
ignore-unfixed: true | |
#severity: 'CRITICAL,HIGH' | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v2 | |
if: contains(matrix.project, 'cuda') == false | |
with: | |
sarif_file: 'trivy-results.sarif' |