concourse 0.4.0 → 0.5.0
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 +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +44 -39
- data/lib/concourse.rb +8 -8
- data/lib/concourse/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb83feeb6f40bcd3a194cb889cd7e8e65f43ff64
|
4
|
+
data.tar.gz: 424a8885d44e16eea6e702237f98cbdb5c55e041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d90b8f93734761e7241823c9375328f3126a21a6784772308c32305650030754fbc952f4f2cb32143c2207c8b2c54d468d9b8bcd1388f7253661ad23679f199
|
7
|
+
data.tar.gz: 43d44fcaa6c2af3d5c879aeb46473a1997698bd19653c6d2c12f48dda0e179b7e8eef8b43a5defc9480d2d39d19fa62f2db56874a9a811f6564d65bbf00f905d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# concourse-gem changelog
|
2
2
|
|
3
|
+
## 0.5.0 / 2017-01-23
|
4
|
+
|
5
|
+
Renamed the `concourse:tasks` task name arg, and improved the README.
|
6
|
+
|
7
|
+
|
8
|
+
## 0.4.0 / 2017-01-22
|
9
|
+
|
10
|
+
Now uses the project name as the `fly execute` input resource name.
|
11
|
+
|
12
|
+
|
13
|
+
## 0.3.0 / 2017-01-22
|
14
|
+
|
15
|
+
Avoid depending on `rake/clean`
|
16
|
+
|
17
|
+
|
3
18
|
## 0.2.0 / 2017-01-22
|
4
19
|
|
5
20
|
Always regenerate pipeline file.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Concourse
|
2
2
|
|
3
|
-
The `Concourse` gem
|
3
|
+
The `Concourse` gem provides rake tasks to help you manage your Concourse pipelines, and to assist in running individual tasks with `fly execute`.
|
4
4
|
|
5
5
|
If you're not familiar with Concourse CI, you can read up on it at https://concourse.ci
|
6
6
|
|
@@ -17,6 +17,42 @@ Concourse.new("myproject").create_tasks!
|
|
17
17
|
|
18
18
|
This will create a set of rake tasks for you.
|
19
19
|
|
20
|
+
Create a subdirectory named `concourse`, and edit a Concourse pipeline template named `myproject.yml.erb`.
|
21
|
+
|
22
|
+
|
23
|
+
### Templating and `RUBIES`
|
24
|
+
|
25
|
+
The ruby variable `RUBIES` is defined in the ERB binding during pipeline file generation. This variable looks like:
|
26
|
+
|
27
|
+
``` ruby
|
28
|
+
# these numbers/names align with public docker image names
|
29
|
+
RUBIES = {
|
30
|
+
mri: %w[2.1 2.2 2.3 2.4], # docker repository: "ruby"
|
31
|
+
jruby: %w[1.7 9.1], # docker repository: "jruby"
|
32
|
+
rbx: %w[latest], # docker repository: "rubinius/docker"
|
33
|
+
}
|
34
|
+
```
|
35
|
+
|
36
|
+
and allows you to write a pipeline like this to get coverage on all the supported rubies:
|
37
|
+
|
38
|
+
``` yaml
|
39
|
+
# myproject.yaml.erb
|
40
|
+
jobs:
|
41
|
+
<% for ruby_version in RUBIES[:mri] %>
|
42
|
+
- name: "ruby-<%= ruby_version %>"
|
43
|
+
plan:
|
44
|
+
- get: git-master
|
45
|
+
trigger: true
|
46
|
+
- task: rake-test
|
47
|
+
...
|
48
|
+
<% end %>
|
49
|
+
```
|
50
|
+
|
51
|
+
|
52
|
+
### `fly_target`
|
53
|
+
|
54
|
+
Any rake task that needs to interact with your Concourse ATC requires a `fly_target` argument. The value should be a fly target `name`, and it's assumed that you're already logged in to that target.
|
55
|
+
|
20
56
|
|
21
57
|
### Managing your Concourse pipeline
|
22
58
|
|
@@ -27,7 +63,7 @@ rake concourse:clean # remove generate pipeline file
|
|
27
63
|
rake concourse:generate # generate and validate the pipeline file for myproject
|
28
64
|
```
|
29
65
|
|
30
|
-
A task to
|
66
|
+
A task to update your pipeline configuration:
|
31
67
|
|
32
68
|
```
|
33
69
|
rake concourse:set[fly_target] # upload the pipeline file for myproject
|
@@ -47,49 +83,18 @@ rake concourse:pause[fly_target] # pause the myproject pipeline
|
|
47
83
|
rake concourse:unpause[fly_target] # unpause the myproject pipeline
|
48
84
|
```
|
49
85
|
|
86
|
+
|
50
87
|
### Running tasks with `fly execute`
|
51
88
|
|
52
89
|
```
|
53
|
-
rake concourse:tasks
|
54
|
-
rake concourse:task[fly_target,
|
55
|
-
```
|
56
|
-
|
57
|
-
where `fly_execute_args` will default to use the project name, e.g. `--input=myproject=.`, so your pipeline should name the input resource appropriately.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
### `fly_target`
|
62
|
-
|
63
|
-
The `fly_target` argument should be a fly target `name`, and the rake tasks assume that you're logged in already to that target.
|
64
|
-
|
65
|
-
|
66
|
-
### Templating and `RUBIES`
|
67
|
-
|
68
|
-
The ruby variable `RUBIES` is defined during the context of pipeline generation. The structure is something like:
|
69
|
-
|
70
|
-
``` ruby
|
71
|
-
# these numbers/names align with public docker image names
|
72
|
-
RUBIES = {
|
73
|
-
mri: %w[2.1 2.2 2.3 2.4], # docker repository: "ruby"
|
74
|
-
jruby: %w[1.7 9.1], # docker repository: "jruby"
|
75
|
-
rbx: %w[latest], # docker repository: "rubinius/docker"
|
76
|
-
}
|
90
|
+
rake concourse:tasks # list all the available tasks from the nokogiri pipeline
|
91
|
+
rake concourse:task[fly_target,job_task,fly_execute_args] # fly execute the specified task
|
77
92
|
```
|
78
93
|
|
79
|
-
|
94
|
+
where:
|
80
95
|
|
81
|
-
|
82
|
-
|
83
|
-
jobs:
|
84
|
-
<% for ruby_version in RUBIES[:mri] %>
|
85
|
-
- name: "ruby-<%= ruby_version %>"
|
86
|
-
plan:
|
87
|
-
- get: git-master
|
88
|
-
trigger: true
|
89
|
-
- task: rake-test
|
90
|
-
...
|
91
|
-
<% end %>
|
92
|
-
```
|
96
|
+
* _required_: `job_task` is formatted as `job-name/task-name`, for example, `ruby-2.4/rake-test`. Run the `concourse:tasks` rake task to see all available names.
|
97
|
+
* _optional_: `fly_execute_args` will default to map the project directory to a resource with the project name, e.g. `--input=myproject=.`, so your pipeline must name the input resource appropriately in order to use the default.
|
93
98
|
|
94
99
|
|
95
100
|
## Installation
|
data/lib/concourse.rb
CHANGED
@@ -81,21 +81,21 @@ class Concourse
|
|
81
81
|
end
|
82
82
|
|
83
83
|
puts "Available Concourse tasks for #{project_name} are:"
|
84
|
-
tasks.each { |task| puts " * #{task}" }
|
84
|
+
tasks.sort.each { |task| puts " * #{task}" }
|
85
85
|
end
|
86
86
|
|
87
87
|
desc "fly execute the specified task"
|
88
|
-
task "task", [:fly_target, :
|
88
|
+
task "task", [:fly_target, :job_task, :fly_execute_args] => "generate" do |t, args|
|
89
89
|
fly_target = Concourse.validate_fly_target t, args
|
90
|
-
|
90
|
+
job_task = args[:job_task]
|
91
91
|
fly_execute_args = args[:fly_execute_args] || "--input=#{project_name}=."
|
92
92
|
|
93
|
-
unless
|
93
|
+
unless job_task
|
94
94
|
raise "ERROR: must specify a task name, like `rake #{t.name}[target,taskname]`"
|
95
95
|
end
|
96
96
|
|
97
|
-
concourse_task = find_task
|
98
|
-
raise "ERROR: could not find task `#{
|
97
|
+
concourse_task = find_task job_task
|
98
|
+
raise "ERROR: could not find task `#{job_task}`" unless concourse_task
|
99
99
|
|
100
100
|
puts concourse_task.to_yaml
|
101
101
|
Tempfile.create do |f|
|
@@ -117,8 +117,8 @@ class Concourse
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
def find_task
|
121
|
-
job_name, task_name = *
|
120
|
+
def find_task job_task
|
121
|
+
job_name, task_name = *job_task.split("/")
|
122
122
|
each_task do |job, task|
|
123
123
|
return task if task["task"] == task_name && job["name"] == job_name
|
124
124
|
end
|
data/lib/concourse/version.rb
CHANGED