Skip to content

Commit bbef493

Browse files
authored
refactor(release-scripts): enable branch reuse for reruns and update … (#231)
* refactor(release-scripts): enable branch reuse for reruns and update old chart version Signed-off-by: skestwal <[email protected]> * refactor(release-scripts): improve branch and PR reuse for release testing - Check both local and remote branches to enable proper branch reuse - Reuse existing open PRs instead of creating duplicates for same branch - Clean up old test.env configuration before adding new settings to prevent duplication Signed-off-by: skestwal <[email protected]> * update(release-scripts): MVP for the release test will have orchestrator enabled Signed-off-by: skestwal <[email protected]> --------- Signed-off-by: skestwal <[email protected]>
1 parent f1d616a commit bbef493

File tree

1 file changed

+46
-19
lines changed

1 file changed

+46
-19
lines changed

ci-scripts/release-tests.sh

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,21 @@ function configure_run() {
1717
testname="$3"
1818

1919
git checkout "$SOURCE_BRANCH"
20-
git checkout -b "$branch"
20+
git pull origin "$SOURCE_BRANCH"
21+
22+
if git show-ref --verify --quiet refs/heads/"$branch" || git show-ref --verify --quiet refs/remotes/origin/"$branch"; then
23+
echo "$(date -u +'%Y-%m-%dT%H:%M:%S,%N+00:00') INFO Branch $branch exists, updating it"
24+
git checkout "$branch" 2>/dev/null || git checkout -b "$branch" origin/"$branch"
25+
git pull origin "$branch"
26+
else
27+
echo "$(date -u +'%Y-%m-%dT%H:%M:%S,%N+00:00') INFO Creating new branch $branch"
28+
git checkout -b "$branch"
29+
fi
30+
31+
if [ -f test.env ]; then
32+
sed -i.bak '/^export DURATION=/,/^export RHDH_HELM_CHART_VERSION=/d' test.env
33+
rm -f test.env.bak
34+
fi
2135

2236
echo "
2337
export DURATION=$DURATION
@@ -36,32 +50,45 @@ export USE_PR_BRANCH=true
3650
export WAIT_FOR_SEARCH_INDEX=false
3751
export RHDH_HELM_CHART=redhat-developer-hub
3852
export AUTH_PROVIDER=keycloak
53+
export ENABLE_ORCHESTRATOR=true
3954
export RHDH_HELM_CHART_VERSION='$RHDH_HELM_CHART_VERSION'
4055
" >>test.env
4156

4257
git commit -am "chore($ticket): $testname on $branch"
4358
git push -u origin "$branch"
44-
echo "$(date -u +'%Y-%m-%dT%H:%M:%S,%N+00:00') INFO Created and pushed branch ${branch}"
59+
echo "$(date -u +'%Y-%m-%dT%H:%M:%S,%N+00:00') INFO Pushed branch ${branch}"
4560
git checkout "$SOURCE_BRANCH"
4661

47-
curl_data='{
48-
"title": "chore('"$ticket"'): '"$branch"'",
49-
"body": "**'"$testname"'**: '"$VERSION_OLD"' vs. '"$VERSION_NEW"' testing. This is to get perf&scale data for `'"$branch"'`",
50-
"head": "'"$branch"'",
51-
"base": "'"$SOURCE_BRANCH"'",
52-
"draft": true
53-
}'
54-
curl_out="$( curl \
55-
-L \
56-
--silent \
57-
-X POST \
62+
63+
pr_number=$( curl -L --silent \
5864
-H "Accept: application/vnd.github+json" \
5965
-H "Authorization: Bearer $GITHUB_TOKEN" \
6066
-H "X-GitHub-Api-Version: 2022-11-28" \
61-
"https://api.github.com/repos/redhat-performance/backstage-performance/pulls" \
62-
-d "$curl_data"
63-
)"
64-
pr_number=$( echo "$curl_out" | jq -rc '.number' )
67+
"https://api.github.com/repos/redhat-performance/backstage-performance/pulls?head=redhat-performance:$branch&state=open" \
68+
| jq -rc '.[0].number // empty'
69+
)
70+
71+
if [ -z "$pr_number" ] ; then
72+
curl_data='{
73+
"title": "chore('"$ticket"'): '"$branch"'",
74+
"body": "**'"$testname"'**: '"$VERSION_OLD"' vs. '"$VERSION_NEW"' testing. This is to get perf&scale data for `'"$branch"'`",
75+
"head": "'"$branch"'",
76+
"base": "'"$SOURCE_BRANCH"'",
77+
"draft": true
78+
}'
79+
curl_out="$( curl \
80+
-L \
81+
--silent \
82+
-X POST \
83+
-H "Accept: application/vnd.github+json" \
84+
-H "Authorization: Bearer $GITHUB_TOKEN" \
85+
-H "X-GitHub-Api-Version: 2022-11-28" \
86+
"https://api.github.com/repos/redhat-performance/backstage-performance/pulls" \
87+
-d "$curl_data"
88+
)"
89+
pr_number=$( echo "$curl_out" | jq -rc '.number' )
90+
fi
91+
6592
curl_comment_out="$( curl \
6693
-L \
6794
--silent \
@@ -134,8 +161,8 @@ function storage_limit_test() {
134161
# !!! Configure here !!!
135162
VERSION_OLD="1.7"
136163
VERSION_NEW="1.8"
137-
RHDH_HELM_CHART_VERSION_OLD=1.7.1
138-
RHDH_HELM_CHART_VERSION_NEW=1.8-145-CI
164+
RHDH_HELM_CHART_VERSION_OLD=1.7.2
165+
RHDH_HELM_CHART_VERSION_NEW=1.8-164-CI
139166
SOURCE_BRANCH_OLD=rhdh-v1.7.x
140167
SOURCE_BRANCH_NEW=main
141168
compare_previous_test "RHIDP-9162"

0 commit comments

Comments
 (0)