concourse 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +39 -1
- data/lib/concourse.rb +22 -18
- data/lib/concourse/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 309f76ecec1a0a549b9f35131415667cc260857e
|
4
|
+
data.tar.gz: 0bd5fe1842f603a620c853d34c61be8009436595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 301f6a4ebed72c0711407ef3b7af0ede4b0b6a2483682e07c1dbc5e3c33ba52e9601433c8d1ee13643cae7cfd3f340f1bfa154daac2478aefa3b778eddb53d69
|
7
|
+
data.tar.gz: '08723c8657265c31e5ee2c90e5685207751020984080f8c4b38b5859e35a9d5b790b763cf88fce25e17005e2bb0aa58b57caa55eda7f111f035f19be80e294dd'
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -17,7 +17,45 @@ Concourse.new("myproject").create_tasks!
|
|
17
17
|
|
18
18
|
This will create a set of rake tasks for you.
|
19
19
|
|
20
|
-
|
20
|
+
``` sh
|
21
|
+
rake concourse:init
|
22
|
+
```
|
23
|
+
|
24
|
+
The `concourse:init` task will create a subdirectory named `concourse`, and create a Concourse pipeline file named `myproject.yml`, which will be interpreted as an ERB template. It will also ensure that files with sensitive data (`concourse/private.yml` and `concourse/myproject.final.yml`) are in `.gitignore`.
|
25
|
+
|
26
|
+
|
27
|
+
### Concourse subdirectory name
|
28
|
+
|
29
|
+
You can choose a directory name other than `concourse`:
|
30
|
+
|
31
|
+
``` ruby
|
32
|
+
Concourse.new("myproject", directory: "ci").create_tasks!
|
33
|
+
```
|
34
|
+
|
35
|
+
|
36
|
+
### Keeping credentials private
|
37
|
+
|
38
|
+
If the file `concourse/private.yml` exists, it will be passed to the `fly` commandline with the `-l` option to fill in template values.
|
39
|
+
|
40
|
+
For example, I might have a concourse config that looks like this:
|
41
|
+
|
42
|
+
``` yaml
|
43
|
+
- name: nokogiri-pr
|
44
|
+
type: pull-request
|
45
|
+
source:
|
46
|
+
repo: sparklemotion/nokogiri
|
47
|
+
access_token: {{github-repo-status-access-token}}
|
48
|
+
ignore_paths:
|
49
|
+
- concourse/**
|
50
|
+
```
|
51
|
+
|
52
|
+
I can put my access token in `private.yml` like this:
|
53
|
+
|
54
|
+
``` yaml
|
55
|
+
github-repo-status-access-token: "your-token-here"
|
56
|
+
```
|
57
|
+
|
58
|
+
and the final generate template will substitute your credentials into the appropriate place.
|
21
59
|
|
22
60
|
|
23
61
|
### Templating and `RUBIES`
|
data/lib/concourse.rb
CHANGED
@@ -11,10 +11,9 @@ class Concourse
|
|
11
11
|
rbx: %w[latest], # docker repository: "rubinius/docker"
|
12
12
|
}
|
13
13
|
|
14
|
-
|
15
|
-
PRIVATE_VAR_FILE = File.join DIRECTORY, "private.yml"
|
14
|
+
DEFAULT_DIRECTORY = "concourse"
|
16
15
|
|
17
|
-
attr_reader :project_name, :pipeline_filename, :pipeline_erb_filename
|
16
|
+
attr_reader :project_name, :pipeline_filename, :pipeline_erb_filename, :directory, :private_var_file
|
18
17
|
|
19
18
|
def self.validate_fly_target task, task_args
|
20
19
|
unless task_args[:fly_target]
|
@@ -29,19 +28,30 @@ class Concourse
|
|
29
28
|
matching_line.split(/ +/)[1]
|
30
29
|
end
|
31
30
|
|
32
|
-
def initialize project_name
|
31
|
+
def initialize project_name, directory: DEFAULT_DIRECTORY
|
33
32
|
@project_name = project_name
|
34
|
-
@
|
35
|
-
@
|
33
|
+
@directory = directory
|
34
|
+
@pipeline_filename = File.join(@directory, "#{project_name}.final.yml")
|
35
|
+
@pipeline_erb_filename = File.join(@directory, "#{project_name}.yml")
|
36
|
+
@private_var_file = File.join(@directory, "private.yml")
|
36
37
|
end
|
37
38
|
|
38
39
|
def erbify document_string, *args
|
39
40
|
ERB.new(document_string, nil, "%-").result(binding)
|
40
41
|
end
|
41
42
|
|
43
|
+
def rake_init
|
44
|
+
FileUtils.mkdir_p File.join(directory, "tasks")
|
45
|
+
FileUtils.touch pipeline_erb_filename
|
46
|
+
File.open ".gitignore", "a" do |f|
|
47
|
+
f.puts private_var_file
|
48
|
+
f.puts pipeline_filename
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
42
52
|
def create_tasks!
|
43
|
-
unless Dir.exist?
|
44
|
-
mkdir_p
|
53
|
+
unless Dir.exist? directory
|
54
|
+
mkdir_p directory
|
45
55
|
end
|
46
56
|
|
47
57
|
unless File.exist? pipeline_erb_filename
|
@@ -56,13 +66,7 @@ class Concourse
|
|
56
66
|
#
|
57
67
|
desc "bootstrap a concourse config"
|
58
68
|
task :init do
|
59
|
-
|
60
|
-
FileUtils.mkdir_p "concourse/tasks"
|
61
|
-
FileUtils.touch pipeline_erb_filename
|
62
|
-
File.open ".gitignore", "a" do |f|
|
63
|
-
f.puts "concourse/private.yml"
|
64
|
-
f.puts "concourse/#{project_name}.final.yml"
|
65
|
-
end
|
69
|
+
rake_init
|
66
70
|
end
|
67
71
|
|
68
72
|
#
|
@@ -83,9 +87,9 @@ class Concourse
|
|
83
87
|
"-p '#{project_name}'",
|
84
88
|
"-c '#{pipeline_filename}'",
|
85
89
|
]
|
86
|
-
if File.exist?
|
87
|
-
puts "using #{
|
88
|
-
options << "-l '#{
|
90
|
+
if File.exist? private_var_file
|
91
|
+
puts "using #{private_var_file} to resolve template vars"
|
92
|
+
options << "-l '#{private_var_file}'"
|
89
93
|
end
|
90
94
|
sh "fly -t #{fly_target} set-pipeline #{options.join(" ")}"
|
91
95
|
end
|
data/lib/concourse/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concourse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.6.
|
94
|
+
rubygems_version: 2.6.10
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Rake tasks for Concourse pipelines.
|