Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Rework release automation - || #1199

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 57 additions & 4 deletions .github/scripts/get-component-release-notes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@

function getComponentName(name){
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
switch(name){
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
case "codeflare":
return "Codeflare"
case "ray":
return "Ray"
case "kueue":
return "Kueue"
case "data-science-pipelines-operator":
return "Datascience Pipelines"
case "odh-dashboard":
return "Dashboard"
case "notebook-controller":
return "Notebook controller"
case "notebooks":
return "Notebooks"
case "trustyai":
return "TrustyAI"
case "model-mesh":
return "Model mesh"
case "odh-model-controller":
return "ODH Model Controller"
case "kserve":
return "Kserve"
case "modelregistry":
return "Model Registry"
case "trainingoperator":
return "Training operator"
default:
return null
}
}

module.exports = ({ github, core }) => {
const { TRACKER_URL } = process.env
console.log(`The TRACKER_URL is ${TRACKER_URL}`)
Expand All @@ -16,21 +50,40 @@ module.exports = ({ github, core }) => {
}
}).then((result) => {
let outputStr = "## Component Release Notes\n"
let servingComponents = '- **Serving**\n\t'
let distributedWorkloadComponents = '- **Distributed Workloads**\n\t'
let workbenchComponents= '- **Workbench**\n\t'
result.data.forEach((issue) => {
issueCommentBody = issue.body_text
let issueCommentBody = issue.body_text
if (issueCommentBody.includes("#Release#")) {
let components = issueCommentBody.split("\n")
const releaseIdx = components.indexOf("#Release#")
components = components.splice(releaseIdx + 1, components.length)
const regex = /\s*[A-Za-z-_0-9]+\s*\|\s*(https:\/\/github\.com\/.*tree.*){1}\s*\|\s*(https:\/\/github\.com\/.*releases.*){1}\s*/;
const regex = /\s*[A-Za-z-_0-9]+\s*\|\s*(https:\/\/github\.com\/.*(tree|releases).*){1}\s*\|?\s*(https:\/\/github\.com\/.*releases.*)?\s*/;
components.forEach(component => {
if (regex.test(component)) {
const [componentName, branchUrl, tagUrl] = component.split("|")
outputStr += `- **${componentName.trim().charAt(0).toUpperCase() + componentName.trim().slice(1)}**: ${tagUrl.trim()}\n`
let [componentName, branchUrl, tagUrl] = component.split("|")
componentName = componentName.trim()
let releaseNotesUrl = tagUrl
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
if(!releaseNotesUrl){
releaseNotesUrl = branchUrl
}
releaseNotesUrl = releaseNotesUrl.trim()
if(["model-mesh", "kserve","odh-model-controller"].includes(componentName)){
servingComponents+=` - ${getComponentName(componentName)}: ${releaseNotesUrl}\n\t`
}else if(["codeflare", "ray", "kueue", "trainingoperator"].includes(componentName)){
distributedWorkloadComponents+=` - ${getComponentName(componentName)}: ${releaseNotesUrl}\n\t`
}else if(["notebooks", "notebook-controller"].includes(componentName)){
workbenchComponents+=` - ${getComponentName(componentName)}: ${releaseNotesUrl}\n\t`
}else{
outputStr+= getComponentName(componentName)?`- **${getComponentName(componentName)}**: ${releaseNotesUrl}\n`:""
}

}
})
}
})
outputStr+=servingComponents.slice(0,-1)+distributedWorkloadComponents.slice(0,-1)+workbenchComponents.slice(0,-1)
console.log("Created component release notes successfully...")
core.setOutput('release-notes-body', outputStr);
}).catch(e => {
Expand Down
15 changes: 10 additions & 5 deletions .github/scripts/get-release-branches.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,22 @@ module.exports = ({ github, core }) => {
}
}).then((result) => {
result.data.forEach((issue) => {
issueCommentBody = issue.body_text
let issueCommentBody = issue.body_text
if (issueCommentBody.includes("#Release#")) {
let components = issueCommentBody.split("\n")
const releaseIdx = components.indexOf("#Release#")
components = components.splice(releaseIdx + 1, components.length)
const regex = /\s*[A-Za-z-_0-9]+\s*\|\s*(https:\/\/github\.com\/.*tree.*){1}\s*\|\s*(https:\/\/github\.com\/.*releases.*){1}\s*/;
const regex = /\s*[A-Za-z-_0-9]+\s*\|\s*(https:\/\/github\.com\/.*(tree|releases).*){1}\s*\|?\s*(https:\/\/github\.com\/.*releases.*)?\s*/;
components.forEach(component => {
if (regex.test(component)) {
const [componentName, branchUrl] = component.split("|")
const splitArr = branchUrl.trim().split("/")
const idx = splitArr.indexOf("tree")
const [componentName, branchOrTagUrl] = component.split("|")
const splitArr = branchOrTagUrl.trim().split("/")
let idx = null
if (splitArr.includes("tag")) {
idx = splitArr.indexOf("tag")
} else if (splitArr.includes("tree")) {
idx = splitArr.indexOf("tree")
}
const branchName = splitArr.slice(idx + 1).join("/")
if (componentName.trim() === "notebook-controller") {
core.exportVariable("component_spec_odh-notebook-controller".toLowerCase(), branchName);
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ jobs:
pull-request-number: ${{ steps.cpr-dry-run.outputs.pull-request-number }}
comment: Auto-closing pull request after success checks
delete-branch: true
# Will enable this section once we have conformation from devops if we can use a bot to push tags.
# - name: Push version tag to quay.io
# run: |
# skopeo login -u ${{ secrets.QUAY_ID }} -p ${{ secrets.QUAY_TOKEN }} quay.io/{{ secrets.QUAY_ORG }}
# 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 }}"
- 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
Expand Down Expand Up @@ -80,10 +79,6 @@ jobs:
commit-message: "ODH Release ${{ env.VERSION }}"
title: "ODH Release ${{ env.VERSION }}: Version Update"
branch-name: "odh-release/release-branch-update"
- name: Wait for checks to pass
env:
GH_TOKEN: ${{ secrets.GITHUB_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:
Expand Down
Loading