Skip to content

Commit

Permalink
Format shell scripts consistently in this repository (#3791)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Oct 17, 2024
1 parent 4ecbe6f commit 86f183d
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 81 deletions.
2 changes: 1 addition & 1 deletion local-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else
EXTRA_MAVEN_PROPERTIES=
fi

if [[ "${DOCKERIZED-}" == "true" ]]; then
if [[ ${DOCKERIZED-} == "true" ]]; then
docker volume inspect m2repo || docker volume create m2repo
docker run \
-v ~/.m2:/var/maven/.m2 \
Expand Down
8 changes: 4 additions & 4 deletions release-manager-scripts/bom-get-branch-protection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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"
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/jenkinsci/bom/branches/master/protection \
--jq ".lock_branch"
10 changes: 5 additions & 5 deletions release-manager-scripts/bom-line-test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

if [ $# -ne 2 ]; then
echo "Error: This script requires exactly two arguments."
echo "./bom-line-test.sh <LINE> <comma separated list of plugins>"
exit 1
if [[ $# -ne 2 ]]; then
echo "Error: This script requires exactly two arguments."
echo "./bom-line-test.sh <LINE> <comma separated list of plugins>"
exit 1
fi

LINE=$1 PLUGINS=$2 TEST=InjectedTest bash ../local-test.sh
LINE=$1 PLUGINS=$2 TEST=InjectedTest bash ../local-test.sh
30 changes: 15 additions & 15 deletions release-manager-scripts/bom-lock-master.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo "Error: This script requires exactly one argument."
echo "./bom-lock-master.sh <GitHub issue id>"
exit 1
if [[ $# -ne 1 ]]; then
echo "Error: This script requires exactly one argument."
echo "./bom-lock-master.sh <GitHub issue id>"
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
/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
Expand Down
10 changes: 5 additions & 5 deletions release-manager-scripts/bom-release-issue-add-release-comment.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo "Error: This script requires exactly one argument."
echo "./bom-release-issue-add-release-comment.sh <GitHub issue id>"
exit 1
if [[ $# -ne 1 ]]; then
echo "Error: This script requires exactly one argument."
echo "./bom-release-issue-add-release-comment.sh <GitHub issue id>"
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)"
gh issue comment $1 --body "New release: [https://github.com/jenkinsci/bom/releases/tag/$releaseName](https://github.com/jenkinsci/bom/releases/tag/$releaseName)"
10 changes: 5 additions & 5 deletions release-manager-scripts/bom-release-issue-close.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo "Error: This script requires exactly one argument."
echo "./bom-release-issue-close.sh <GitHub issue id>"
exit 1
if [[ $# -ne 1 ]]; then
echo "Error: This script requires exactly one argument."
echo "./bom-release-issue-close.sh <GitHub issue id>"
exit 1
fi

git checkout master
git pull
gh issue unpin $1
gh issue close $1
gh issue close $1
43 changes: 22 additions & 21 deletions release-manager-scripts/bom-release-issue-create.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
#!/bin/bash

if [ $# -ne 2 ]; then
echo "Error: This script requires exactly two arguments."
echo "./bom-release-issue-create.sh <yyyy-MM-dd> <GitHub id>"
exit 1
if [[ $# -ne 2 ]]; then
echo "Error: This script requires exactly two arguments."
echo "./bom-release-issue-create.sh <yyyy-MM-dd> <GitHub id>"
exit 1
fi

git checkout master
git pull
releaseManager=$2
bodyValue=$(cat <<-EOM
A new release is being scheduled.
Release manager: @$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
# 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")
--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
gh issue pin $issueNumber
10 changes: 5 additions & 5 deletions release-manager-scripts/bom-release-issue-job-running.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

if [ $# -ne 2 ]; then
echo "Error: This script requires exactly two arguments."
echo "./bom-release-issue-job-running.sh <GitHub issue id> <Jenkins build number>"
exit 1
if [[ $# -ne 2 ]]; then
echo "Error: This script requires exactly two arguments."
echo "./bom-release-issue-job-running.sh <GitHub issue id> <Jenkins build number>"
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
gh issue edit $1 --body $updatedBody
10 changes: 5 additions & 5 deletions release-manager-scripts/bom-test-all-lines.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo "Error: This script requires exactly one argument."
echo "./bom-test-all-lines.sh <comma separated list of plugins>"
exit 1
if [[ $# -ne 1 ]]; then
echo "Error: This script requires exactly one argument."
echo "./bom-test-all-lines.sh <comma separated list of plugins>"
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
./bom-line-test.sh 2.452.x $1
30 changes: 15 additions & 15 deletions release-manager-scripts/bom-unlock-master.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo "Error: This script requires exactly one argument."
echo "./bom-unlock-master.sh <GitHub issue id>"
exit 1
if [[ $# -ne 1 ]]; then
echo "Error: This script requires exactly one argument."
echo "./bom-unlock-master.sh <GitHub issue id>"
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
/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
Expand Down

0 comments on commit 86f183d

Please sign in to comment.