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 all commits
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
16 changes: 12 additions & 4 deletions .github/scripts/get-component-release-notes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
function getModifiedComponentName(name){
let modifiedWord = name.split("-").join(" ")
modifiedWord = modifiedWord[0].toUpperCase() + modifiedWord.slice(1).toLowerCase()
return modifiedWord.replace("Odh", "ODH")
}
module.exports = ({ github, core }) => {
const { TRACKER_URL } = process.env
console.log(`The TRACKER_URL is ${TRACKER_URL}`)
Expand All @@ -17,16 +22,19 @@ module.exports = ({ github, core }) => {
}).then((result) => {
let outputStr = "## Component Release Notes\n"
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()
const releaseNotesUrl = (tagUrl || branchUrl).trim();
outputStr += `- **${getModifiedComponentName(componentName)}**: ${releaseNotesUrl}\n`

}
})
}
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