autoproj-jenkins 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0b068687531e0f0b3783cbe4b2fd95a62ec28c0
|
4
|
+
data.tar.gz: 4a1d865d39359263e886c881e470cdcd53c41af4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94bebe22fed809b955a8b387908ee823455e25a2e80c3ac9a53a02998de9553eada1cfd83b8e661b25d7a3378b046af8f83c613d2232a6aa0ea9ba744190aae2
|
7
|
+
data.tar.gz: 2cb32c59bb218aaa6c741bc896f548290c505c6c217772b5c4ea152daf5a69cd87cbc2a59b6d0c90cc04f3fcfa55ea939cb98452fe7e4875572ca701eb1d26f0
|
@@ -22,8 +22,9 @@ module Autoproj::Jenkins
|
|
22
22
|
# @param [String] template the name of the template
|
23
23
|
# @param [Hash] parameters parameters for the template rendering
|
24
24
|
# @raise (see Autoproj::Jenkins.render_template)
|
25
|
-
def create_job(job_name, template, **parameters)
|
25
|
+
def create_job(job_name, template, pipeline: '', **parameters)
|
26
26
|
xml = Autoproj::Jenkins.render_template(template, **parameters)
|
27
|
+
xml = update_pipeline_in_config(xml, pipeline)
|
27
28
|
jobs.create(job_name, xml)
|
28
29
|
end
|
29
30
|
|
@@ -33,19 +34,33 @@ module Autoproj::Jenkins
|
|
33
34
|
# @param [String] template the name of the template
|
34
35
|
# @param [Hash] parameters parameters for the template rendering
|
35
36
|
# @raise (see Autoproj::Jenkins.render_template)
|
36
|
-
def reset_job(job_name, template, **parameters)
|
37
|
+
def reset_job(job_name, template, pipeline: '', **parameters)
|
37
38
|
xml = Autoproj::Jenkins.render_template(template, **parameters)
|
39
|
+
xml = update_pipeline_in_config(xml, pipeline)
|
38
40
|
jobs.update(job_name, xml)
|
39
41
|
end
|
40
42
|
|
43
|
+
# Update the pipeline script in a job config
|
44
|
+
def update_pipeline_in_config(config, pipeline)
|
45
|
+
if config.respond_to?(:to_str)
|
46
|
+
config = REXML::Document.new(config)
|
47
|
+
end
|
48
|
+
config.elements['//definition/script'].text = pipeline
|
49
|
+
config.to_s
|
50
|
+
end
|
51
|
+
|
41
52
|
# Either create or reset a job, depending on whether it already exists
|
42
53
|
# or not
|
43
|
-
|
54
|
+
#
|
55
|
+
# @param [String,nil] pipeline the job's pipeline script
|
56
|
+
def create_or_reset_job(job_name, template, pipeline: '', **parameters)
|
44
57
|
xml = Autoproj::Jenkins.render_template(template, **parameters)
|
58
|
+
xml = update_pipeline_in_config(xml, pipeline)
|
59
|
+
|
45
60
|
if has_job?(job_name)
|
46
|
-
|
61
|
+
jobs.update(job_name, xml.to_s)
|
47
62
|
else
|
48
|
-
|
63
|
+
jobs.create(job_name, xml.to_s)
|
49
64
|
end
|
50
65
|
end
|
51
66
|
|
@@ -93,7 +108,7 @@ module Autoproj::Jenkins
|
|
93
108
|
def update_job_pipeline(job_name, template, **parameters)
|
94
109
|
config = read_job_config(job_name)
|
95
110
|
pipeline = Autoproj::Jenkins.render_template(template, **parameters)
|
96
|
-
config
|
111
|
+
update_pipeline_in_config(config, pipeline)
|
97
112
|
update_job_config(job_name, config)
|
98
113
|
end
|
99
114
|
|
@@ -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 />
|
8
8
|
<sandbox>false</sandbox>
|
9
9
|
</definition>
|
10
10
|
<triggers/>
|
@@ -50,14 +50,14 @@ module Autoproj::Jenkins
|
|
50
50
|
# with --dev or not
|
51
51
|
# @param [Array<Autoproj::PackageDefinition>] packages if non-empty,
|
52
52
|
# restrict operations to these packages and their dependencies
|
53
|
-
def
|
53
|
+
def render_buildconf_pipeline(*package_names, gemfile: 'buildconf-Gemfile', autoproj_install_path: nil, dev: false, credentials_id: nil, vcs_credentials: Credentials.new)
|
54
54
|
manifest_vcs = ws.manifest.vcs
|
55
55
|
if manifest_vcs.local? || manifest_vcs.none?
|
56
56
|
raise ArgumentError, "cannot use Jenkins to build an autoproj buildconf that is not on a remotely acessible VCS"
|
57
57
|
end
|
58
58
|
|
59
59
|
job_name = job_name_from_package_name("buildconf")
|
60
|
-
server.
|
60
|
+
server.render_pipeline(job_name, 'buildconf.pipeline',
|
61
61
|
vcs: manifest_vcs,
|
62
62
|
package_names: package_names,
|
63
63
|
gemfile: gemfile,
|
@@ -79,15 +79,15 @@ module Autoproj::Jenkins
|
|
79
79
|
# Mostly used within autoproj-jenkins tests
|
80
80
|
def create_or_update_buildconf_job(*package_names, gemfile: 'buildconf-Gemfile', autoproj_install_path: nil, dev: false, quiet_period: 5, credentials_id: nil, vcs_credentials: Credentials.new)
|
81
81
|
job_name = job_name_from_package_name("buildconf")
|
82
|
-
server.create_or_reset_job(job_name, 'buildconf.xml', quiet_period: quiet_period)
|
83
82
|
|
84
|
-
|
83
|
+
pipeline = render_buildconf_pipeline(
|
85
84
|
*package_names,
|
86
85
|
gemfile: gemfile,
|
87
86
|
autoproj_install_path: autoproj_install_path,
|
88
87
|
credentials_id: credentials_id,
|
89
88
|
vcs_credentials: vcs_credentials,
|
90
89
|
dev: dev)
|
90
|
+
server.create_or_reset_job(job_name, 'buildconf.xml', pipeline: pipeline, quiet_period: quiet_period)
|
91
91
|
end
|
92
92
|
|
93
93
|
# Returns the job name of a given package
|