Skip to content

Commit 1e1fa87

Browse files
authored
Merge pull request #11 from ktreis/copyartifact
Add a builder for `copyartifact`
2 parents a83a69b + 07135a9 commit 1e1fa87

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ The following sections and components are supported:
111111
* `scm`: (`git`, `store`)
112112
* `triggers`: (`pollscm`, `pollurl`, `reverse`)
113113
* `wrappers`: (`timeout`, `timestamps`)
114-
* `builders`: (`shell`)
115-
* `publishers`: (`archive`, `cppcheck`, `email_ext`, `fitnesse`, `ircbot`, `junit`,
114+
* `builders`: (`copyartifact`, `shell`)
115+
* `publishers`: (`archive`, `cppcheck`, `email_ext`, `fitnesse`, `ircbot`, `junit`,
116116
`trigger`, `trigger_parameterized_builds`, `unittest`, `xunit`)
117117
* `notifications`: None defined yet
118118

acceptance/fixtures/endToEnd/endToEnd.job

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ job "endToEnd" do |j|
5151
j.wrappers << timeout(type: 'elastic', elastic_percentage: 150, elastic_default_timeout: 5, fail: true)
5252
j.wrappers << timestamps
5353

54+
j.builders << copyartifact(project: "PROJECT", filter: "FILTER", target: "TARGET", flatten: true)
5455
j.builders << shell("COMMAND")
5556

5657
j.publishers << archive(artifacts: "ARTIFACTS", latest_only: true, allow_empty: true)

acceptance/fixtures/endToEnd/expected.yml

+5
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
fail: true
9191
- timestamps
9292
builders:
93+
- copyartifact:
94+
project: PROJECT
95+
filter: FILTER
96+
target: TARGET
97+
flatten: true
9398
- shell: COMMAND
9499
publishers:
95100
- archive:

lib/jujube/components/builders.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ module Components
33

44
# Helper methods for creating builder components.
55
module Builders
6+
extend Macros
7+
8+
# @!method copyartifact(options = {})
9+
# Specify a `copyartifact` builder for a job. Requires the `copyartifact` plugin.
10+
#
11+
# See {https://docs.openstack.org/infra/jenkins-job-builder/builders.html#builders.copyartifact}.
12+
#
13+
# @param options [Hash] The configuration options for the component.
14+
# @return [Hash] The specification for the component.
15+
standard_component :copyartifact
616

717
# Specify a `shell` builder for a job.
818
#
@@ -13,7 +23,6 @@ module Builders
1323
def shell(command)
1424
{'shell' => command}
1525
end
16-
1726
end
1827
end
1928
end

test/components/builders_test.rb

+18
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
class BuildersTest < Minitest::Test
44
include Jujube::Components
55

6+
def test_copyartifact
7+
result = copyartifact(
8+
project: 'upstream-project',
9+
which_build: 'last-successful',
10+
target: 'dest_dir',
11+
do_not_fingerprint: true
12+
)
13+
expected = {
14+
'copyartifact' => {
15+
'project' => 'upstream-project',
16+
'which-build' => 'last-successful',
17+
'target' => 'dest_dir',
18+
'do-not-fingerprint' => true
19+
}
20+
}
21+
assert_equal(expected, result)
22+
end
23+
624
def test_shell
725
expected = {'shell' => 'COMMAND'}
826
assert_equal(expected, shell('COMMAND'))

0 commit comments

Comments
 (0)