Merge ~alfonsosanchezbeato/snappy-hwe-snaps/+git/build-scripts:build-from-master into ~snappy-hwe-team/snappy-hwe-snaps/+git/build-scripts:master

Proposed by Alfonso Sanchez-Beato
Status: Merged
Approved by: Simon Fels
Approved revision: 24d4ea9b0740f294e2d446a24f27d0c63ccabe9f
Merged at revision: 5582cd48aeef69a0cb6eed752360d62faf3c4279
Proposed branch: ~alfonsosanchezbeato/snappy-hwe-snaps/+git/build-scripts:build-from-master
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/build-scripts:master
Diff against target: 105 lines (+63/-8)
2 files modified
jobs/generic-build-snap-worker (+18/-8)
scripts/delete-ci-repo.py (+45/-0)
Reviewer Review Type Date Requested Status
Simon Fels Approve
Jim Hodapp (community) Approve
System Enablement Bot continuous-integration Approve
Review via email: mp+319169@code.launchpad.net

Commit message

Always build from master the branch.

Description of the change

Always build from master the branch.

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
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Simon Fels (morphis) :
review: Needs Fixing
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

Comments addressed.

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 :

LGTM

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/jobs/generic-build-snap-worker b/jobs/generic-build-snap-worker
index d0008df..074318d 100755
--- a/jobs/generic-build-snap-worker
+++ b/jobs/generic-build-snap-worker
@@ -33,17 +33,27 @@ if [ -n "$SOURCE_GIT_REPO" ]; then
33 $REVISION33 $REVISION
34fi34fi
3535
36# Always build against master so all tests are performed
37CI_BRANCH=master
38
39git checkout $CI_BRANCH
36if [ ! -e snapcraft.yaml ] ; then40if [ ! -e snapcraft.yaml ] ; then
37 echo "WARNING: Can't build snap as no snapcraft.yaml exists!"41 echo "WARNING: Can't build snap as no snapcraft.yaml exists!"
38 exit 042 exit 0
39fi43fi
4044
45REPO_NAME=$(awk -v a="$TARGET_GIT_REPO" 'BEGIN{print substr(a, index(a, "+git/") + 5)}')
41SNAP_NAME=$(grep "name:" snapcraft.yaml | awk '{print $2}')46SNAP_NAME=$(grep "name:" snapcraft.yaml | awk '{print $2}')
42SNAP_REV=$(git rev-parse --short HEAD)47SNAP_REV=$(git rev-parse --short HEAD)
43CI_BRANCH=build/$SNAP_NAME-$BUILD_ID-$SNAP_REV48CI_REPO=$REPO_NAME-$BUILD_ID-$SNAP_REV
44git checkout -b $CI_BRANCH49
45git remote add jenkins-ci git+ssh://system-enablement-ci-bot@git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-ci-builds50sed -i "s/~snappy-hwe-team\/snappy-hwe-snaps\/+git\/$REPO_NAME/~snappy-hwe-team\/snappy-hwe-snaps\/+git\/$CI_REPO/g" snapcraft.yaml
46git push jenkins-ci $CI_BRANCH51git add snapcraft.yaml
52git commit -m "jenkins-ci: Fix paths"
53
54git remote add jenkins-ci git+ssh://system-enablement-ci-bot@git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/$CI_REPO
55git push jenkins-ci --all
56git push jenkins-ci --tags
4757
48EXTRA_ARGS=58EXTRA_ARGS=
49if [ -n "$ARCHITECTURES" ]; then59if [ -n "$ARCHITECTURES" ]; then
@@ -52,13 +62,13 @@ fi
5262
53$WORKSPACE/build-scripts/scripts/trigger-lp-build.py \63$WORKSPACE/build-scripts/scripts/trigger-lp-build.py \
54 -s $SNAP_NAME -n \64 -s $SNAP_NAME -n \
55 --git-repo=https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-ci-builds \65 --git-repo=https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/$CI_REPO \
56 --git-repo-branch=$CI_BRANCH \66 --git-repo-branch=$CI_BRANCH \
57 --results-dir=$WORKSPACE/results \67 --results-dir=$WORKSPACE/results \
58 $EXTRA_ARGS68 $EXTRA_ARGS
59# When build has finished (regardless of its result) we remove our CI branch69# When build has finished remove the repository we just created
60# to keep the CI repository clean.70$WORKSPACE/build-scripts/scripts/delete-ci-repo.py \
61git push jenkins-ci :$CI_BRANCH71 --git-repo=https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/$CI_REPO
62if [ $? -ne 0 ]; then72if [ $? -ne 0 ]; then
63 exit 173 exit 1
64fi74fi
diff --git a/scripts/delete-ci-repo.py b/scripts/delete-ci-repo.py
65new file mode 10075575new file mode 100755
index 0000000..35c762d
--- /dev/null
+++ b/scripts/delete-ci-repo.py
@@ -0,0 +1,45 @@
1#!/usr/bin/env python
2#
3# Copyright (C) 2017 Canonical Ltd
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from launchpadlib.launchpad import Launchpad
18
19from argparse import ArgumentParser
20
21import se_utils
22
23print("Running delete-ci-repo")
24
25parser = ArgumentParser(description="Delete a git repository stored in launchpad")
26parser.add_argument('--git-repo', help="Git repository to be deleted")
27
28args = vars(parser.parse_args())
29
30git_repo = args['git_repo']
31ind = git_repo.find('~')
32if ind == -1:
33 print("Bad git repo {}".format(git_repo))
34 exit(1)
35
36lp_repo = git_repo[ind:]
37
38lp_app = se_utils.get_config_option("lp_app")
39lp_env = se_utils.get_config_option("lp_env")
40credential_store_path = se_utils.get_config_option('credential_store_path')
41launchpad = se_utils.get_launchpad(None, credential_store_path, lp_app, lp_env)
42
43repo = launchpad.git_repositories.getByPath(path=lp_repo)
44print("Removing {}".format(lp_repo))
45repo.lp_delete()

Subscribers

People subscribed via source and target branches