Merge ~morphis/snappy-hwe-snaps/+git/build-scripts:f/release-from-stable into ~snappy-hwe-team/snappy-hwe-snaps/+git/build-scripts:master

Proposed by Simon Fels
Status: Merged
Approved by: Konrad Zapałowicz
Approved revision: 6c9b4f1654424ad8152c578a37a888f287e8b195
Merged at revision: a8e48d04a58cf06008625f93701c7d1080347113
Proposed branch: ~morphis/snappy-hwe-snaps/+git/build-scripts:f/release-from-stable
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/build-scripts:master
Diff against target: 90 lines (+41/-23)
1 file modified
jobs/generic-release-snap (+41/-23)
Reviewer Review Type Date Requested Status
Jim Hodapp (community) Approve
Konrad Zapałowicz (community) code Approve
System Enablement Bot continuous-integration Approve
Review via email: mp+320344@code.launchpad.net

Description of the change

Allow doing releases from the stable branch

In some scenarios it is required to do releases from the stable branch instead of master. For this we add an additional RELEASE_FROM_STABLE parameter to the release job which will tell the job to consider stable instead of master for the release steps.

To post a comment you must log in.
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

Needs information

review: Needs Fixing (code)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

I'm trying to understand better what scenarios require us to release from stable instead of from master. Can you give an example Simon?

review: Needs Information
Revision history for this message
Simon Fels (morphis) wrote :

@Jim: https://trello.com/c/dVtwAPcV is the example in this case. master has evolved much further already with a lot new features and we need to bring a single change to caracalla as a new release of the network-manager snap. This single change was cherry-picked to stable with https://code.launchpad.net/~morphis/snappy-hwe-snaps/+git/network-manager/+merge/320352 and now we need to create a new release on top of what is in stable. This is what the current implementation doesn't allow but we change with this MP. With this we will

 - not merge master into stable
 - tag HEAD of stable with the new VERSION supplied by the user
 - push stable and trigger -publish build

Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

ack

review: Approve (code)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Makes sense now Simon. Thanks for the explanation. I assume we'd also want to bring whatever we cherry pick into stable into master as well so that they don't diverge.

review: Approve
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Holding off top approving this until you tell me to Simon, just in case it adversely affects our build system.

Revision history for this message
Simon Fels (morphis) wrote :

Sure, in the particular case the change is already in master.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/jobs/generic-release-snap b/jobs/generic-release-snap
2index fffc8fb..b82bf68 100755
3--- a/jobs/generic-release-snap
4+++ b/jobs/generic-release-snap
5@@ -23,6 +23,7 @@ fi
6
7 echo "Snap to be release: $SNAP_NAME"
8 echo "Version to be released: $VERSION"
9+echo "New development version: $NEXT_VERSION"
10
11 GIT_USER=system-enablement-ci-bot
12 REPOSITORY_URL="git+ssh://$GIT_USER@git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/$SNAP_NAME"
13@@ -31,37 +32,54 @@ if [ -e $SNAP_NAME ]; then
14 rm -rf $SNAP_NAME
15 fi
16
17-git clone -b master $REPOSITORY_URL $SNAP_NAME
18+set_git_identity() {
19+ git config user.name "System Enablement CI Bot"
20+ git config user.email "ce-system-enablement@lists.canonical.com"
21+}
22+
23+bump_version_and_tag() {
24+ sed -i -e "s/^version:\ .*/version: $1/g" snapcraft.yaml
25+ git add snapcraft.yaml
26+ git commit -m "Bump version to $1"
27+ git tag -a -m "$1" $1 HEAD
28+}
29+
30+RELEASE_BASE_BRANCH=master
31+if [ "$RELEASE_FROM_STABLE" -eq 1 ]; then
32+ RELEASE_BASE_BRANCH=stable
33+fi
34+
35+git clone -b $RELEASE_BASE_BRANCH $REPOSITORY_URL $SNAP_NAME
36 cd $SNAP_NAME
37
38 if [ ! -e snapcraft.yaml ]; then
39- echo "ERROR: No top-level snapcraft.yaml file!"
40- exit 1
41+ echo "ERROR: No top-level snapcraft.yaml file!"
42+ exit 1
43 fi
44
45-git config user.name "System Enablement CI Bot"
46-git config user.email "ce-system-enablement@lists.canonical.com"
47-
48-sed -i -e "s/^version:\ .*/version: $VERSION/g" snapcraft.yaml
49-git add snapcraft.yaml
50-git commit -m "Bump version to $VERSION"
51+set_git_identity
52+bump_version_and_tag $VERSION
53
54-git tag -a -m "$VERSION" $VERSION HEAD
55-if ! git branch -r | grep origin/stable ; then
56- git checkout -b stable origin/master
57+if [ "$RELEASE_FROM_STABLE" -eq 1 ]; then
58+ git push origin $RELEASE_BASE_BRANCH
59+ git push origin $VERSION
60 else
61- git checkout -b stable origin/stable
62-fi
63-git merge master
64+ if ! git branch -r | grep origin/stable ; then
65+ git checkout -b stable origin/master
66+ else
67+ git checkout -b stable origin/stable
68+ fi
69+ git merge $RELEASE_BASE_BRANCH
70
71-git push origin stable
72-git push origin master
73-git push origin $VERSION
74+ git push origin stable
75+ git push origin $RELEASE_BASE_BRANCH
76+ git push origin $VERSION
77
78-git checkout master
79-sed -i -e "s/^version:\ .*/version: ${NEXT_VERSION}-dev/g" snapcraft.yaml
80-git add snapcraft.yaml
81-git commit -m "Open development for ${NEXT_VERSION}-dev"
82-git push origin master
83+ git checkout $RELEASE_BASE_BRANCH
84+ sed -i -e "s/^version:\ .*/version: ${NEXT_VERSION}-dev/g" snapcraft.yaml
85+ git add snapcraft.yaml
86+ git commit -m "Open development for ${NEXT_VERSION}-dev"
87+ git push origin $RELEASE_BASE_BRANCH
88+fi
89
90 exec $WORKSPACE/build-scripts/scripts/trigger-lp-build.py -s $SNAP_NAME -p

Subscribers

People subscribed via source and target branches

to all changes: