Merge ~michihenning/jenkaas-jobs:install-extra-packages-during-build into jenkaas-jobs:master

Proposed by Michi Henning
Status: Rejected
Rejected by: Michał Sawicz
Proposed branch: ~michihenning/jenkaas-jobs:install-extra-packages-during-build
Merge into: jenkaas-jobs:master
Diff against target: 147 lines (+21/-9)
10 files modified
.gitignore (+3/-0)
jenkaas_jobs/yaml/build/build-0-fetch.sh (+6/-1)
jenkaas_jobs/yaml/build/build-0-fetch.yaml (+5/-1)
jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml (+1/-1)
jenkaas_jobs/yaml/launchpad/lp-trigger.yaml (+1/-1)
tests/fixtures/launchpad/lp-one-trigger.xml (+1/-1)
tests/fixtures/launchpad/lp-three-trigger-autolanding.xml (+1/-1)
tests/fixtures/launchpad/lp-three-trigger.xml (+1/-1)
tests/fixtures/launchpad/lp-two-trigger-autolanding.xml (+1/-1)
tests/fixtures/launchpad/lp-two-trigger.xml (+1/-1)
Reviewer Review Type Date Requested Status
Michał Sawicz Disapprove
dobey Pending
Review via email: mp+294451@code.launchpad.net

Commit message

Make sure that install_packages is used during first build step, in case a dependency is added to a project config after the chroots were created.

Description of the change

While adding unity-scopes-api, I found that we need click-dev, which wasn't installed on the slaves.

Just adding click-dev to install_packages doesn't help, because that is used when the chroots are built. However, if we add a new project to our config and find that something extra needs to be installed, we can't fix it without modifying jenkaas-jobs because install_packages is expanded into prepare-0-install.sh, and we can't modify that from our config without also incrementing the job_version in prepare-0-install.yaml.

The easiest solution seems to be to also look at install_packages during build-0-fetch and call apt install. If the extra packages are installed already, it finishes very quickly and does not harm. If they are missing, they are added before the build kicks off.

I suspect that we could also remove install_packages from prepare-0-install altogether (but I didn't do that). install_packages has an effect only if a dependency for a project is known *before* the chroots are created, but that's generally not the case.

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) wrote :

Thing is, that means running a NOOP `apt-get install` for 99% of the runs. IIUC this is needed in `debian/rules` clean?

I want to go in the direction bileto went and not run clean at all during source package builds. Would that work for you?

review: Needs Information
Revision history for this message
Michi Henning (michihenning) wrote :

Are you talking about something like the billet_pre_release_hook? I guess that would work. So, the plan would be for the source package build to invoke some script that we can provide as part of the project config (outside jenkaas-jobs)?

Revision history for this message
Michał Sawicz (saviq) wrote :

Yes, I would actually like to use that same script - no need for anything else?

Revision history for this message
Michi Henning (michihenning) wrote :

At the moment, the bileto hook for scopes-api doesn't install anything. I guess we add the apt-get install command for click-dev there though.
So, yes, I guess that'll work, thanks!

Revision history for this message
Michi Henning (michihenning) wrote :

Ah, no change needed in the script. Once the control file is generated, we should be good.

Revision history for this message
Michał Sawicz (saviq) wrote :

OK I'll disapprove this then.

review: Disapprove
Revision history for this message
Michi Henning (michihenning) wrote :

Sorry, should have done that myself, thanks!

Unmerged commits

2fded35... by Michi Henning

Moved apt command to more logical place.

79d8e4b... by Michi Henning

Install extra packages during build, otherwise they won't be there if the main project file is updated after the chroots were created.

c109369... by Michi Henning

Removed project-specific launchpad node label matching. The trigger jobs now run on any node with a "launchpad" label.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 1408662..96dd851 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -23,3 +23,6 @@ var/
6
7 .project
8 .pydevproject
9+
10+# Temporary files
11+*.swp
12diff --git a/jenkaas_jobs/yaml/build/build-0-fetch.sh b/jenkaas_jobs/yaml/build/build-0-fetch.sh
13index ac989cc..768b8e1 100644
14--- a/jenkaas_jobs/yaml/build/build-0-fetch.sh
15+++ b/jenkaas_jobs/yaml/build/build-0-fetch.sh
16@@ -3,6 +3,11 @@
17 # log all commands and abort on error
18 set -xe
19
20+# make sure that packages that were newly added to the main project file are installed
21+if [ -n "${extra_packages}" ]; then
22+ sudo apt-get install --yes ${extra_packages}
23+fi
24+
25 # sanitize input
26 bzr revno ${source_branch} || (echo "ERROR: source branch incorrect"; exit 1)
27 [ -z "${source_revision}" ] || bzr revno -r ${source_revision} ${source_branch} || (echo "ERROR: source revision incorrect"; exit 2)
28@@ -40,4 +45,4 @@ dch -v ${VERSION} "Automatic build of ${source_branch} at revision ${source_revi
29 [ -n "${target_branch}" ] && dch "Based on ${target_branch}"
30
31 # build source package
32-bzr builddeb --builder="debuild -uc -us" --source --result-dir=${OUTDIR}
33\ No newline at end of file
34+bzr builddeb --builder="debuild -uc -us" --source --result-dir=${OUTDIR}
35diff --git a/jenkaas_jobs/yaml/build/build-0-fetch.yaml b/jenkaas_jobs/yaml/build/build-0-fetch.yaml
36index 15e338e..b5a5ef2 100644
37--- a/jenkaas_jobs/yaml/build/build-0-fetch.yaml
38+++ b/jenkaas_jobs/yaml/build/build-0-fetch.yaml
39@@ -9,6 +9,10 @@
40 artifactNumToKeep: '{artifact_keep}'
41 parameters:
42 - branch_parameters
43+ - string:
44+ name: extra_packages
45+ default: '{install_packages}'
46+ description: A space-separated list of additional packages to install on slaves prior to starting a build.
47 properties:
48 - rebuild
49 wrappers:
50@@ -27,4 +31,4 @@
51 only-if-success: false
52 fingerprint: false
53 - workspace-cleanup:
54- fail-build: true
55\ No newline at end of file
56+ fail-build: true
57diff --git a/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml b/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml
58index d1f8b97..2376dd9 100644
59--- a/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml
60+++ b/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml
61@@ -2,7 +2,7 @@
62 name: lp-{project}-trigger-autolanding
63 project-type: freestyle
64 description: 'Auto-land top-approved changes for {branch}'
65- node: launchpad-{project}
66+ node: launchpad
67 logrotate:
68 numToKeep: 10
69 triggers:
70diff --git a/jenkaas_jobs/yaml/launchpad/lp-trigger.yaml b/jenkaas_jobs/yaml/launchpad/lp-trigger.yaml
71index 92cde53..3faacb4 100644
72--- a/jenkaas_jobs/yaml/launchpad/lp-trigger.yaml
73+++ b/jenkaas_jobs/yaml/launchpad/lp-trigger.yaml
74@@ -2,7 +2,7 @@
75 name: lp-{project}-trigger
76 project-type: freestyle
77 description: 'Monitor Launchpad for changes in {branch}'
78- node: launchpad-{project}
79+ node: launchpad
80 logrotate:
81 numToKeep: 10
82 triggers:
83diff --git a/tests/fixtures/launchpad/lp-one-trigger.xml b/tests/fixtures/launchpad/lp-one-trigger.xml
84index f6698c8..977982c 100644
85--- a/tests/fixtures/launchpad/lp-one-trigger.xml
86+++ b/tests/fixtures/launchpad/lp-one-trigger.xml
87@@ -16,7 +16,7 @@
88 </com.sonyericsson.rebuild.RebuildSettings>
89 </properties>
90 <scm class="hudson.scm.NullSCM"/>
91- <assignedNode>launchpad-one</assignedNode>
92+ <assignedNode>launchpad</assignedNode>
93 <canRoam>false</canRoam>
94 <disabled>false</disabled>
95 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
96diff --git a/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml b/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml
97index 1694b1e..f34e0ac 100644
98--- a/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml
99+++ b/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml
100@@ -6,7 +6,7 @@
101 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
102 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
103 <concurrentBuild>false</concurrentBuild>
104- <assignedNode>launchpad-three</assignedNode>
105+ <assignedNode>launchpad</assignedNode>
106 <canRoam>false</canRoam>
107 <logRotator>
108 <daysToKeep>-1</daysToKeep>
109diff --git a/tests/fixtures/launchpad/lp-three-trigger.xml b/tests/fixtures/launchpad/lp-three-trigger.xml
110index 76a17f2..62ea6e7 100644
111--- a/tests/fixtures/launchpad/lp-three-trigger.xml
112+++ b/tests/fixtures/launchpad/lp-three-trigger.xml
113@@ -16,7 +16,7 @@
114 </com.sonyericsson.rebuild.RebuildSettings>
115 </properties>
116 <scm class="hudson.scm.NullSCM"/>
117- <assignedNode>launchpad-three</assignedNode>
118+ <assignedNode>launchpad</assignedNode>
119 <canRoam>false</canRoam>
120 <disabled>false</disabled>
121 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
122diff --git a/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml b/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml
123index 6af75ad..6192baf 100644
124--- a/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml
125+++ b/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml
126@@ -6,7 +6,7 @@
127 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
128 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
129 <concurrentBuild>false</concurrentBuild>
130- <assignedNode>launchpad-two</assignedNode>
131+ <assignedNode>launchpad</assignedNode>
132 <canRoam>false</canRoam>
133 <logRotator>
134 <daysToKeep>-1</daysToKeep>
135diff --git a/tests/fixtures/launchpad/lp-two-trigger.xml b/tests/fixtures/launchpad/lp-two-trigger.xml
136index 95407c0..092ae55 100644
137--- a/tests/fixtures/launchpad/lp-two-trigger.xml
138+++ b/tests/fixtures/launchpad/lp-two-trigger.xml
139@@ -16,7 +16,7 @@
140 </com.sonyericsson.rebuild.RebuildSettings>
141 </properties>
142 <scm class="hudson.scm.NullSCM"/>
143- <assignedNode>launchpad-two</assignedNode>
144+ <assignedNode>launchpad</assignedNode>
145 <canRoam>false</canRoam>
146 <disabled>false</disabled>
147 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>

Subscribers

People subscribed via source and target branches

to all changes: