From c98c5946c9086d1f93f1d085944c6ff462f6d79c Mon Sep 17 00:00:00 2001 From: Darin Pope Date: Mon, 14 Oct 2024 13:07:22 -0500 Subject: [PATCH 1/4] update CONTRIBUTING --- CONTRIBUTING.md | 223 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 222 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d685acdc1..55ee2843e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,8 +44,12 @@ In the worst case, such plugins can be excluded from the managed set. ## How to add a new plugin Insert a new `dependency` in _sorted_ order to `bom-weekly/pom.xml`. + +[!TIP] +You can use `mvn spotless:apply` to sort the pom.xmls. + Make sure it is used (perhaps transitively) in `sample-plugin/pom.xml`. -Ideally also update the sample plugin’s tests to actually exercise it, +Ideally, also update the sample plugin’s tests to actually exercise it, as a sanity check. Avoid adding transitive dependencies to `sample-plugin/pom.xml`. It is supposed @@ -102,6 +106,7 @@ if you have switched the version in `bom-weekly/pom.xml` to a `*-SNAPSHOT`. To minimize cloud resources, PCT is not run at all by default on pull requests, only some basic sanity checks. Add the label `full-test` to run PCT in a PR. + If you lack triage permission and so cannot add this label, then you may instead ```bash @@ -159,3 +164,219 @@ This repository uses Dependabot to be notified automatically of available update (It is not currently possible for Jenkins core updates to be tracked this way.) Release Drafter is also used to prepare changelogs for the releases page. + +## A week in the life of a BOM maintainer + +A BOM maintainer is typically in charge of BOM maintenance for 2 weeks. + +Typically as a BOM maintainer, you'll be working directly with the `jenkinsci/bom` repository. Said differently, think hard before using your fork of the `bom` repository. + +### Task handling + +#### Dependabot created PRs + +This will probably be the majority of work you'll do. + +In a perfect world, a Dependabot PR will just auto-merge into `master` and you won't have to do anything. + +In a not so perfect world, a Dependabot PR will fail to build. Most of the time, it's because a plugin is too new for older LTS lines. The way you'll resolve this issue is to pin the older version to the correct LTS line. + +[!TIP] +If you do have to do work on a PR, make sure to assign the PR to yourself so others can see that you are actively looking at the PR. + +#### Manually created PRs + +When there is a manually generated PR, there's probably a pretty good chance as a BOM maintainer you won't have to do anything. The person opening the PR should open the PR as `draft`. As a BOM maintainer, feel free to look at a `draft` PR, but don't spend much time on it. + +However, if the person reaches out for help, be sure to help them. + +### Day of week tasks + +#### Friday (BOM release day) + +* run `bom-lock-master issueId` +* verify that job started +* run `bom-job-running issueId buildNumber` +* wait for build to make it through the `prep` stag then (typically) take a 1.5-2 hr break +* [LOOP] if there are any failures, fix until everything is successful +* run `bom-release-issue-add-release-comment issueId releaseNumber` +* run `bom-unlock-master issueId` +* edit the auto-generated release notes + * remove `` + * remove `
` + * remove `XYZ changes` + * remove `
` +* run `bom-release-issue-close issueId` + +#### Saturday/Sunday/Monday + +* business as usual tasks + +#### Tuesday (full test day) + +* TODO: add the Tuesday tasks + +#### Wednesday + +* business as usual tasks + +#### Thursday (Prep for BOM release) + +* run `bom-release-issue-create yyyy-MM-dd` +* on the newly created issue, set `Type` to `Task` +* Locally run tests for `warnings-ng` for all current LINEs and weekly (`bom-test-all-lines warnings-ng`) + +## Using `gh` CLI + +As someone that is "on-call" for managing BOM, there are a few helpful aliases/scripts that you can create to make your life easier. + +### Pre-requisites + +These aliases use `git` and `gh`. If you haven't installed `gh` yet, do that and go ahead and login using: + +`gh auth login` + +### `bom-lock-master` + +```bash +function bom-lock-master { + cd $HOME/github/bom + git checkout master + git pull + gh api \ + /repos/jenkinsci/bom/branches/master/protection \ + --method PUT \ + --header "Accept: application/vnd.github+json" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + -F "lock_branch=true" \ + -F "enforce_admins=false" \ + -F "required_pull_request_reviews=null" \ + -F "required_status_checks[strict]=false" \ + -f "required_status_checks[contexts][]=Jenkins" \ + -F "restrictions=null" \ + --silent + + updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Lock/[x] Lock/') + gh issue edit $1 --body $updatedBody + bom-get-branch-protection +} +``` + +### `bom-unlock-master` + +```bash +function bom-unlock-master { + cd $HOME/github/bom + git checkout master + git pull + gh api \ + /repos/jenkinsci/bom/branches/master/protection \ + --method PUT \ + --header "Accept: application/vnd.github+json" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + -F "lock_branch=false" \ + -F "enforce_admins=false" \ + -F "required_pull_request_reviews=null" \ + -F "required_status_checks[strict]=false" \ + -f "required_status_checks[contexts][]=Jenkins" \ + -F "restrictions=null" \ + --silent + + updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Unlock/[x] Unlock/') + gh issue edit $1 --body $updatedBody + bom-get-branch-protection +} +``` + +### `bom-get-branch-protection` + +```bash +function bom-get-branch-protection { + cd $HOME/github/bom + git checkout master + git pull + gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/jenkinsci/bom/branches/master/protection \ + --jq ".lock_branch" +} +``` + +### `bom-release-issue-create` + +```bash +function bom-release-issue-create { + cd $HOME/github/bom + git checkout master + git pull + bodyValue=$(cat $HOME/github/myzsh/bom-release-issue-template.md) + issueNumber=$(gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/jenkinsci/bom/issues \ + -f "title=[RELEASE] New release for $1" \ + -f "body=$bodyValue" \ + -f "assignees[]=darinpope" \ + --jq ".number") + echo $issueNumber + gh issue pin $issueNumber +} +``` + +### `bom-release-issue-add-release-comment` + +```bash +function bom-release-issue-add-release-comment { + cd $HOME/github/bom + git checkout master + git pull + gh issue comment $1 --body "New release: [https://github.com/jenkinsci/bom/releases/tag/$2](https://github.com/jenkinsci/bom/releases/tag/$2)" +} +``` + +### `bom-release-issue-job-running` + +```bash +function bom-release-issue-job-running { + cd $HOME/github/bom + git checkout master + git pull + updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Trigger/[x] Trigger/' | sed "s/BUILDNUMBER/$2/") + gh issue edit $1 --body $updatedBody +} +``` + +### `bom-release-issue-close` + +```bash +function bom-release-issue-close { + cd $HOME/github/bom + git checkout master + git pull + gh issue unpin $1 + gh issue close $1 +} +``` + +### `bom-line-test` + +```bash +function bom-line-test { + cd $HOME/github/bom + LINE=$1 PLUGINS=$2 TEST=InjectedTest bash local-test.sh +} +``` + +### `bom-test-all-lines` + +```bash +function bom-test-all-lines { + bom-line-test weekly $1 + bom-line-test 2.479.x $1 + bom-line-test 2.462.x $1 + bom-line-test 2.452.x $1 +} +``` + From 1d221353230a393815819d1f211d7a04d149672c Mon Sep 17 00:00:00 2001 From: Darin Pope Date: Mon, 14 Oct 2024 13:58:24 -0500 Subject: [PATCH 2/4] dependabot info --- CONTRIBUTING.md | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 55ee2843e..3e699d6d5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -184,6 +184,14 @@ In a not so perfect world, a Dependabot PR will fail to build. Most of the time, [!TIP] If you do have to do work on a PR, make sure to assign the PR to yourself so others can see that you are actively looking at the PR. +The easiest way to work on the PR is to use the `gh` CLI to checkout the PR: + +* `gh pr checkout ` + +Then you can work on the PR. Once done, push your changes back to the PR. If everything is successful, the PR will auto-merge. At this point, you can delete the local branch: + +* `git branch -D ` + #### Manually created PRs When there is a manually generated PR, there's probably a pretty good chance as a BOM maintainer you won't have to do anything. The person opening the PR should open the PR as `draft`. As a BOM maintainer, feel free to look at a `draft` PR, but don't spend much time on it. @@ -194,13 +202,13 @@ However, if the person reaches out for help, be sure to help them. #### Friday (BOM release day) -* run `bom-lock-master issueId` -* verify that job started -* run `bom-job-running issueId buildNumber` +* run `bom-lock-master ` where `` is the issue that you created on Thursday +* verify that job started at [ci.jenkins.io](https://ci.jenkins.io/job/Tools/job/bom/view/change-requests/) +* run `bom-job-running ` * wait for build to make it through the `prep` stag then (typically) take a 1.5-2 hr break * [LOOP] if there are any failures, fix until everything is successful -* run `bom-release-issue-add-release-comment issueId releaseNumber` -* run `bom-unlock-master issueId` +* run `bom-release-issue-add-release-comment ` +* run `bom-unlock-master ` * edit the auto-generated release notes * remove `` * remove `
` @@ -236,6 +244,23 @@ These aliases use `git` and `gh`. If you haven't installed `gh` yet, do that and `gh auth login` +You'll answer the questions: + +* Where do you use GitHub? + * GitHub.com +* What is your preferred protocol for Git operations on this host? + * HTTPS +* Authenticate Git with your GitHub credentials? + * Y +* How would you like to authenticate GitHub CLI? + * Login with a web browser +* Copy your one time code from the command line then press Enter +* Depending on if you are already logged into GitHub with the browser that opened, you may have a few different steps. Eventually, you should get to a "Device Activation" screen. Click on the "Continue" button beside your avatar. +* Enter the code you copied from the command line and click Continue +* Now you'll be on the "Authorize GitHub CLI" screen. Click on the "Authorize github" button at the bottom of the page. + * You may be asked to confirm access in various forms. Just follow the instructions. +* Once you complete the web login, look back at your command prompt. You should see that the login process has completed. + ### `bom-lock-master` ```bash From 78562ce284b9a568191fc4735e4be905e049cea5 Mon Sep 17 00:00:00 2001 From: Darin Pope Date: Wed, 16 Oct 2024 08:56:28 -0500 Subject: [PATCH 3/4] next big pass of content --- CONTRIBUTING.md | 214 ++++++------------ .../bom-get-branch-protection.sh | 8 + release-manager-scripts/bom-line-test.sh | 9 + release-manager-scripts/bom-lock-master.sh | 26 +++ .../bom-release-issue-add-release-comment.sh | 12 + .../bom-release-issue-close.sh | 12 + .../bom-release-issue-create.sh | 32 +++ .../bom-release-issue-job-running.sh | 12 + release-manager-scripts/bom-test-all-lines.sh | 12 + release-manager-scripts/bom-unlock-master.sh | 26 +++ 10 files changed, 213 insertions(+), 150 deletions(-) create mode 100755 release-manager-scripts/bom-get-branch-protection.sh create mode 100755 release-manager-scripts/bom-line-test.sh create mode 100755 release-manager-scripts/bom-lock-master.sh create mode 100755 release-manager-scripts/bom-release-issue-add-release-comment.sh create mode 100755 release-manager-scripts/bom-release-issue-close.sh create mode 100755 release-manager-scripts/bom-release-issue-create.sh create mode 100755 release-manager-scripts/bom-release-issue-job-running.sh create mode 100755 release-manager-scripts/bom-test-all-lines.sh create mode 100755 release-manager-scripts/bom-unlock-master.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e699d6d5..0026c0621 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -165,11 +165,11 @@ This repository uses Dependabot to be notified automatically of available update Release Drafter is also used to prepare changelogs for the releases page. -## A week in the life of a BOM maintainer +## A week in the life of a BOM release manager -A BOM maintainer is typically in charge of BOM maintenance for 2 weeks. +A BOM release manager is in charge of BOM releases for 2 weeks. -Typically as a BOM maintainer, you'll be working directly with the `jenkinsci/bom` repository. Said differently, think hard before using your fork of the `bom` repository. +As a BOM release manager, you'll be working directly with the `jenkinsci/bom` repository. Said differently, think hard before using your fork of the `bom` repository. ### Task handling @@ -194,53 +194,66 @@ Then you can work on the PR. Once done, push your changes back to the PR. If eve #### Manually created PRs -When there is a manually generated PR, there's probably a pretty good chance as a BOM maintainer you won't have to do anything. The person opening the PR should open the PR as `draft`. As a BOM maintainer, feel free to look at a `draft` PR, but don't spend much time on it. +When there is a manually generated PR, there's probably a pretty good chance as the BOM release manager you won't have to do anything. The person opening the PR should open the PR as `draft`. As a BOM release manager, feel free to look at a `draft` PR, but don't spend much time on it. -However, if the person reaches out for help, be sure to help them. +On the other hand, if the person reaches out for help, be sure to help them. ### Day of week tasks +#### Thursday (Prep for BOM release) + +* run `./bom-release-issue-create.sh ` +* on the newly created issue, manually set `Type` to `Task` + * at the time of writing (2024-10-14), there is no `gh` option to set the Type +* Locally run tests for `warnings-ng` for all current LINEs and weekly + * `bom-test-all-lines warnings-ng` + #### Friday (BOM release day) -* run `bom-lock-master ` where `` is the issue that you created on Thursday +* run `./bom-lock-master.sh ` + * where `` is the issue that you created on Thursday * verify that job started at [ci.jenkins.io](https://ci.jenkins.io/job/Tools/job/bom/view/change-requests/) -* run `bom-job-running ` -* wait for build to make it through the `prep` stag then (typically) take a 1.5-2 hr break +* run `./bom-release-issue-job-running.sh ` +* wait for build to make it through the `prep` stage then (typically) take a 1.5-2 hr break * [LOOP] if there are any failures, fix until everything is successful -* run `bom-release-issue-add-release-comment ` -* run `bom-unlock-master ` +* run `./bom-release-issue-add-release-comment.sh ` +* run `./bom-unlock-master.sh ` * edit the auto-generated release notes * remove `` * remove `
` * remove `XYZ changes` * remove `
` -* run `bom-release-issue-close issueId` +* run `./bom-release-issue-close.sh ` #### Saturday/Sunday/Monday * business as usual tasks -#### Tuesday (full test day) - -* TODO: add the Tuesday tasks +#### Tuesday (test the new weekly) + +* run the Dependabot dependency graph checks + * open [Dependency graph for sample-plugin/pom.xml](https://github.com/jenkinsci/bom/network/updates/5427365/jobs) + * click on "Check for updates" button in upper right hand corner of table + * open [Dependency graph for bom-weekly/pom.xml](https://github.com/jenkinsci/bom/network/updates/10189727/jobs) + * click on "Check for updates" button in upper right hand corner of table +* wait for both of the Dependabot dependency graph checks to complete +* check to see if any new dependabot PRs were opened. If there were, make sure they clear and merge before continuing. +* Open the pinned [Dependency Dashboard](https://github.com/jenkinsci/bom/issues/2500) issue +* Once the weekly build has completed, you will see a line that says "Update dependency org.jenkins-ci.main:jenkins-war to v2.`XYZ`", where `XYZ` is the weekly build number. Click the checkbox next to that line to start the full test. +* Once the box is checked, a new PR will be created by renovate named "Update dependency org.jenkins-ci.main:jenkins-war to v2.`XYZ`" where `XYZ` is the weekly build number. This will fire off a full `weekly` build that will take about 1.5-2 hours to complete. +* If everything succeeds, the PR will auto-merge and the line from the Dependency Dashboard will be removed. #### Wednesday * business as usual tasks -#### Thursday (Prep for BOM release) - -* run `bom-release-issue-create yyyy-MM-dd` -* on the newly created issue, set `Type` to `Task` -* Locally run tests for `warnings-ng` for all current LINEs and weekly (`bom-test-all-lines warnings-ng`) - ## Using `gh` CLI As someone that is "on-call" for managing BOM, there are a few helpful aliases/scripts that you can create to make your life easier. ### Pre-requisites -These aliases use `git` and `gh`. If you haven't installed `gh` yet, do that and go ahead and login using: +These aliases use `git`, `sed` and `gh`. If you haven't installed `gh` yet, do that and go ahead and login using: `gh auth login` @@ -254,154 +267,55 @@ You'll answer the questions: * Y * How would you like to authenticate GitHub CLI? * Login with a web browser -* Copy your one time code from the command line then press Enter -* Depending on if you are already logged into GitHub with the browser that opened, you may have a few different steps. Eventually, you should get to a "Device Activation" screen. Click on the "Continue" button beside your avatar. -* Enter the code you copied from the command line and click Continue +* Copy your one time code from the command line then press `Enter` +* Depending on if you are already logged into GitHub with the browser that opened, you may have a few different steps. Eventually, you should get to a "Device Activation" screen. Click on the `Continue` button beside your avatar. +* Enter the code you copied from the command line and click `Continue` * Now you'll be on the "Authorize GitHub CLI" screen. Click on the "Authorize github" button at the bottom of the page. * You may be asked to confirm access in various forms. Just follow the instructions. * Once you complete the web login, look back at your command prompt. You should see that the login process has completed. -### `bom-lock-master` +Once you are logged in, you can use the scripts in `release-manager-scripts`. -```bash -function bom-lock-master { - cd $HOME/github/bom - git checkout master - git pull - gh api \ - /repos/jenkinsci/bom/branches/master/protection \ - --method PUT \ - --header "Accept: application/vnd.github+json" \ - --header "X-GitHub-Api-Version: 2022-11-28" \ - -F "lock_branch=true" \ - -F "enforce_admins=false" \ - -F "required_pull_request_reviews=null" \ - -F "required_status_checks[strict]=false" \ - -f "required_status_checks[contexts][]=Jenkins" \ - -F "restrictions=null" \ - --silent - - updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Lock/[x] Lock/') - gh issue edit $1 --body $updatedBody - bom-get-branch-protection -} -``` +### Scripts -### `bom-unlock-master` +#### bom-release-issue-create.sh -```bash -function bom-unlock-master { - cd $HOME/github/bom - git checkout master - git pull - gh api \ - /repos/jenkinsci/bom/branches/master/protection \ - --method PUT \ - --header "Accept: application/vnd.github+json" \ - --header "X-GitHub-Api-Version: 2022-11-28" \ - -F "lock_branch=false" \ - -F "enforce_admins=false" \ - -F "required_pull_request_reviews=null" \ - -F "required_status_checks[strict]=false" \ - -f "required_status_checks[contexts][]=Jenkins" \ - -F "restrictions=null" \ - --silent - - updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Unlock/[x] Unlock/') - gh issue edit $1 --body $updatedBody - bom-get-branch-protection -} -``` +This script creates the boilerplate GitHub issue for the weekly BOM release, as well as pinning the issue. -### `bom-get-branch-protection` +#### bom-release-issue-job-running.sh -```bash -function bom-get-branch-protection { - cd $HOME/github/bom - git checkout master - git pull - gh api \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/jenkinsci/bom/branches/master/protection \ - --jq ".lock_branch" -} -``` +This script updates the body of the GitHub issue by checking the `Trigger` task item. -### `bom-release-issue-create` +#### bom-release-issue-add-release-comment.sh -```bash -function bom-release-issue-create { - cd $HOME/github/bom - git checkout master - git pull - bodyValue=$(cat $HOME/github/myzsh/bom-release-issue-template.md) - issueNumber=$(gh api \ - --method POST \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/jenkinsci/bom/issues \ - -f "title=[RELEASE] New release for $1" \ - -f "body=$bodyValue" \ - -f "assignees[]=darinpope" \ - --jq ".number") - echo $issueNumber - gh issue pin $issueNumber -} -``` +This script adds a comment to the GitHub issue with the latest release number. -### `bom-release-issue-add-release-comment` +#### bom-release-issue-close.sh -```bash -function bom-release-issue-add-release-comment { - cd $HOME/github/bom - git checkout master - git pull - gh issue comment $1 --body "New release: [https://github.com/jenkinsci/bom/releases/tag/$2](https://github.com/jenkinsci/bom/releases/tag/$2)" -} -``` +This script unpins and closes the GitHub issue. -### `bom-release-issue-job-running` +#### bom-lock-master.sh -```bash -function bom-release-issue-job-running { - cd $HOME/github/bom - git checkout master - git pull - updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Trigger/[x] Trigger/' | sed "s/BUILDNUMBER/$2/") - gh issue edit $1 --body $updatedBody -} -``` +This script: -### `bom-release-issue-close` +* locks the `master` branch +* updates the GitHub issue body by checking the `Lock branch` task item. -```bash -function bom-release-issue-close { - cd $HOME/github/bom - git checkout master - git pull - gh issue unpin $1 - gh issue close $1 -} -``` +#### bom-unlock-master.sh -### `bom-line-test` +This script: -```bash -function bom-line-test { - cd $HOME/github/bom - LINE=$1 PLUGINS=$2 TEST=InjectedTest bash local-test.sh -} -``` +* unlocks the `master` branch +* updates the GitHub issue body by checking the `Unlock branch` task item. -### `bom-test-all-lines` +#### bom-get-branch-protection.sh -```bash -function bom-test-all-lines { - bom-line-test weekly $1 - bom-line-test 2.479.x $1 - bom-line-test 2.462.x $1 - bom-line-test 2.452.x $1 -} -``` +This script returns the lock state of the `master` branch. + +#### bom-line-test.sh + +This is a helper script to test a plugin against a specific Jenkins line. + +#### bom-test-all-lines.sh +This is a helper script that calls `bom-line-test.sh` for all active Jenkins lines. diff --git a/release-manager-scripts/bom-get-branch-protection.sh b/release-manager-scripts/bom-get-branch-protection.sh new file mode 100755 index 000000000..8b6c352d4 --- /dev/null +++ b/release-manager-scripts/bom-get-branch-protection.sh @@ -0,0 +1,8 @@ +#!/bin/bash +git checkout master +git pull +gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/jenkinsci/bom/branches/master/protection \ + --jq ".lock_branch" diff --git a/release-manager-scripts/bom-line-test.sh b/release-manager-scripts/bom-line-test.sh new file mode 100755 index 000000000..9ad1830fc --- /dev/null +++ b/release-manager-scripts/bom-line-test.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ $# -ne 2 ]; then + echo "Error: This script requires exactly two arguments." + echo "./bom-line-test.sh + exit 1 +fi + +LINE=$1 PLUGINS=$2 TEST=InjectedTest bash ../local-test.sh \ No newline at end of file diff --git a/release-manager-scripts/bom-lock-master.sh b/release-manager-scripts/bom-lock-master.sh new file mode 100755 index 000000000..07aff604d --- /dev/null +++ b/release-manager-scripts/bom-lock-master.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + echo "Error: This script requires exactly one argument." + echo "./bom-lock-master.sh + exit 1 +fi + +git checkout master +git pull +gh api \ + /repos/jenkinsci/bom/branches/master/protection \ + --method PUT \ + --header "Accept: application/vnd.github+json" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + -F "lock_branch=true" \ + -F "enforce_admins=false" \ + -F "required_pull_request_reviews=null" \ + -F "required_status_checks[strict]=false" \ + -f "required_status_checks[contexts][]=Jenkins" \ + -F "restrictions=null" \ + --silent + +updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Lock/[x] Lock/') +gh issue edit $1 --body $updatedBody +./bom-get-branch-protection.sh diff --git a/release-manager-scripts/bom-release-issue-add-release-comment.sh b/release-manager-scripts/bom-release-issue-add-release-comment.sh new file mode 100755 index 000000000..9f14bae03 --- /dev/null +++ b/release-manager-scripts/bom-release-issue-add-release-comment.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + echo "Error: This script requires exactly one argument." + echo "./bom-release-issue-add-release-comment.sh + exit 1 +fi + +git checkout master +git pull +releaseName=$(gh release list --limit 1 --json isLatest,name --jq ".[].name") +gh issue comment $1 --body "New release: [https://github.com/jenkinsci/bom/releases/tag/$releaseName](https://github.com/jenkinsci/bom/releases/tag/$releaseName)" \ No newline at end of file diff --git a/release-manager-scripts/bom-release-issue-close.sh b/release-manager-scripts/bom-release-issue-close.sh new file mode 100755 index 000000000..ceab93ac5 --- /dev/null +++ b/release-manager-scripts/bom-release-issue-close.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + echo "Error: This script requires exactly one argument." + echo "./bom-release-issue-close.sh + exit 1 +fi + +git checkout master +git pull +gh issue unpin $1 +gh issue close $1 \ No newline at end of file diff --git a/release-manager-scripts/bom-release-issue-create.sh b/release-manager-scripts/bom-release-issue-create.sh new file mode 100755 index 000000000..46b056bdb --- /dev/null +++ b/release-manager-scripts/bom-release-issue-create.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +if [ $# -ne 2 ]; then + echo "Error: This script requires exactly two arguments." + echo "./bom-release-issue-create.sh + exit 1 +fi + +git checkout master +git pull +releaseManager=$2 +bodyValue=$(cat <<-EOM +A new release is being scheduled. +Release manager: @$2 + +# Release progress +- [ ] Lock primary branch +- [ ] Trigger [Jenkins build](https://ci.jenkins.io/job/Tools/job/bom/job/master/BUILDNUMBER/) +- [ ] Unlock primary branch +EOM +) +issueNumber=$(gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/jenkinsci/bom/issues \ + -f "title=[RELEASE] New release for $1" \ + -f "body=$bodyValue" \ + -f "assignees[]=$2" \ + --jq ".number") +echo $issueNumber +gh issue pin $issueNumber \ No newline at end of file diff --git a/release-manager-scripts/bom-release-issue-job-running.sh b/release-manager-scripts/bom-release-issue-job-running.sh new file mode 100755 index 000000000..125bfbffd --- /dev/null +++ b/release-manager-scripts/bom-release-issue-job-running.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ $# -ne 2 ]; then + echo "Error: This script requires exactly two arguments." + echo "./bom-release-issue-job-running.sh + exit 1 +fi + +git checkout master +git pull +updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Trigger/[x] Trigger/' | sed "s/BUILDNUMBER/$2/") +gh issue edit $1 --body $updatedBody \ No newline at end of file diff --git a/release-manager-scripts/bom-test-all-lines.sh b/release-manager-scripts/bom-test-all-lines.sh new file mode 100755 index 000000000..3335b19ac --- /dev/null +++ b/release-manager-scripts/bom-test-all-lines.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + echo "Error: This script requires exactly one argument." + echo "./bom-test-all-lines.sh + exit 1 +fi + +./bom-line-test.sh weekly $1 +./bom-line-test.sh 2.479.x $1 +./bom-line-test.sh 2.462.x $1 +./bom-line-test.sh 2.452.x $1 \ No newline at end of file diff --git a/release-manager-scripts/bom-unlock-master.sh b/release-manager-scripts/bom-unlock-master.sh new file mode 100755 index 000000000..f41072c40 --- /dev/null +++ b/release-manager-scripts/bom-unlock-master.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + echo "Error: This script requires exactly one argument." + echo "./bom-unlock-master.sh + exit 1 +fi + +git checkout master +git pull +gh api \ + /repos/jenkinsci/bom/branches/master/protection \ + --method PUT \ + --header "Accept: application/vnd.github+json" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + -F "lock_branch=false" \ + -F "enforce_admins=false" \ + -F "required_pull_request_reviews=null" \ + -F "required_status_checks[strict]=false" \ + -f "required_status_checks[contexts][]=Jenkins" \ + -F "restrictions=null" \ + --silent + +updatedBody=$(gh issue view $1 --json body --jq ".body" | sed 's/\[\ \] Unlock/[x] Unlock/') +gh issue edit $1 --body $updatedBody +./bom-get-branch-protection.sh From 040f969a7c9b2c3e3ff1f11acf3671a6f8c00222 Mon Sep 17 00:00:00 2001 From: Darin Pope Date: Wed, 16 Oct 2024 11:03:21 -0500 Subject: [PATCH 4/4] more context --- CONTRIBUTING.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0026c0621..bc3880aac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -200,30 +200,40 @@ On the other hand, if the person reaches out for help, be sure to help them. ### Day of week tasks +This section goes over the expectations and work items for the BOM release manager during their on-call cycle. + +The scripts that are referenced are in the `release-manager-scripts` directory. Open a terminal and `cd` to that directory before running the scripts. + #### Thursday (Prep for BOM release) * run `./bom-release-issue-create.sh ` + * Example: `./bom-release-issue-create.sh 2024-10-14` * on the newly created issue, manually set `Type` to `Task` * at the time of writing (2024-10-14), there is no `gh` option to set the Type * Locally run tests for `warnings-ng` for all current LINEs and weekly - * `bom-test-all-lines warnings-ng` + * `./bom-test-all-lines.sh warnings-ng` #### Friday (BOM release day) * run `./bom-lock-master.sh ` * where `` is the issue that you created on Thursday + * Example: `./bom-lock-master.sh 3220` * verify that job started at [ci.jenkins.io](https://ci.jenkins.io/job/Tools/job/bom/view/change-requests/) * run `./bom-release-issue-job-running.sh ` + * Example: `./bom-release-issue-job-running.sh 3220 3789` * wait for build to make it through the `prep` stage then (typically) take a 1.5-2 hr break * [LOOP] if there are any failures, fix until everything is successful -* run `./bom-release-issue-add-release-comment.sh ` +* run `./bom-release-issue-add-release-comment.sh ` + * Example: `./bom-release-issue-add-release-comment.sh 3220` * run `./bom-unlock-master.sh ` -* edit the auto-generated release notes + * Example: `./bom-unlock-master.sh 3220` +* manually edit the auto-generated release notes * remove `` * remove `
` * remove `XYZ changes` * remove `
` * run `./bom-release-issue-close.sh ` + * Example: `./bom-release-issue-close.sh 3220` #### Saturday/Sunday/Monday