Skip to content

Commit

Permalink
chore: (#1257)
Browse files Browse the repository at this point in the history
1. Add "v" in the pushed tag(quay).
  2. Add logic to remove duplicate entries(read from tracker) in the release notes.
  3. Split pre-release workflow into 2 separate workflows. This is done to eliminate the need to
     retrigger whole workflow when the e2e fails.
  4. Remove wait-for-checks.sh script as we no longer need to wait for e2e and we can manually trigger the next workflow.
  • Loading branch information
AjayJagan authored Sep 24, 2024
1 parent d6eda01 commit ace0ead
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 114 deletions.
4 changes: 4 additions & 0 deletions .github/actions/update-release-version/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ inputs:
branch-name:
description: "Temporary branch to host the changes"
required: true
base-branch:
description: "Set pr base branch."
required: true
outputs:
pull-request-number:
description: "Number of the pull request created"
Expand Down Expand Up @@ -44,6 +47,7 @@ runs:
delete-branch: true
title: ${{ inputs.title }}
reviewers: "VaishnaviHire,zdtsw"
base: ${{ inputs.base-branch }}
- name: Set pr number in output
shell: bash
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/get-component-release-notes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function getModifiedComponentName(name){
let modifiedWord = name.split("-").join(" ")
let modifiedWord = name.split("-").join(" ").replace(/[^a-zA-Z ]/g, "").trim()
modifiedWord = modifiedWord[0].toUpperCase() + modifiedWord.slice(1).toLowerCase()
return modifiedWord.replace("Odh", "ODH")
}
Expand Down Expand Up @@ -31,9 +31,9 @@ module.exports = ({ github, core }) => {
components.forEach(component => {
if (regex.test(component)) {
let [componentName, branchUrl, tagUrl] = component.split("|")
componentName = componentName.trim()
componentName = getModifiedComponentName(componentName.trim())
const releaseNotesUrl = (tagUrl || branchUrl).trim();
outputStr += `- **${getModifiedComponentName(componentName)}**: ${releaseNotesUrl}\n`
if(!outputStr.includes(componentName)) outputStr += `- **${componentName}**: ${releaseNotesUrl}\n`

}
})
Expand Down
26 changes: 0 additions & 26 deletions .github/scripts/wait-for-checks.sh

This file was deleted.

156 changes: 71 additions & 85 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
@@ -1,89 +1,75 @@
name: "Pre-Release"
name: "Push tags and create version update prs"
on:
workflow_dispatch:
inputs:
version:
type: string
description: The version to update(https://semver.org/).
required: true
tracker-url:
type: string
description: The URL to tracker issue(https://github.com/opendatahub-io/opendatahub-community/issues).
required: true
permissions:
checks: read
pull-requests: write
contents: write
env:
VERSION: ${{ inputs.version }}
TRACKER_URL: ${{ inputs.tracker-url }}
pull_request:
types:
- closed

jobs:
dry-run-pr:
push-tags-and-create-release-prs:
if: github.event_name == 'pull_request' && github.event.pull_request.merged == false && github.event.action == 'closed' && contains(github.event.pull_request.title, '[DO NOT MERGE] Test')
runs-on: ubuntu-latest
name: Create dry-run pr and update tags
steps:
- uses: actions/checkout@v4
- 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: ${{ secrets.GITHUB_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: ${{ secrets.GITHUB_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: ${{ secrets.GITHUB_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 ${{ secrets.QUAY_ID }} -p ${{ secrets.QUAY_TOKEN }} quay.io
skopeo copy docker://quay.io/${{ secrets.QUAY_ORG }}/opendatahub-operator:pr-${{ steps.cpr-dry-run.outputs.pull-request-number }} docker://quay.io/${{ secrets.QUAY_ORG }}/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
- name: Create version update pr in incubation
uses: ./.github/actions/update-release-version
with:
version: ${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update version to ${{ env.VERSION }}"
title: "Update version to ${{ env.VERSION }}"
branch-name: "odh-release/version-update"
- 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: Create release pr in release branch
uses: ./.github/actions/update-release-version
id: cpr-release-pr
with:
version: ${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "ODH Release ${{ env.VERSION }}"
title: "ODH Release ${{ env.VERSION }}: Version Update"
branch-name: "odh-release/release-branch-update"
- 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 }}
- name: check release comment
uses: peter-evans/find-comment@v3
id: dry-run-comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: /release-odh
direction: last
- name: "Evaluate release comment"
run: |
if [ "${{ steps.dry-run-comment.outputs.comment-body }}" != "/release-odh" ]; then
echo "Please add /release-odh comment while closing the pr"
exit 1
fi
shell: bash
- name: Get release data
uses: peter-evans/find-comment@v3
id: release-data
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: "#Release#"
- name: Set version/tracker-url in env
run: |
echo "VERSION=$(echo "${{ steps.release-data.outputs.comment-body }}" | awk -F= '$1 ~ /version$/{print $2}')" >> $GITHUB_ENV
echo "TRACKER_URL=$(echo "${{ steps.release-data.outputs.comment-body }}" | awk -F= '$1 ~ /tracker-url$/{print $2}')" >> $GITHUB_ENV
- name: Push version tag to quay.io
run: |
skopeo login -u ${{ secrets.QUAY_ID }} -p ${{ secrets.QUAY_TOKEN }} quay.io
skopeo copy docker://quay.io/${{ secrets.QUAY_ORG }}/opendatahub-operator:pr-${{ github.event.pull_request.number }} docker://quay.io/${{ secrets.QUAY_ORG }}/opendatahub-operator:v${{ env.VERSION }}
echo "Successfully updated tag to quay.io with version: v${{ env.VERSION }}"
- uses: actions/checkout@v4
- name: Create version update pr in incubation
uses: ./.github/actions/update-release-version
with:
version: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update version to ${{ env.VERSION }}"
title: "Update version to ${{ env.VERSION }}"
branch-name: "odh-release/version-update"
base-branch: incubation
- 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: Create release pr in release branch
uses: ./.github/actions/update-release-version
id: cpr-release-pr
with:
version: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "ODH Release ${{ env.VERSION }}"
title: "ODH Release ${{ env.VERSION }}: Version Update"
branch-name: "odh-release/release-branch-update"
base-branch: odh-${{ env.VERSION }}
- 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 }}
:exclamation: DO NOT EDIT THIS COMMENT :exclamation:
pr_number: ${{ steps.cpr-release-pr.outputs.pull-request-number }}

46 changes: 46 additions & 0 deletions .github/workflows/release-e2e-dry-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Release: e2e dry run"
on:
workflow_dispatch:
inputs:
version:
type: string
description: The version to update(https://semver.org/).
required: true
tracker-url:
type: string
description: The URL to tracker issue(https://github.com/opendatahub-io/opendatahub-community/issues).
required: true
permissions:
checks: read
pull-requests: write
contents: write
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
- 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: ${{ secrets.GITHUB_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: 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 }}
:exclamation: DO NOT EDIT THIS COMMENT :exclamation:
pr_number: ${{ steps.cpr-dry-run.outputs.pull-request-number }}

0 comments on commit ace0ead

Please sign in to comment.