-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmake-release.sh
executable file
·226 lines (185 loc) · 7.63 KB
/
make-release.sh
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#!/bin/bash
# overall Che release orchestration script
# see README.md for more info
REGISTRY="quay.io"
ORGANIZATION="eclipse"
SCRIPTS_DIR=$(cd "$(dirname "$0")"; pwd)
source ${SCRIPTS_DIR}/utils/util.sh
usage ()
{
echo "Usage: $0 --version [CHE VERSION TO RELEASE] --parent-version [CHE PARENT VERSION] --phases [LIST OF PHASES]
# Comma-separated phases to perform.
#1: Code, JetBrainsIdeDevServer, Configbump, MachineExec, Server, devworkspace-generator, createBranches (kubernetes-image-puller);
#2: E2E, PluginRegistry, Dashboard;
#3: Operator;
# Default: 1,2,3
# Omit phases that have successfully run.
"
echo "Example: $0 --version 7.75.0 --phases 1,2,3"; echo
exit 1
}
#################### SETUP ####################
checkForBlockerIssues()
{
# check for blockers only if doing a 7.yy.0 release
if [[ ${CHE_VERSION} == *".0" ]]; then
# If in future we want to find blockers for a given milestone, here's how:
## OPTION 1: gh cli
# BLOCKERS_THIS_MILESTONE="$(gh issue list -R eclipse/che -l "severity/blocker" -s "open" -m "${CHE_VERSION%.*}" --json "createdAt,updatedAt,author,title,url,milestone" | jq -r '.[]')"
## OPTION 2: gh api
# milestone="${CHE_VERSION%.*}"
# 7.39 :: 151
# milestoneID="$(curl -s "https://api.github.com/repos/eclipse/che/milestones?sort_on=due_on&direction=desc&state=open" | jq -r --arg milestone $milestone '.[]|select(.title==$milestone)|.number' 2>&1)"
# BLOCKERS_THIS_MILESTONE="$(curl -s "https://api.github.com/repos/eclipse/che/issues?labels=severity/blocker&state=open&milestone=${milestoneID}" | jq -r '.[]|[.created_at,.updated_at,.milestone.title,.url,.user.login,.title] | @tsv')"
# if [[ $BLOCKERS_THIS_MILESTONE ]]; then
# echo "[ERROR] Blocker issue(s) found for this milestone ${CHE_VERSION%.*}!"
# echo $BLOCKERS_THIS_MILESTONE
# exit 1
# fi
# Mario and Florent would prefer to search for ANY open blockers, including those unassigned to milestones
## OPTION 1: gh cli
# BLOCKERS_ANY="$(gh issue list -R eclipse/che -l "severity/blocker" -s "open" --json "createdAt,updatedAt,author,title,url,milestone" | jq -r '.[]')"
## OPTION 2: gh api
BLOCKERS_ANY="$(curl -s "https://api.github.com/repos/eclipse/che/issues?labels=severity/blocker&state=open" | jq -r '.[]|[.created_at,.updated_at,.milestone.title,.url,.user.login,.title] | @tsv')"
if [[ $BLOCKERS_ANY ]]; then
echo "[ERROR] Blocker issue(s) found!"
echo "$BLOCKERS_ANY"
exit 1
fi
fi
}
setupGitconfig() {
ne else?
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email [email protected]
# hub CLI configuration
git config --global push.default matching
# suppress warnings about how to reconcile divergent branches
git config --global pull.ff only
# NOTE when invoking action from che-incubator/* repos (not eclipse/che* repos), must use CHE_INCUBATOR_BOT_GITHUB_TOKEN
# default to CHE_BOT GH token
export GITHUB_TOKEN="${CHE_BOT_GITHUB_TOKEN}"
}
evaluateCheVariables() {
echo "Che version: ${CHE_VERSION}"
# derive branch from version
BRANCH=${CHE_VERSION%.*}.x
echo "Branch: ${BRANCH}"
if [[ ${CHE_VERSION} == *".0" ]]; then
BASEBRANCH="master"
else
BASEBRANCH="${BRANCH}"
fi
echo "Basebranch: ${BASEBRANCH}"
echo "Release Process Phases: '${PHASES}'"
}
#################### PHASE 1 ####################
releaseCheCode() {
invokeAction che-incubator/che-code "Release Che Code" "34764281" "version=${CHE_VERSION}"
}
releaseJetBrainsIDE() {
invokeAction che-incubator/jetbrains-ide-dev-server "Release JetBrains IDE Dev Server" "120670986" "version=${CHE_VERSION}"
}
releaseConfigbump() {
invokeAction che-incubator/configbump "Release Che Configbump" "69757177" "version=${CHE_VERSION}"
}
releaseMachineExec() {
invokeAction eclipse-che/che-machine-exec "Release Che Machine Exec" "7369994" "version=${CHE_VERSION}"
}
releaseCheServer() {
invokeAction eclipse-che/che-server "Release Che Server" "9230035" "version=${CHE_VERSION}"
}
releaseDevworkspaceGenerator() {
invokeAction devfile/devworkspace-generator "Release Che Devworkspace Generator" "102323522" "version=${CHE_VERSION}"
}
createBranches() {
invokeAction che-incubator/kubernetes-image-puller "Create branch" "5409996" "branch=${BRANCH}"
}
#################### PHASE 2 ####################
releaseCheE2E() {
invokeAction eclipse/che "Release Che E2E" "5536792" "version=${CHE_VERSION}"
}
releasePluginRegistry() {
invokeAction eclipse-che/che-plugin-registry "Release Che Plugin Registry" "4191251" "version=${CHE_VERSION}"
}
releaseDashboard() {
invokeAction eclipse-che/che-dashboard "Release Che Dashboard" "3152474" "version=${CHE_VERSION}"
}
#################### PHASE 4 ####################
releaseCheOperator() {
invokeAction eclipse-che/che-operator "Release Che Operator" "3593082" "version=${CHE_VERSION}"
}
while [[ "$#" -gt 0 ]]; do
case $1 in
'-v'|'--version') CHE_VERSION="$2"; shift 1;;
'-p'|'--phases') PHASES="$2"; shift 1;;
esac
shift 1
done
if [[ ! ${CHE_VERSION} ]] || [[ ! ${PHASES} ]] ; then
usage
fi
set +x
mkdir "$HOME/.ssh/"
echo "$CHE_GITHUB_SSH_KEY" | base64 -d > "$HOME/.ssh/id_rsa"
chmod 0400 "$HOME/.ssh/id_rsa"
ssh-keyscan github.com >> ~/.ssh/known_hosts
set -x
#################### SETUP ####################
checkForBlockerIssues
setupGitconfig
evaluateCheVariables
echo "BASH VERSION = $BASH_VERSION"
set -e
#################### PHASE 1 ####################
# Release projects that don't depend on other projects
set +x
if [[ ${PHASES} == *"1"* ]]; then
releaseCheCode
releaseJetBrainsIDE
releaseConfigbump
releaseMachineExec
releaseCheServer
releaseDevworkspaceGenerator
createBranches
fi
wait
# shellcheck disable=SC2086
verifyContainerExistsWithTimeout ${REGISTRY}/che-incubator/che-code:${CHE_VERSION} 60
# shellcheck disable=SC2086
verifyContainerExistsWithTimeout ${REGISTRY}/che-incubator/che-idea-dev-server:${CHE_VERSION} 60
# shellcheck disable=SC2086
verifyContainerExistsWithTimeout ${REGISTRY}/che-incubator/configbump:${CHE_VERSION} 60
# shellcheck disable=SC2086
verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-machine-exec:${CHE_VERSION} 60
# shellcheck disable=SC2086
verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-server:${CHE_VERSION} 60
# shellcheck disable=SC2086
verifyBranchExistsWithTimeoutAndExit "https://github.com/che-incubator/kubernetes-image-puller.git" ${BRANCH} 60
# shellcheck disable=SC2086
verifyNpmJsPackageExistsWithTimeoutAndExit "@eclipse-che/che-devworkspace-generator@${CHE_VERSION}" 60
#################### PHASE 2 ####################
set +x
# Release e2e (depends on che-server, devworkspace-generator)
# Release plugin registry (depends on machine-exec)
if [[ ${PHASES} == *"2"* ]]; then
releaseCheE2E
releasePluginRegistry
releaseDashboard
fi
wait
# shellcheck disable=SC2086
verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-e2e:${CHE_VERSION} 30
# shellcheck disable=SC2086
verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-plugin-registry:${CHE_VERSION} 30
# shellcheck disable=SC2086
verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-dashboard:${CHE_VERSION} 60
#################### PHASE 4 ####################
# Create operator PRs (depends on all phases above)
set +x
if [[ ${PHASES} == *"3"* ]]; then
releaseCheOperator
fi
wait
# downstream steps depends on Che operator PRs being merged by humans, so this is the end of the automation.
# see README.md for more info