Skip to content

Commit b36de6e

Browse files
committed
[multi-user CI] introduce more parameters
1 parent cde9f74 commit b36de6e

File tree

14 files changed

+44
-37
lines changed

14 files changed

+44
-37
lines changed

libraries/job_blurbs.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ def scmBlurb(refspec)
144144
EOH
145145
end
146146

147-
def versionedJob(version, name)
148-
"scala-#{version}-#{name.gsub(/\//, '-')}"
147+
def versionedJob(repo, branch, name)
148+
"#{repo}-#{branch}-#{name.gsub(/\//, '-')}"
149149
end
150150

151151
def job(name)
152-
versionedJob(@version, name)
152+
versionedJob(@repo, @branch, name)
153153
end
154154

155155
def jvmSelect

recipes/_master-jenkins-jobs.rb

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Blurbs
2121
end
2222

2323
# turn template path into jenkins job name
24-
def templDesc(version, path)
24+
def templDesc(user, repo, branch, path)
2525
blurbs = Blurbs.new
2626

2727
m = path.match(/templates\/default\/jobs\/(.*)\.xml\.erb$/)
@@ -32,8 +32,10 @@ def templDesc(version, path)
3232

3333
[ { :templatePath => "jobs/#{relativePath}.xml.erb",
3434
:scriptName => "jobs/#{relativePath}",
35-
:jobName => blurbs.versionedJob(version, relativePath),
36-
:version => version
35+
:jobName => blurbs.versionedJob(repo, branch, relativePath),
36+
:user => user,
37+
:repo => repo,
38+
:branch => branch,
3739
}
3840
]
3941
end
@@ -55,11 +57,9 @@ def templDesc(version, path)
5557
# - 9
5658
# core-community: sbt, ensime, modules, ide,...
5759

58-
# create scala-$version-$jobName for every template under jobs/
59-
# TODO #16: add 2.12.x jobs
60-
%w{ 2.11.x }.each do | version |
60+
def expandJobTemplates(user, repo, branch)
6161
node.run_context.cookbook_collection["scala-jenkins-infra"].manifest[:templates]
62-
.flat_map { |mani| templDesc(version, mani['path']) }
62+
.flat_map { |mani| templDesc(user, repo, branch, mani['path']) }
6363
.each do | desc |
6464

6565
xml = File.join(Chef::Config[:file_cache_path], "#{desc[:jobName]}.xml")
@@ -77,6 +77,13 @@ def templDesc(version, path)
7777
end
7878
end
7979

80+
# TODO: make consistent with scabot.conf.erb by construction
81+
# create scala-$branch-$jobName for every template under jobs/
82+
%w{ 2.11.x 2.12.x }.each do | branch |
83+
expandJobTemplates("scala", "scala", branch)
84+
end
85+
86+
8087
# TODO #10: make a view for each top-level directory under jobs/ that lists all jobs under it (scala-2.11.x-integrate, scala-2.11.x-release, scala-2.11.x-validate)
8188
# https://issues.jenkins-ci.org/browse/JENKINS-8927
8289
def viewXML(viewPrefix)
@@ -105,4 +112,4 @@ def viewXML(viewPrefix)
105112
<statusFilter>true</statusFilter>
106113
</listView>
107114
EOH
108-
end
115+
end

templates/default/jobs/integrate/bootstrap.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: %{ Stage a Scala distribution on sonatype using scripts/job/bootstrap.
88
It builds locker and uses it to build and publish the required modules as well as the
99
Scala compiler/library for this release, and generates an updated versions.properties

templates/default/jobs/integrate/ide.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "PR integration testing: IDE",
88
nodeRestriction: "public",
99
params: [

templates/default/jobs/integrate/main.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<com.cloudbees.plugins.flow.BuildFlow plugin="[email protected]">
33
<%= flowProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "PR integration -- verify mergeability of PR",
88
params: [
99
{:name => "prDryRun", :desc => ""},

templates/default/jobs/release/main.xml.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<com.cloudbees.plugins.flow.BuildFlow plugin="[email protected]">
33
<%= flowProject(
4-
repoUser: "scala",
5-
repoRef: @version,
6-
description: "TODO: Better description. Build, package and stage a Scala release. \nNightly downloads go to http://www.scala-lang.org/files/archive/nightly/#{@version}/\nRegular ones to http://www.scala-lang.org/files/archive/.",
4+
repoUser: @user,
5+
repoRef: @branch,
6+
description: "TODO: Better description. Build, package and stage a Scala release. \nNightly downloads go to http://www.scala-lang.org/files/archive/nightly/#{@branch}/\nRegular ones to http://www.scala-lang.org/files/archive/.",
77
params: [
88
{:name => "SCALA_VER_BASE", :desc => "When set, a release with version \"$SCALA_VER_BASE$SCALA_VER_SUFFIX\" will be built. Same effect as for tagging $repo_ref as \"v$SCALA_VER_BASE$SCALA_VER_SUFFIX\"."},
99
{:name => "SCALA_VER_SUFFIX", :desc => ""}

templates/default/jobs/release/package/unix.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala-dist",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "Run as part of the #{job("release/main")} flow.<p>" + %{Builds and uploads the universal and unix-specific artifacts for a
88
Scala release.<br>
99

templates/default/jobs/release/package/windows.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala-dist",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "Run as part of the #{job("release/main")} flow.<p>" + %{Builds and uploads the windows-specific artifacts for a Scala
88
release.<br>
99

templates/default/jobs/release/smoketest.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala-dist-smoketest",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "Run as part of the #{job("release/main")} flow." + %{ <br/> It runs the program in
88
https://github.com/scala/scala-dist-smoketest/tree/${repo_ref} to make sure all JARs of the distribution
99
contain classfiles. <br/> It downloads the archives for a Scala release from

templates/default/jobs/release/website/archives.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala-dist",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "<H1>Run as part of the #{job("release/main")} flow.</H1>" +
88
%{<p>It downloads the archives for a Scala release
99
from http://downloads.typesafe.com/scala/$version/index.html and

templates/default/jobs/release/website/update-api.xml.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala-dist",
6-
repoRef: @version,
7-
description: "Update scala-lang's api/#{@version} symlink to point to api/$version",
6+
repoRef: @branch,
7+
description: "Update scala-lang's api/#{@branch} symlink to point to api/$version",
88
nodeRestriction: "linux && publish",
99
concurrent: false,
1010
params: [

templates/default/jobs/validate/main.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<com.cloudbees.plugins.flow.BuildFlow plugin="[email protected]">
33
<%= flowProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "PR validation -- called for every commit in every PR",
88
params: [
99
{:name => "prDryRun", :desc => ""},

templates/default/jobs/validate/publish-core.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "PR validation: publish core",
88
nodeRestriction: "public",
99
params: [

templates/default/jobs/validate/test.xml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project>
33
<%= githubProject(
4-
repoUser: "scala",
4+
repoUser: @user,
55
repoName: "scala",
6-
repoRef: @version,
6+
repoRef: @branch,
77
description: "PR validation: test suite",
88
nodeRestriction: "public",
99
params: [

0 commit comments

Comments
 (0)