autoproj-jenkins 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autoproj/cli/jenkins.rb +5 -2
- data/lib/autoproj/jenkins/server.rb +5 -0
- data/lib/autoproj/jenkins/templates/library.pipeline.erb +22 -10
- data/lib/autoproj/jenkins/templates/package.pipeline.erb +6 -1
- data/lib/autoproj/jenkins/templates/package.xml.erb +1 -1
- data/lib/autoproj/jenkins/updater.rb +7 -9
- data/lib/autoproj/jenkins/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76ebc8d50e5283f36c0898480889013c8c3da5b3
|
4
|
+
data.tar.gz: 514d13bd43cdc4dc00aed8627197244898e1eeec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 820ad5b828f8bce136c9052b3c807577a0c1ce520dddafc3d09d9dcda648138d13afd520a18c338b94a0116a385078f6bb72293ef240ac0b169b92f056c34b8c
|
7
|
+
data.tar.gz: 6345557039b3ab9a432e26e5f0abbad807d0656ccb348e5ddb15a97cdecc183b6bfc35ca466691988425dc36d30100ece6a102fc8b4bc6f0fd94b974b1e28551
|
data/lib/autoproj/cli/jenkins.rb
CHANGED
@@ -33,8 +33,11 @@ module Autoproj
|
|
33
33
|
autoproj_install_path = nil
|
34
34
|
end
|
35
35
|
|
36
|
-
finalize_setup(package_names, recursive: false, non_imported_packages: :return)
|
37
|
-
|
36
|
+
source_packages, _ = finalize_setup(package_names, recursive: false, non_imported_packages: :return)
|
37
|
+
source_packages = source_packages.map do |package_name|
|
38
|
+
ws.manifest.package_definition_by_name(package_name)
|
39
|
+
end
|
40
|
+
updater.create_or_update_buildconf_job(*source_packages, gemfile: gemfile,
|
38
41
|
autoproj_install_path: autoproj_install_path, dev: dev,
|
39
42
|
credentials_id: credentials_id,
|
40
43
|
vcs_credentials: parse_vcs_credentials(vcs_credentials))
|
@@ -49,6 +49,11 @@ module Autoproj::Jenkins
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
# Render a pipeline script
|
53
|
+
def render_pipeline(job_name, template, **parameters)
|
54
|
+
Autoproj::Jenkins.render_template(template, **parameters)
|
55
|
+
end
|
56
|
+
|
52
57
|
# Test whether the server already has a job
|
53
58
|
#
|
54
59
|
# @param [String] job_name
|
@@ -83,7 +83,13 @@ def getUpstreamBuilds(upstreamJobNames, triggerJob, triggerBuild)
|
|
83
83
|
else {
|
84
84
|
echo "manual build trigger, using last successful build for ${jobName}"
|
85
85
|
}
|
86
|
-
|
86
|
+
if (job.getLastSuccessfulBuild())
|
87
|
+
matchingBuild = job.getLastSuccessfulBuild().getNumber()
|
88
|
+
else
|
89
|
+
{
|
90
|
+
echo "${jobName} has no successful build, aborting"
|
91
|
+
return;
|
92
|
+
}
|
87
93
|
}
|
88
94
|
echo "upstream build: ${jobName}#${matchingBuild}"
|
89
95
|
upstreamBuilds << [jobName, matchingBuild]
|
@@ -94,11 +100,9 @@ def getUpstreamBuilds(upstreamJobNames, triggerJob, triggerBuild)
|
|
94
100
|
|
95
101
|
def waitForUpstreamBuilds(upstreamBuilds)
|
96
102
|
{
|
97
|
-
def
|
98
|
-
|
103
|
+
def skipBuild = false;
|
104
|
+
waitUntil
|
99
105
|
{
|
100
|
-
waitContinue = false;
|
101
|
-
|
102
106
|
// Iterate list -- NOTE: we cannot use groovy style or even modern java style iteration
|
103
107
|
for (upstreamBuildIndex = 0; upstreamBuildIndex < upstreamBuilds.size(); ++upstreamBuildIndex)
|
104
108
|
{
|
@@ -109,19 +113,27 @@ def waitForUpstreamBuilds(upstreamBuilds)
|
|
109
113
|
if (status == 'IN_PROGRESS')
|
110
114
|
{
|
111
115
|
echo "waiting for job ${upstreamJobName}#${upstreamBuildId} to finish"
|
112
|
-
|
113
|
-
sleep time: 1, units: 'SECONDS'
|
116
|
+
return false;
|
114
117
|
}
|
115
118
|
else if (status == 'FAILED')
|
116
119
|
{
|
117
120
|
echo "${upstreamJobName}#${upstreamBuildId} did not finish successfully, aborting this build"
|
118
|
-
|
119
|
-
return
|
121
|
+
skipBuild = true;
|
122
|
+
return true;
|
120
123
|
}
|
121
124
|
}
|
125
|
+
return true;
|
122
126
|
}
|
123
|
-
return true
|
124
127
|
|
128
|
+
if (skipBuild)
|
129
|
+
{
|
130
|
+
currentBuild.result = 'NOT_BUILT';
|
131
|
+
return false;
|
132
|
+
}
|
133
|
+
else
|
134
|
+
{
|
135
|
+
return true;
|
136
|
+
}
|
125
137
|
}
|
126
138
|
|
127
139
|
def makeUpstreamArtifactImporters(autoproj, fullWorkspaceDir, upstreamDir,
|
@@ -17,8 +17,13 @@ stage('waiting for upstream jobs to finish') {
|
|
17
17
|
triggeredByUpstream = false;
|
18
18
|
triggerBuild = [null, null];
|
19
19
|
}
|
20
|
-
upstreamBuilds = getUpstreamBuilds(upstreamJobNames, triggerBuild[0], triggerBuild[1])
|
21
20
|
|
21
|
+
def upstreamBuilds = getUpstreamBuilds(upstreamJobNames, triggerBuild[0], triggerBuild[1])
|
22
|
+
if (!upstreamBuilds)
|
23
|
+
{
|
24
|
+
currentBuild.result = 'NOT_BUILT';
|
25
|
+
return;
|
26
|
+
}
|
22
27
|
if (!waitForUpstreamBuilds(upstreamBuilds)) {
|
23
28
|
return
|
24
29
|
}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<description></description>
|
5
5
|
<keepDependencies>false</keepDependencies>
|
6
6
|
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.9">
|
7
|
-
<script
|
7
|
+
<script><%= pipeline %></script>
|
8
8
|
<sandbox>false</sandbox>
|
9
9
|
</definition>
|
10
10
|
<triggers/>
|
@@ -147,13 +147,6 @@ module Autoproj::Jenkins
|
|
147
147
|
def update(*packages, quiet_period: 5, gemfile: 'buildconf-Gemfile', autoproj_install_path: nil, vcs_credentials: Credentials.new)
|
148
148
|
reverse_dependencies = ws.manifest.compute_revdeps
|
149
149
|
|
150
|
-
packages.each do |package|
|
151
|
-
job_name = job_name_from_package_name(package.name)
|
152
|
-
server.create_or_reset_job(
|
153
|
-
job_name, 'package.xml',
|
154
|
-
quiet_period: quiet_period)
|
155
|
-
end
|
156
|
-
|
157
150
|
package_names = packages.map(&:name).to_set
|
158
151
|
packages.map do |package|
|
159
152
|
job_name = job_name_from_package_name(package.name)
|
@@ -161,7 +154,7 @@ module Autoproj::Jenkins
|
|
161
154
|
raise UnhandledVCS, "the #{package.vcs.type} importer, used by #{package.name}, is not supported by autoproj-jenkins"
|
162
155
|
end
|
163
156
|
|
164
|
-
upstream_jobs
|
157
|
+
upstream_jobs = compute_job_to_package_map(compute_upstream_packages(package), package_names)
|
165
158
|
downstream_jobs = compute_job_to_package_map(compute_downstream_packages(package, reverse_dependencies), package_names)
|
166
159
|
|
167
160
|
prefix_relative_path =
|
@@ -172,7 +165,7 @@ module Autoproj::Jenkins
|
|
172
165
|
"install/#{package.name}"
|
173
166
|
end
|
174
167
|
|
175
|
-
server.
|
168
|
+
pipeline = server.render_pipeline(job_name, 'package.pipeline',
|
176
169
|
buildconf_vcs: ws.manifest.vcs,
|
177
170
|
vcs: package.vcs,
|
178
171
|
package_name: package.name,
|
@@ -185,6 +178,11 @@ module Autoproj::Jenkins
|
|
185
178
|
autoproj_install_path: autoproj_install_path,
|
186
179
|
vcs_credentials: vcs_credentials)
|
187
180
|
|
181
|
+
server.create_or_reset_job(
|
182
|
+
job_name, 'package.xml',
|
183
|
+
pipeline: pipeline,
|
184
|
+
quiet_period: quiet_period)
|
185
|
+
|
188
186
|
job_name
|
189
187
|
end
|
190
188
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoproj-jenkins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jenkins_api_client
|