-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathstable-branch-updates
executable file
·78 lines (70 loc) · 3.28 KB
/
stable-branch-updates
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
#!/bin/bash -e
#
# Post-Release Repo Tasks
# - Flip stable charm-helpers and Zaza bits.
# - Update .gitreview with new stable branch name.
# the OpenStack code name (e.g. antelope)
release="$1"
# the OpenStack release name (e.g. 2023.1)
branch="$2"
if [ -z "$branch" ]; then
echo "Please provide release and branch parameters"
echo "usage: stable-branch-updates release branch"
echo "e.g. stable-branch-updates yoga jammy"
echo " means 'stable/yoga' for libs, and 'stable/jammy' for this charm"
exit 1
fi
git fetch --all
# relies on openstack_release being passed as var 1 and branch in var 2
function ensure_git_branch {
local branch=$1
local current_branch=$(git branch --show-current | tr -d '\n')
if [[ "$current_branch" != "${branch}-updates" ]];
then
git checkout -b ${branch}-updates origin/stable/${branch}
fi
}
ensure_git_branch ${branch}
grep -q defaultbranch .gitreview || {
echo -e "\ndefaultbranch=stable/$branch" >> .gitreview
git add .gitreview
}
for ch in charm-helpers-hooks.yaml charm-helpers-tests.yaml; do
if [ -f $ch ]; then
sed -i "s#https\://github.com/juju/charm-helpers\$#https\://github.com/juju/charm-helpers\@stable/${release}#g" $ch
git add $ch
fi
if [ -f src/$ch ]; then
sed -i "s#https\://github.com/juju/charm-helpers\$#https\://github.com/juju/charm-helpers\@stable/${release}#g" src/$ch
git add src/$ch
fi
done
if [ -f src/layer.yaml ]; then
set +e
grep -q charms.openstack.git@stable src/wheelhouse.txt 2>/dev/null || {
echo "Updating charm wheelhouse, with stable 'charms.openstack'"
sed -i "s#openstack/charms.openstack.git\##openstack/charms.openstack.git@stable/$release\##g" src/wheelhouse.txt
}
grep -q charm-helpers.git@stable src/wheelhouse.txt 2>/dev/null || {
echo "Updating charm wheelhouse, with stable 'charmhelpers'"
sed -i "s#juju/charm-helpers.git\##juju/charm-helpers.git@stable/${release}\##g" src/wheelhouse.txt
}
grep -q charms.openstack.git@stable tests-requirements.txt 2>/dev/null || {
echo "Updating test-requirements.txt in repository with stable charms.openstack"
sed -i "s#openstack/charms.openstack.git\##openstack/charms.openstack.git@stable/$release\##g" test-requirements.txt
}
grep -q zaza-openstack-tests.git@stable src/tests-requirements.txt 2>/dev/null || {
echo "Updating src/test-requirements.txt in repository with stable Zaza"
sed -i "s#openstack-charmers/zaza.git\##openstack-charmers/zaza.git@stable/$release\##g" src/test-requirements.txt
sed -i "s#openstack-charmers/zaza-openstack-tests.git\##openstack-charmers/zaza-openstack-tests.git@stable/$release\##g" src/test-requirements.txt
}
set -e
else
set +e
grep -q zaza-openstack-tests.git@stable tests-requirements.txt 2>/dev/null || {
echo "Updating test-requirements.txt in repository with stable Zaza"
sed -i "s#openstack-charmers/zaza.git\##openstack-charmers/zaza.git@stable/$release\##g" test-requirements.txt
sed -i "s#openstack-charmers/zaza-openstack-tests.git\##openstack-charmers/zaza-openstack-tests.git@stable/$release\##g" test-requirements.txt
}
set -e
fi