Skip to content

Commit

Permalink
Merge pull request #115 from atheo89/RHOAIENG-13494
Browse files Browse the repository at this point in the history
Sync downstream/master with upstream v1.9 changes
  • Loading branch information
harshad16 authored Oct 3, 2024
2 parents b83797d + 4a0ef9b commit 4511fe9
Show file tree
Hide file tree
Showing 697 changed files with 53,633 additions and 248,703 deletions.
7 changes: 0 additions & 7 deletions .github/OWNERS

This file was deleted.

39 changes: 39 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# https://docs.github.com/en/code-security/dependabot
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(gha)"

# only open security update PRs (see linked docs for explanation of `open-pull-requests-limit: 0`)
# https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#overriding-the-default-behavior-with-a-configuration-file
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#open-pull-requests-limit

# security PRs need to be further enabled in the repository settings
# https://docs.github.com/en/code-security/dependabot/dependabot-auto-triage-rules/customizing-auto-triage-rules-to-prioritize-dependabot-alerts

- package-ecosystem: "gomod"
open-pull-requests-limit: 0
directory: "/components/notebook-controller"
schedule:
interval: "weekly"
commit-message:
prefix: "fix(deps)"
# https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#overriding-the-default-behavior-with-a-configuration-file
groups:
go:
applies-to: security-updates

- package-ecosystem: "gomod"
open-pull-requests-limit: 0
directory: "/components/odh-notebook-controller"
schedule:
interval: "weekly"
commit-message:
prefix: "fix(deps)"
groups:
go:
applies-to: security-updates
109 changes: 109 additions & 0 deletions .github/workflows/notebook-controller-images-updater.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
# This is a gha updates automaticaly the notebook controller images. Can be run on demand before a new release
name: Update Notebook Controller Images With Latest Commit ID
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
branch-name:
description: "Provide name of the branch, ex: v1.9-branch"
required: true
default: "v1.9-branch"
organization:
required: true
description: "Owner of origin notebooks repository used to open a PR"
default: "opendatahub-io"
env:
REPO_OWNER: ${{ github.event.inputs.organization }}
REPO_NAME: kubeflow
TEMP_UPDATER_BRANCH: temp-${{ github.run_id }}
BRANCH_NAME: ${{ github.event.inputs.branch-name }}

jobs:
update-notebook-controller-images:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}

- name: Checkout new branch
run: |
echo ${{ env.TEMP_UPDATER_BRANCH }}
git checkout -b ${{ env.TEMP_UPDATER_BRANCH }}
git push --set-upstream origin ${{ env.TEMP_UPDATER_BRANCH }}
- name: Configure Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: Retrive latest commit
id: commit-id
shell: bash
run: |
PAYLOAD=$(curl --silent -H 'Accept: application/vnd.github.v4.raw' https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/commits?sha=$BRANCH_NAME&per_page=1)
echo "COMMIT_ID=$(echo $PAYLOAD | jq -r '.[0].sha[0:7]')" >> ${GITHUB_OUTPUT}
- name: Extract version from branch-name
id: version
run: |
if [[ "${{ env.BRANCH_NAME }}" == "main" ]]; then
VERSION="main"
else
VERSION=$(echo "${{ env.BRANCH_NAME }}" | sed -E 's/^v([0-9]+\.[0-9]+)-.*/\1/')
# Check if VERSION is empty, then, assign the full branch name
if [[ -z "$VERSION" ]]; then
VERSION="${{ env.BRANCH_NAME }}"
fi
fi
echo "VERSION=$VERSION" >> ${GITHUB_OUTPUT}
echo "Extracted VERSION is: $VERSION"
- name: Update related files
id: apply-changes
run: |
COMMIT_ID=${{ steps.commit-id.outputs.COMMIT_ID }}
VERSION=${{ steps.version.outputs.VERSION }}
echo "Updating files in VERSION=${VERSION} with COMMIT_ID=${COMMIT_ID}"
sed -E "s/(odh-kf-notebook-controller-image=quay\.io\/opendatahub\/kubeflow-notebook-controller:)[^: -]+(-)[^ ]+/\1$VERSION\2$COMMIT_ID/" -i components/notebook-controller/config/overlays/openshift/params.env
sed -E "s/(odh-notebook-controller-image=quay\.io\/opendatahub\/odh-notebook-controller:)[^: -]+(-)[^ ]+/\1$VERSION\2$COMMIT_ID/" -i components/odh-notebook-controller/config/base/params.env
sed -E "s/(KF_TAG \?= )[^\-]+(-)[^ ]+/\1$VERSION\2$COMMIT_ID/" -i components/odh-notebook-controller/Makefile
git status
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
echo "Changes detected, committing and pushing..."
git fetch origin ${{ env.TEMP_UPDATER_BRANCH }}
git pull origin ${{ env.TEMP_UPDATER_BRANCH }}
git add components/notebook-controller/config/overlays/openshift/params.env
git add components/odh-notebook-controller/config/base/params.env
git add components/odh-notebook-controller/Makefile
git commit -m "Update odh and notebook-controller with image ${VERSION}-${COMMIT_ID}"
git push origin ${{ env.TEMP_UPDATER_BRANCH }}
git log --oneline
else
echo "There were no changes detected on ${{ env.BRANCH_NAME }}"
fi
- name: Create Pull Request
run: |
gh pr create --repo https://github.com/$REPO_OWNER/$REPO_NAME.git \
--title "$pr_title" \
--body "$pr_body" \
--head $REPO_OWNER:${{ env.TEMP_UPDATER_BRANCH }} \
--base ${{ env.BRANCH_NAME }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pr_title: "[GHA] Update odh and notebook-controller with image ${{ steps.version.outputs.VERSION }}-${{ steps.commit-id.outputs.COMMIT_ID }}"
pr_body: |
:robot: This is an automated Pull Request created by `/.github/workflows/notebook-controller-images-updater.yaml`.
Have been updated the following related files:
- components/notebook-controller/config/overlays/openshift/params.env
- components/odh-notebook-controller/config/base/params.env
- components/odh-notebook-controller/Makefile
Loading

0 comments on commit 4511fe9

Please sign in to comment.