-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathinit-lts-line
executable file
·60 lines (46 loc) · 1.96 KB
/
init-lts-line
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -euo pipefail
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
if [ $# -ne 1 ]; then
echo "Usage: $1 <baseline_version>" >&2
exit 1
fi
baseline=$1
# Make tagged commit part of the release branch
branch_name="stable-${baseline}"
# Use first child of release commit as branch point (`[maven-release-plugin] prepare for next development iteration`)
git checkout -b $branch_name $(git log --reverse --ancestry-path --pretty=%H jenkins-${baseline}..master | head -1)
# Update versions
mvn -q versions:set-property -Dproperty=revision -DnewVersion=${baseline}.1
echo -Plts-release >> .mvn/maven.config
echo "$branch_name" > packaging-ref.txt
git add pom.xml .mvn/maven.config packaging-ref.txt
git commit -m "Towards ${baseline}.1"
# Create dedicated packaging branch
packaging="$(mktemp -d /tmp/jenkins-lts-rc-packaging-XXXXXXXX)"
trap "rm -rf '$packaging'" EXIT
git clone [email protected]:jenkinsci/packaging.git "$packaging"
pushd "$packaging"
git checkout -b "$branch_name" master
git push -u origin "$branch_name"
popd
remote_name="$(git remote -v | awk '$2 == "[email protected]:jenkinsci/jenkins.git" && $3 == "(push)" {print $1}')"
cat <<EOF
Remember to:
Push the branch
$ git push --set-upstream ${remote_name} ${branch_name}
EOF
# Modify release profiles
release_repo="$(mktemp -d /tmp/jenkins-lts-rc-release-XXXXXXXX)"
trap "rm -rf '$release_repo'" EXIT
git clone [email protected]:jenkins-infra/release.git "$release_repo"
pushd "$release_repo"
git checkout -b "stable-${baseline}"
sed -i'' -e "s/PACKAGING_GIT_BRANCH = 'master'/PACKAGING_GIT_BRANCH = 'stable-${baseline}'/g" Jenkinsfile.d/core/package
sed -i'' -e "s/RELEASE_GIT_BRANCH=master/RELEASE_GIT_BRANCH=stable-${baseline}/g" profile.d/stable
echo "JENKINS_VERSION=${baseline}.1" >> profile.d/stable
git add Jenkinsfile.d/core/package profile.d/stable
git commit -m "Initiate ${baseline}.1"
git push origin "stable-${baseline}"
rm -f Jenkinsfile.d/core/package.bak
popd