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
diff --git a/jobs/generic-release-snap b/jobs/generic-release-snap
index fffc8fb..b82bf68 100755
--- a/jobs/generic-release-snap
+++ b/jobs/generic-release-snap
@@ -23,6 +23,7 @@ fi
2323
24echo "Snap to be release: $SNAP_NAME"24echo "Snap to be release: $SNAP_NAME"
25echo "Version to be released: $VERSION"25echo "Version to be released: $VERSION"
26echo "New development version: $NEXT_VERSION"
2627
27GIT_USER=system-enablement-ci-bot28GIT_USER=system-enablement-ci-bot
28REPOSITORY_URL="git+ssh://$GIT_USER@git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/$SNAP_NAME"29REPOSITORY_URL="git+ssh://$GIT_USER@git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/$SNAP_NAME"
@@ -31,37 +32,54 @@ if [ -e $SNAP_NAME ]; then
31 rm -rf $SNAP_NAME32 rm -rf $SNAP_NAME
32fi33fi
3334
34git clone -b master $REPOSITORY_URL $SNAP_NAME35set_git_identity() {
36 git config user.name "System Enablement CI Bot"
37 git config user.email "ce-system-enablement@lists.canonical.com"
38}
39
40bump_version_and_tag() {
41 sed -i -e "s/^version:\ .*/version: $1/g" snapcraft.yaml
42 git add snapcraft.yaml
43 git commit -m "Bump version to $1"
44 git tag -a -m "$1" $1 HEAD
45}
46
47RELEASE_BASE_BRANCH=master
48if [ "$RELEASE_FROM_STABLE" -eq 1 ]; then
49 RELEASE_BASE_BRANCH=stable
50fi
51
52git clone -b $RELEASE_BASE_BRANCH $REPOSITORY_URL $SNAP_NAME
35cd $SNAP_NAME53cd $SNAP_NAME
3654
37if [ ! -e snapcraft.yaml ]; then55if [ ! -e snapcraft.yaml ]; then
38 echo "ERROR: No top-level snapcraft.yaml file!"56 echo "ERROR: No top-level snapcraft.yaml file!"
39 exit 157 exit 1
40fi58fi
4159
42git config user.name "System Enablement CI Bot"60set_git_identity
43git config user.email "ce-system-enablement@lists.canonical.com"61bump_version_and_tag $VERSION
44
45sed -i -e "s/^version:\ .*/version: $VERSION/g" snapcraft.yaml
46git add snapcraft.yaml
47git commit -m "Bump version to $VERSION"
4862
49git tag -a -m "$VERSION" $VERSION HEAD63if [ "$RELEASE_FROM_STABLE" -eq 1 ]; then
50if ! git branch -r | grep origin/stable ; then64 git push origin $RELEASE_BASE_BRANCH
51 git checkout -b stable origin/master65 git push origin $VERSION
52else66else
53 git checkout -b stable origin/stable67 if ! git branch -r | grep origin/stable ; then
54fi68 git checkout -b stable origin/master
55git merge master69 else
70 git checkout -b stable origin/stable
71 fi
72 git merge $RELEASE_BASE_BRANCH
5673
57git push origin stable74 git push origin stable
58git push origin master75 git push origin $RELEASE_BASE_BRANCH
59git push origin $VERSION76 git push origin $VERSION
6077
61git checkout master78 git checkout $RELEASE_BASE_BRANCH
62sed -i -e "s/^version:\ .*/version: ${NEXT_VERSION}-dev/g" snapcraft.yaml79 sed -i -e "s/^version:\ .*/version: ${NEXT_VERSION}-dev/g" snapcraft.yaml
63git add snapcraft.yaml80 git add snapcraft.yaml
64git commit -m "Open development for ${NEXT_VERSION}-dev"81 git commit -m "Open development for ${NEXT_VERSION}-dev"
65git push origin master82 git push origin $RELEASE_BASE_BRANCH
83fi
6684
67exec $WORKSPACE/build-scripts/scripts/trigger-lp-build.py -s $SNAP_NAME -p85exec $WORKSPACE/build-scripts/scripts/trigger-lp-build.py -s $SNAP_NAME -p

Subscribers

People subscribed via source and target branches

to all changes: