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
diff --git a/.gitignore b/.gitignore
index 1408662..96dd851 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,6 @@ var/
2323
24.project24.project
25.pydevproject25.pydevproject
26
27# Temporary files
28*.swp
diff --git a/jenkaas_jobs/yaml/build/build-0-fetch.sh b/jenkaas_jobs/yaml/build/build-0-fetch.sh
index ac989cc..768b8e1 100644
--- a/jenkaas_jobs/yaml/build/build-0-fetch.sh
+++ b/jenkaas_jobs/yaml/build/build-0-fetch.sh
@@ -3,6 +3,11 @@
3# log all commands and abort on error3# log all commands and abort on error
4set -xe4set -xe
55
6# make sure that packages that were newly added to the main project file are installed
7if [ -n "${extra_packages}" ]; then
8 sudo apt-get install --yes ${extra_packages}
9fi
10
6# sanitize input11# sanitize input
7bzr revno ${source_branch} || (echo "ERROR: source branch incorrect"; exit 1)12bzr revno ${source_branch} || (echo "ERROR: source branch incorrect"; exit 1)
8[ -z "${source_revision}" ] || bzr revno -r ${source_revision} ${source_branch} || (echo "ERROR: source revision incorrect"; exit 2)13[ -z "${source_revision}" ] || bzr revno -r ${source_revision} ${source_branch} || (echo "ERROR: source revision incorrect"; exit 2)
@@ -40,4 +45,4 @@ dch -v ${VERSION} "Automatic build of ${source_branch} at revision ${source_revi
40[ -n "${target_branch}" ] && dch "Based on ${target_branch}"45[ -n "${target_branch}" ] && dch "Based on ${target_branch}"
4146
42# build source package47# build source package
43bzr builddeb --builder="debuild -uc -us" --source --result-dir=${OUTDIR}
44\ No newline at end of file48\ No newline at end of file
49bzr builddeb --builder="debuild -uc -us" --source --result-dir=${OUTDIR}
diff --git a/jenkaas_jobs/yaml/build/build-0-fetch.yaml b/jenkaas_jobs/yaml/build/build-0-fetch.yaml
index 15e338e..b5a5ef2 100644
--- a/jenkaas_jobs/yaml/build/build-0-fetch.yaml
+++ b/jenkaas_jobs/yaml/build/build-0-fetch.yaml
@@ -9,6 +9,10 @@
9 artifactNumToKeep: '{artifact_keep}'9 artifactNumToKeep: '{artifact_keep}'
10 parameters:10 parameters:
11 - branch_parameters11 - branch_parameters
12 - string:
13 name: extra_packages
14 default: '{install_packages}'
15 description: A space-separated list of additional packages to install on slaves prior to starting a build.
12 properties:16 properties:
13 - rebuild17 - rebuild
14 wrappers:18 wrappers:
@@ -27,4 +31,4 @@
27 only-if-success: false31 only-if-success: false
28 fingerprint: false32 fingerprint: false
29 - workspace-cleanup:33 - workspace-cleanup:
30 fail-build: true
31\ No newline at end of file34\ No newline at end of file
35 fail-build: true
diff --git a/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml b/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml
index d1f8b97..2376dd9 100644
--- a/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml
+++ b/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml
@@ -2,7 +2,7 @@
2 name: lp-{project}-trigger-autolanding2 name: lp-{project}-trigger-autolanding
3 project-type: freestyle3 project-type: freestyle
4 description: 'Auto-land top-approved changes for {branch}'4 description: 'Auto-land top-approved changes for {branch}'
5 node: launchpad-{project}5 node: launchpad
6 logrotate:6 logrotate:
7 numToKeep: 107 numToKeep: 10
8 triggers:8 triggers:
diff --git a/jenkaas_jobs/yaml/launchpad/lp-trigger.yaml b/jenkaas_jobs/yaml/launchpad/lp-trigger.yaml
index 92cde53..3faacb4 100644
--- a/jenkaas_jobs/yaml/launchpad/lp-trigger.yaml
+++ b/jenkaas_jobs/yaml/launchpad/lp-trigger.yaml
@@ -2,7 +2,7 @@
2 name: lp-{project}-trigger2 name: lp-{project}-trigger
3 project-type: freestyle3 project-type: freestyle
4 description: 'Monitor Launchpad for changes in {branch}'4 description: 'Monitor Launchpad for changes in {branch}'
5 node: launchpad-{project}5 node: launchpad
6 logrotate:6 logrotate:
7 numToKeep: 107 numToKeep: 10
8 triggers:8 triggers:
diff --git a/tests/fixtures/launchpad/lp-one-trigger.xml b/tests/fixtures/launchpad/lp-one-trigger.xml
index f6698c8..977982c 100644
--- a/tests/fixtures/launchpad/lp-one-trigger.xml
+++ b/tests/fixtures/launchpad/lp-one-trigger.xml
@@ -16,7 +16,7 @@
16 </com.sonyericsson.rebuild.RebuildSettings>16 </com.sonyericsson.rebuild.RebuildSettings>
17 </properties>17 </properties>
18 <scm class="hudson.scm.NullSCM"/>18 <scm class="hudson.scm.NullSCM"/>
19 <assignedNode>launchpad-one</assignedNode>19 <assignedNode>launchpad</assignedNode>
20 <canRoam>false</canRoam>20 <canRoam>false</canRoam>
21 <disabled>false</disabled>21 <disabled>false</disabled>
22 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>22 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
diff --git a/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml b/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml
index 1694b1e..f34e0ac 100644
--- a/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml
+++ b/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml
@@ -6,7 +6,7 @@
6 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>6 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
7 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>7 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
8 <concurrentBuild>false</concurrentBuild>8 <concurrentBuild>false</concurrentBuild>
9 <assignedNode>launchpad-three</assignedNode>9 <assignedNode>launchpad</assignedNode>
10 <canRoam>false</canRoam>10 <canRoam>false</canRoam>
11 <logRotator>11 <logRotator>
12 <daysToKeep>-1</daysToKeep>12 <daysToKeep>-1</daysToKeep>
diff --git a/tests/fixtures/launchpad/lp-three-trigger.xml b/tests/fixtures/launchpad/lp-three-trigger.xml
index 76a17f2..62ea6e7 100644
--- a/tests/fixtures/launchpad/lp-three-trigger.xml
+++ b/tests/fixtures/launchpad/lp-three-trigger.xml
@@ -16,7 +16,7 @@
16 </com.sonyericsson.rebuild.RebuildSettings>16 </com.sonyericsson.rebuild.RebuildSettings>
17 </properties>17 </properties>
18 <scm class="hudson.scm.NullSCM"/>18 <scm class="hudson.scm.NullSCM"/>
19 <assignedNode>launchpad-three</assignedNode>19 <assignedNode>launchpad</assignedNode>
20 <canRoam>false</canRoam>20 <canRoam>false</canRoam>
21 <disabled>false</disabled>21 <disabled>false</disabled>
22 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>22 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
diff --git a/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml b/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml
index 6af75ad..6192baf 100644
--- a/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml
+++ b/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml
@@ -6,7 +6,7 @@
6 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>6 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
7 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>7 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
8 <concurrentBuild>false</concurrentBuild>8 <concurrentBuild>false</concurrentBuild>
9 <assignedNode>launchpad-two</assignedNode>9 <assignedNode>launchpad</assignedNode>
10 <canRoam>false</canRoam>10 <canRoam>false</canRoam>
11 <logRotator>11 <logRotator>
12 <daysToKeep>-1</daysToKeep>12 <daysToKeep>-1</daysToKeep>
diff --git a/tests/fixtures/launchpad/lp-two-trigger.xml b/tests/fixtures/launchpad/lp-two-trigger.xml
index 95407c0..092ae55 100644
--- a/tests/fixtures/launchpad/lp-two-trigger.xml
+++ b/tests/fixtures/launchpad/lp-two-trigger.xml
@@ -16,7 +16,7 @@
16 </com.sonyericsson.rebuild.RebuildSettings>16 </com.sonyericsson.rebuild.RebuildSettings>
17 </properties>17 </properties>
18 <scm class="hudson.scm.NullSCM"/>18 <scm class="hudson.scm.NullSCM"/>
19 <assignedNode>launchpad-two</assignedNode>19 <assignedNode>launchpad</assignedNode>
20 <canRoam>false</canRoam>20 <canRoam>false</canRoam>
21 <disabled>false</disabled>21 <disabled>false</disabled>
22 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>22 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>

Subscribers

People subscribed via source and target branches

to all changes: