Skip to content

Commit

Permalink
new-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayJagan committed Apr 30, 2024
1 parent 16b35ae commit 5be5fa1
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 111 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
name: "Create release pr"
description: "Updates get_all_manifests.sh with relavent tags and creates a pr"
inputs:
pr-branch:
required: true
description: "Branch containing the changes to create pr"
commit-message:
required: true
description: "Commit message for the pr"
title:
required: true
description: "Title of the pr"
runs:
using: "composite"
steps:
Expand All @@ -21,11 +11,4 @@ runs:
script({github, core})
- name: Update versions
shell: bash
run: ./.github/scripts/update-manifests-tags.sh ${{ env.CODEFLARE }} ${{ env.KUBERAY }} ${{ env.KUEUE }} ${{ env.DSP }} ${{ env.DASHBOARD }} ${{ env.NOTEBOOK-CONTROLLER }} ${{ env.NOTEBOOK-CONTROLLER }} ${{ env.NOTEBOOKS }} ${{ env.TRUSTYAI }} ${{ env.MODELMESH }} ${{ env.ODH-MODEL-CONTROLLER }} ${{ env.KSERVE }} ${{ env.MODEL-REGISTRY }}
- name: Create release pr
uses: peter-evans/create-pull-request@v6
with:
commit-message: ${{ inputs.commit-message }}
branch: ${{ inputs.pr-branch }}
delete-branch: true
title: ${{ inputs.title }}
run: ./.github/scripts/update-manifests-tags.sh ${{ env.CODEFLARE }} ${{ env.KUBERAY }} ${{ env.KUEUE }} ${{ env.DSP }} ${{ env.DASHBOARD }} ${{ env.NOTEBOOK-CONTROLLER }} ${{ env.NOTEBOOK-CONTROLLER }} ${{ env.NOTEBOOKS }} ${{ env.TRUSTYAI }} ${{ env.MODELMESH }} ${{ env.ODH-MODEL-CONTROLLER }} ${{ env.KSERVE }} ${{ env.MODEL-REGISTRY }}
10 changes: 5 additions & 5 deletions .github/scripts/wait-for-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ set -euo pipefail

sleep 10

while $(gh pr checks "$1" | grep -q -v 'tide' | grep -q 'pending'); do
printf ":stopwatch: PR checks still pending, retrying in 10 seconds...\n"
sleep 10
while [ $(gh pr checks "$1" | grep -v 'tide' | grep 'pending' | wc -m) -gt 0 ]; do
printf "PR checks still pending, retrying in 10 seconds...\n"
sleep 30 # replace with 60000
done

if $(gh pr checks "$1" | grep -q 'fail'); then
if [ $(gh pr checks "$1" | grep 'fail' | wc -m) -gt 0 ]; then
printf "!!PR checks failed!!\n"
exit 1
fi

if $(gh pr checks "$1" | grep -q 'pass'); then
if [ $(gh pr checks "$1" | grep 'pass' | wc -m) -gt 0 ]; then
printf "!!PR checks passed!!\n"
exit 0
fi
Expand Down
108 changes: 108 additions & 0 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: "Pre-Release"
on:
workflow_dispatch:
inputs:
version:
type: string
description: The version to update.
required: true
tracker-url:
type: string
description: The URL to tracker issue.
required: true
env:
VERSION: ${{ inputs.version }}
TRACKER_URL: ${{ inputs.tracker-url }}
jobs:
dry-run-pr:
runs-on: ubuntu-latest
name: Create dry-run pr and update tags
steps:
- uses: actions/checkout@v4
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Validate semver
run: ./.github/scripts/validate-semver.sh v${{ env.VERSION }}
- uses: ./.github/actions/update-manifest-branches
- name: Create dry-run pr
uses: peter-evans/create-pull-request@v6
id: cpr-dry-run
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: "Test ${{ env.VERSION }} Release"
branch: odh-release/e2e-dry-run
delete-branch: true
title: "[DO NOT MERGE] Test ${{ env.VERSION }} Release"
- name: Wait for checks to pass
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: ./.github/scripts/wait-for-checks.sh ${{ steps.cpr-dry-run.outputs.pull-request-number }}
- name: Close PR
uses: peter-evans/close-pull@v3
with:
token: ${{ steps.generate-token.outputs.token }}
pull-request-number: ${{ steps.cpr-dry-run.outputs.pull-request-number }}
comment: Auto-closing pull request after success checks
delete-branch: true
- name: Push version tag to quay.io
run: |
# skopeo login -u <QUAY_USERNAME> -p ${{ secrets.QUAY_PASSWORD }} quay.io/opendatahub # Store PODMAN_PASSWORD of opendatahub-io here as a secret.
# skopeo copy docker://quay.io/opendatahub/opendatahub-operator:pr-${{ steps.cpr-dry-run.outputs.pull-request-number }} docker://quay.io/opendatahub/opendatahub-operator:${{ env.VERSION }}
echo "Successfully updated tag to quay.io with version: ${{ env.VERSION }}"
release-branch-pr:
needs: dry-run-pr
runs-on: ubuntu-latest
name: Create version update pr
steps:
- uses: actions/checkout@v4
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create release branch
run: |
git checkout -b odh-${{ env.VERSION }}
git push -f origin odh-${{ env.VERSION }}
- uses: ./.github/actions/update-manifest-branches
- name: Update versions in relevant files
run: |
NEW_VERSION=${{ env.VERSION }}
CURRENT_VERSION=$(cat Makefile | grep -w "VERSION ?=" | cut -d ' ' -f 3)
sed -i -e "s/^VERSION ?=.*/VERSION ?= $NEW_VERSION/g" Makefile
sed -i -e "s|containerImage.*|containerImage: quay.io/opendatahub/opendatahub-operator:v$NEW_VERSION|g" config/manifests/bases/opendatahub-operator.clusterserviceversion.yaml
sed -i -e "s|createdAt.*|createdAt: \"$(date +"%Y-%-m-%dT00:00:00Z")\"|g" config/manifests/bases/opendatahub-operator.clusterserviceversion.yaml
sed -i -e "s|name: opendatahub-operator.v.*|name: opendatahub-operator.v$NEW_VERSION|g" config/manifests/bases/opendatahub-operator.clusterserviceversion.yaml
sed -i -e "s|version: $CURRENT_VERSION.*|version: $NEW_VERSION|g" config/manifests/bases/opendatahub-operator.clusterserviceversion.yaml
sed -i -e "s|olm.skipRange:.*|olm.skipRange: \'>=1.0.0 <$NEW_VERSION\'|g" config/manifests/bases/opendatahub-operator.clusterserviceversion.yaml
- name: Run make manifests & bundle
run: make manifests bundle
- name: Clean up
run: |
sed -i -e "s|image: quay.io/opendatahub/opendatahub-operator:latest.*|image: REPLACE_IMAGE:latest|g" bundle/manifests/opendatahub-operator.clusterserviceversion.yaml
rm ./config/manager/kustomization.yaml
- name: Create release pr
uses: peter-evans/create-pull-request@v6
id: cpr-release-pr
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: "ODH Release ${{ env.VERSION }}"
branch: odh-release/version-update
delete-branch: true
title: "ODH Release ${{ env.VERSION }}: Version Update"
# reviewers: "VaishnaviHire,zdtsw,AjayJagan,ykaliuta" TODO
- name: Wait for checks to pass
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: ./.github/scripts/wait-for-checks.sh ${{ steps.cpr-release-pr.outputs.pull-request-number }}
- name: Comment version and tracker url in the pr
uses: thollander/actions-comment-pull-request@v2
with:
message: |
#Release#
version:${{ env.VERSION }}
tracker-url:${{ env.TRACKER_URL }}
pr_number: ${{ steps.cpr-release-pr.outputs.pull-request-number }}
88 changes: 0 additions & 88 deletions .github/workflows/release-gh-publish.yaml

This file was deleted.

96 changes: 96 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: "Release ODH"
on:
pull_request:
types:
- closed
jobs:
gh-release:
if: github.event.pull_request.merged && startsWith(github.event.pull_request.title, 'ODH Release') && endsWith(github.event.pull_request.title, 'Version Update')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Get release data from pr
run: |
echo ${{ github.event.pull_request.number }}
- name: Get release data from pr
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: "#Release#"
- name: extract data
run: |
echo ${{ steps.fc.outputs.comment-body }}
# - name: Create and push version tags
# run: |
# git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
# git config --global user.name github-actions[bot]
# git checkout odh-${{ env.VERSION }}
# git tag -a -m v${{ env.VERSION }} v${{ env.VERSION }}
# git push origin v${{ env.VERSION }}
# - name: Get component release notes
# id: release-notes
# uses: actions/github-script@v7
# with:
# script: |
# const script = require('./.github/scripts/get-component-release-notes.js')
# script({github, core})
# - name: Create GH release
# uses: softprops/action-gh-release@v2
# with:
# body: ${{ steps.release-notes.outputs.release-notes-body }}
# tag_name: v${{ env.VERSION }}
# generate_release_notes: true
# append_body: true
# make_latest: true
# create-community-operators-pr:
# needs: [gh-release]
# name: Create community operators prod pr # https://github.com/redhat-openshift-ecosystem/community-operators-prod
# runs-on: ubuntu-latest
# steps:
# - uses: tibdex/github-app-token@v1
# id: generate-token
# with:
# app_id: ${{ secrets.APP_ID }}
# private_key: ${{ secrets.APP_PRIVATE_KEY }}
# - name: Set env variables
# uses: opendatahub-io/opendatahub-operator/.github/actions/set-shared-env@incubation
# with:
# pat-token: ${{ steps.generate-token.outputs.token }}
# - name: Checkout opendatahub-operator
# uses: actions/checkout@v4
# with:
# path: ./opendatahub-operator
# ref: v${{ env.VERSION }}
# - name: Checkout redhat-openshift-ecosystem/community-operators-prod
# uses: actions/checkout@v4
# with:
# token: <PAT> # We need a token with repo rights
# repository: redhat-openshift-ecosystem/community-operators-prod # replaced with redhat-openshift-ecosystem/community-operators-prod
# path: ./community-operators-prod
# - name: Copy bundle files and add annotation
# run : |
# ls -la
# # cd community-operators-prod
# # mkdir -p community-operators-prod/operators/opendatahub-operator/${{ env.VERSION }}
# # ls -la
# # cp -a ../opendatahub-operator/bundle/. operators/opendatahub-operator/${{ env.VERSION }}/
# # echo "
# # # OpenShift specific version
# # com.redhat.openshift.versions: v4.9" >> operators/opendatahub-operator/${{ env.VERSION }}/metadata/annotations.yaml
# # sed -i -e "s|image: REPLACE_IMAGE:latest.*|image: quay.io/opendatahub/opendatahub-operator:v${{ env.VERSION }}|g" operators/opendatahub-operator/${{ env.VERSION }}/manifests/opendatahub-operator.clusterserviceversion.yaml
# # git status
# - name: Create community operators prod pr
# uses: peter-evans/create-pull-request@v6
# with:
# path: ./community-operators-prod
# token: <PAT> # We need a token with repo rights
# push-to-fork: opendatahub-io/community-operators-prod # Here we can fork community-operators-prod into opendatahub-io and use opendatahub-io/community-operators-prod. eg:https://github.com/maistra/community-operators-prod
# commit-message: ODH Release v${{ env.VERSION }}
# delete-branch: true
# title: operator opendatahub-operator (${{ env.VERSION }})

0 comments on commit 5be5fa1

Please sign in to comment.