Merge ~jamesj/snappy-hwe-snaps/+git/jenkins-jobs:serial-vault-nightly into ~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-jobs:master

Proposed by James Jesudason
Status: Merged
Approved by: Konrad Zapałowicz
Approved revision: 6e09abc653efb83912660d5ca1e46cd11fbad92b
Merged at revision: 770ea96b4511f02363d6bc40704595efe24d051c
Proposed branch: ~jamesj/snappy-hwe-snaps/+git/jenkins-jobs:serial-vault-nightly
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-jobs:master
Diff against target: 171 lines (+136/-0)
5 files modified
jobs/deb/common-job-prepare.sh (+53/-0)
jobs/deb/deb-build-serial-vault.sh (+58/-0)
jobs/deb/deb-build-serial-vault.yaml (+15/-0)
jobs/deb/deb-project-jobs.yaml (+4/-0)
jobs/infrastructure/prepare-0-install.sh (+6/-0)
Reviewer Review Type Date Requested Status
System Enablement Bot continuous-integration Approve
Konrad Zapałowicz (community) code Approve
Review via email: mp+338260@code.launchpad.net

Description of the change

Add a nightly build for the Serial Vault deb package

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 :

ok but some polishing needed

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
Konrad Zapałowicz (kzapalowicz) wrote :

one minor thing

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

ack

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/jobs/deb/common-job-prepare.sh b/jobs/deb/common-job-prepare.sh
2new file mode 100644
3index 0000000..6ac7cf8
4--- /dev/null
5+++ b/jobs/deb/common-job-prepare.sh
6@@ -0,0 +1,53 @@
7+#!/bin/sh -ex
8+#
9+# Copyright (C) 2017 Canonical Ltd
10+#
11+# This program is free software: you can redistribute it and/or modify
12+# it under the terms of the GNU General Public License version 3 as
13+# published by the Free Software Foundation.
14+#
15+# This program is distributed in the hope that it will be useful,
16+# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+# GNU General Public License for more details.
19+#
20+# You should have received a copy of the GNU General Public License
21+# along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
23+# This is a common place to be a forwarder of varibles definied in
24+# the job definition. To avoid using templating in the actual job
25+# shell script we have a common .sh file which does this for us.
26+#
27+# Whenever you need something which is suitable for multiple jobs
28+# or originates from the job definition and needs to be added
29+# through a template variable inside the shell script this
30+# is the right place for it.
31+#
32+# This file will be sourced by all jobs.
33+
34+set -ex
35+
36+JENKINS_JOBS_GIT_REPO="{jobs-git-repo}"
37+JENKINS_JOBS_GIT_REPO_BRANCH="{jobs-git-repo-branch}"
38+
39+# Ensure we have a clean and empty workspace but keep our jenkins-jobs
40+# repository so we don't have to clone it again
41+for f in $(ls "${{WORKSPACE}}"); do
42+ if [ "${{f}}" = jenkins-jobs ]; then
43+ continue
44+ fi
45+ rm -rf "${{WORKSPACE}}"/"${{f}}"
46+done
47+
48+if [ -e jenkins-jobs ] ; then
49+ (cd jenkins-jobs ; git clean -fdx . ; git fetch origin ; git reset --hard origin/${{JENKINS_JOBS_GIT_REPO_BRANCH}})
50+else
51+ git clone -b ${{JENKINS_JOBS_GIT_REPO_BRANCH}} ${{JENKINS_JOBS_GIT_REPO}}
52+fi
53+
54+cat << EOF > $WORKSPACE/.build_env
55+LAUNCHPAD_PROJECT={launchpad_project}
56+LAUNCHPAD_TEAM={launchpad_team}
57+BUILD_SCRIPTS=$WORKSPACE/jenkins-jobs
58+BUILD_ID=$BUILD_ID
59+EOF
60diff --git a/jobs/deb/deb-build-serial-vault.sh b/jobs/deb/deb-build-serial-vault.sh
61new file mode 100644
62index 0000000..8bd46a0
63--- /dev/null
64+++ b/jobs/deb/deb-build-serial-vault.sh
65@@ -0,0 +1,58 @@
66+#!/bin/sh
67+#
68+# Copyright (C) 2018 Canonical Ltd
69+#
70+# This program is free software: you can redistribute it and/or modify
71+# it under the terms of the GNU General Public License version 3 as
72+# published by the Free Software Foundation.
73+#
74+# This program is distributed in the hope that it will be useful,
75+# but WITHOUT ANY WARRANTY; without even the implied warranty of
76+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77+# GNU General Public License for more details.
78+#
79+# You should have received a copy of the GNU General Public License
80+# along with this program. If not, see <http://www.gnu.org/licenses/>.
81+
82+set -ex
83+
84+export DEBEMAIL="system-enablement-ci-bot@canonical.com"
85+export DEBFULLNAME="System Enablement Bot"
86+
87+if [ -z "$BUILD_ID" ]; then
88+ BUILD_ID=1
89+fi
90+
91+. "$WORKSPACE/.build_env"
92+
93+if [ -e $WORKSPACE/serial-vault ]; then
94+ rm -rf $WORKSPACE/serial-vault
95+fi
96+
97+# Set up the Go environment
98+export GOPATH=$WORKSPACE/serial-vault
99+export PATH=$PATH:$GOPATH/bin
100+mkdir -p $WORKSPACE/serial-vault/src/github.com/CanonicalLtd
101+
102+# Dependencies
103+go get launchpad.net/godeps
104+go get github.com/golang/lint/golint
105+
106+# Get the Go source
107+git clone https://github.com/CanonicalLtd/serial-vault.git $WORKSPACE/serial-vault/src/github.com/CanonicalLtd/serial-vault
108+cd $WORKSPACE/serial-vault/src/github.com/CanonicalLtd/serial-vault
109+
110+# Build the deb package
111+debuild clean
112+dpkg-buildpackage -j$(nproc)
113+
114+# Bump the current version by a minor number. Having the distro parse
115+# at the end with current date, git rev and build id will do the rest.
116+new_base_version=$(dpkg-parsechangelog --show-field Version).1
117+dch \
118+ --newversion "$new_base_version~$(date +%Y%m%d).$BUILD_ID.$(git rev-parse --short HEAD)" \
119+ -D xenial "Nightly release"
120+
121+# Upload the deb package to the PPA
122+cd ..
123+dput ppa:snappy-hwe-team/nightly *.changes
124diff --git a/jobs/deb/deb-build-serial-vault.yaml b/jobs/deb/deb-build-serial-vault.yaml
125new file mode 100644
126index 0000000..2c31df5
127--- /dev/null
128+++ b/jobs/deb/deb-build-serial-vault.yaml
129@@ -0,0 +1,15 @@
130+- job-template:
131+ name: '{name}-build-serial-vault'
132+ project-type: freestyle
133+ defaults: global
134+ description: "Build the Serial Vault package"
135+ concurrent: true
136+ node: snap && build
137+ builders:
138+ - shell:
139+ !include-raw:
140+ - common-job-prepare.sh
141+ - shell:
142+ !include-raw-escape:
143+ - deb-build-serial-vault.sh
144+
145diff --git a/jobs/deb/deb-project-jobs.yaml b/jobs/deb/deb-project-jobs.yaml
146new file mode 100644
147index 0000000..42d01e6
148--- /dev/null
149+++ b/jobs/deb/deb-project-jobs.yaml
150@@ -0,0 +1,4 @@
151+- job-group:
152+ name: deb-project-jobs
153+ jobs:
154+ - '{name}-deb-build-serial-vault'
155diff --git a/jobs/infrastructure/prepare-0-install.sh b/jobs/infrastructure/prepare-0-install.sh
156index 3d2fb34..f22b600 100644
157--- a/jobs/infrastructure/prepare-0-install.sh
158+++ b/jobs/infrastructure/prepare-0-install.sh
159@@ -58,6 +58,12 @@ $SUDO apt-get install --yes \
160 abootimg \
161 android-tools-fsutils \
162 snapcraft \
163+ golang-go \
164+ dpkg-dev \
165+ devscripts \
166+ dh-golang \
167+ bzr \
168+ dh-systemd \
169 {install_packages}
170
171 # Install additional sofware from the python package database

Subscribers

People subscribed via source and target branches