cide 0.8.1 → 0.9.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 +12 -0
- data/Gemfile.lock +1 -1
- data/cide +1 -1
- data/cide.gemspec +1 -1
- data/docs/cide.yml.md +1 -0
- data/docs/sidebar.md +1 -1
- data/lib/cide/cli.rb +25 -6
- data/lib/cide/config_file.rb +7 -0
- data/lib/cide/config_file_loader.rb +41 -0
- data/lib/cide/default_cide.yml +4 -0
- data/man/cide.yml.1.md +23 -0
- data/script/build +4 -10
- data/spec/build_config_loader_spec.rb +1 -0
- metadata +3 -3
- data/docs/cide.yml.md +0 -154
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5592aec3c435216f8c55c34bffc949a8ac9974b5
|
4
|
+
data.tar.gz: 29018828dccd8df7788167c46c76331aba44fa8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4adf57d0aec771685bf7b489523022d678321a23bef3faedf46ff1c1e2ad359bcb5edc02d4e5b6e180496201e3949150cb3943214db129ec7c1d71ae0240f476
|
7
|
+
data.tar.gz: 7e30ef9be4e887f2f7d80eda12c8072677ec66e8b4e2116dd1e6fb291334645f4191e7e0d0058114ec682d685bc31dac47969212d8759e9f8801bd962aeb8479
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
|
2
|
+
0.9.0 / 2016-02-26
|
3
|
+
==================
|
4
|
+
|
5
|
+
* NEW: setting to inject versions in your package
|
6
|
+
|
7
|
+
```yaml
|
8
|
+
package:
|
9
|
+
add_version:auto
|
10
|
+
```
|
11
|
+
|
12
|
+
* NEW: add `cide package --build-id` to identify archives
|
13
|
+
|
2
14
|
0.8.1 / 2016-02-15
|
3
15
|
==================
|
4
16
|
|
data/Gemfile.lock
CHANGED
data/cide
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
direnv exec
|
2
|
+
direnv exec "$(dirname $0)" "$(dirname $0)/bin/cide" "$@"
|
data/cide.gemspec
CHANGED
data/docs/cide.yml.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
../man/cide.yml.1.md
|
data/docs/sidebar.md
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
- [man 1 cide](#man/cide.1)
|
17
17
|
- [man 1 cide-clean](#man/cide-clean.1)
|
18
18
|
- [man 1 cide-debug](#man/cide-debug.1)
|
19
|
-
- [man 1 cide-exec](#man/cide-
|
19
|
+
- [man 1 cide-exec](#man/cide-exec.1)
|
20
20
|
- [man 1 cide-init](#man/cide-init.1)
|
21
21
|
- [man 1 cide-package](#man/cide-package.1)
|
22
22
|
- [man 1 cide.yml](#man/cide.yml.1)
|
data/lib/cide/cli.rb
CHANGED
@@ -123,8 +123,8 @@ module CIDE
|
|
123
123
|
type: :boolean,
|
124
124
|
default: true
|
125
125
|
|
126
|
-
method_option '
|
127
|
-
desc: '
|
126
|
+
method_option 'build_id',
|
127
|
+
desc: 'Specifies the build id',
|
128
128
|
default: nil
|
129
129
|
|
130
130
|
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION need to be passed
|
@@ -144,20 +144,30 @@ module CIDE
|
|
144
144
|
|
145
145
|
FileUtils.rm_rf(build_root)
|
146
146
|
|
147
|
-
|
147
|
+
build_id = options.build_id || (
|
148
|
+
timestamp = Time.now.strftime('%Y-%m-%d_%H%M%S')
|
148
149
|
git_branch = `git symbolic-ref --short -q HEAD || echo unknown`.strip
|
149
150
|
git_rev = `git rev-parse --short HEAD`.strip
|
150
|
-
"#{git_branch}-#{git_rev}"
|
151
|
+
"#{timestamp}.#{git_branch}-#{git_rev}"
|
151
152
|
)
|
152
153
|
|
153
|
-
|
154
|
-
tar_name = "#{options.package}.#{timestamp}.#{version}.tar.gz"
|
154
|
+
tar_name = "#{options.package}.#{build_id}.tar.gz"
|
155
155
|
tar_path = File.join(build_root, tar_name)
|
156
156
|
|
157
157
|
banner 'Config'
|
158
158
|
config = ConfigFile.load(Dir.pwd)
|
159
159
|
say_status :config, config.inspect
|
160
160
|
|
161
|
+
version_data =
|
162
|
+
case config.package && config.package.add_version
|
163
|
+
when 'sha'
|
164
|
+
`git rev-parse HEAD`.strip
|
165
|
+
when 'short_sha'
|
166
|
+
`git rev-parse --short HEAD`.strip
|
167
|
+
when 'auto'
|
168
|
+
build_id
|
169
|
+
end
|
170
|
+
|
161
171
|
## Build ##
|
162
172
|
banner 'Build'
|
163
173
|
builder = Builder.new(config)
|
@@ -185,6 +195,15 @@ module CIDE
|
|
185
195
|
host_dir: host_export_dir,
|
186
196
|
)
|
187
197
|
|
198
|
+
## Set version ##
|
199
|
+
if version_data
|
200
|
+
version_file = File.join(host_export_dir, '.packager', 'version')
|
201
|
+
FileUtils.mkdir_p(File.dirname(version_file))
|
202
|
+
File.open(version_file, 'w') do |f|
|
203
|
+
f.puts version_data
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
188
207
|
# Create archive
|
189
208
|
puts "Package: #{tar_name}"
|
190
209
|
system('tar', '-czf', tar_path, '-C', host_export_dir, '.')
|
data/lib/cide/config_file.rb
CHANGED
@@ -46,6 +46,12 @@ module CIDE
|
|
46
46
|
attr_accessor :id
|
47
47
|
end
|
48
48
|
|
49
|
+
class PackageConfig
|
50
|
+
include Virtus.model
|
51
|
+
include NiceInspect
|
52
|
+
attribute :add_version, String, required: false
|
53
|
+
end
|
54
|
+
|
49
55
|
include Virtus.model(strict: true)
|
50
56
|
include NiceInspect
|
51
57
|
attribute :from, String, default: 'ubuntu'
|
@@ -56,6 +62,7 @@ module CIDE
|
|
56
62
|
attribute :export_dir, String, required: false
|
57
63
|
attribute :links, Array[Link], default: []
|
58
64
|
attribute :run, Array[String], default: ['script/ci']
|
65
|
+
attribute :package, PackageConfig, required: false
|
59
66
|
|
60
67
|
attr_reader :warnings, :errors
|
61
68
|
|
@@ -41,6 +41,8 @@ module CIDE
|
|
41
41
|
when 'run', 'command' then
|
42
42
|
wanted_key(path, 'run', key)
|
43
43
|
@config.run = expect_run(path, value)
|
44
|
+
when 'package' then
|
45
|
+
@config.package = maybe_package(path, value)
|
44
46
|
else
|
45
47
|
unknown_key(path)
|
46
48
|
end
|
@@ -127,6 +129,45 @@ module CIDE
|
|
127
129
|
step
|
128
130
|
end
|
129
131
|
|
132
|
+
def maybe_package(path, value)
|
133
|
+
case value
|
134
|
+
when Hash then
|
135
|
+
load_package_config(path, value)
|
136
|
+
when nil then
|
137
|
+
nil
|
138
|
+
else
|
139
|
+
type_error(path, 'hash or nil', value)
|
140
|
+
nil
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def load_package_config(path, data)
|
145
|
+
package = ConfigFile::PackageConfig.new
|
146
|
+
data.each_pair do |key, value|
|
147
|
+
key = key.to_s
|
148
|
+
path_ = path.append(key)
|
149
|
+
case key
|
150
|
+
when 'add_version' then
|
151
|
+
case value.to_s
|
152
|
+
when 'short_sha'
|
153
|
+
package.add_version = 'short_sha'
|
154
|
+
when 'sha'
|
155
|
+
package.add_version = 'sha'
|
156
|
+
when 'auto'
|
157
|
+
package.add_version = 'auto'
|
158
|
+
when nil, 'no', 'none'
|
159
|
+
# ignore
|
160
|
+
else
|
161
|
+
error('expected value to be one of ' \
|
162
|
+
"\"short_sha\", \"sha\" or \"auto\" in #{_path}")
|
163
|
+
end
|
164
|
+
else
|
165
|
+
unknown_key(path_)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
package
|
169
|
+
end
|
170
|
+
|
130
171
|
def expect_links(path, value)
|
131
172
|
array = []
|
132
173
|
case value
|
data/lib/cide/default_cide.yml
CHANGED
data/man/cide.yml.1.md
CHANGED
@@ -50,6 +50,10 @@ export_dir:
|
|
50
50
|
# CI runtime. See the Link definition.
|
51
51
|
links: []
|
52
52
|
|
53
|
+
# Setups the behaviour of the `cide package` command. See the Package
|
54
|
+
# definition.
|
55
|
+
package: {}
|
56
|
+
|
53
57
|
# Determines what script to run to execute the tests. This is the main command
|
54
58
|
# that is used to run the CI.
|
55
59
|
#
|
@@ -152,3 +156,22 @@ env: {}
|
|
152
156
|
# type: string
|
153
157
|
run: 'redis-server'
|
154
158
|
```
|
159
|
+
|
160
|
+
Package definition
|
161
|
+
------------------
|
162
|
+
|
163
|
+
A hash that changes the behavious of the `cide package command.
|
164
|
+
|
165
|
+
|
166
|
+
```yaml
|
167
|
+
# When defined, will generate a .packager/version file before generating
|
168
|
+
# the archive.
|
169
|
+
#
|
170
|
+
# If the value is "sha" it use git's HEAD sha for the value.
|
171
|
+
#
|
172
|
+
# If the value is "short_sha" it will be the first 6 characteds of the sha.
|
173
|
+
#
|
174
|
+
# If the value is "auto" it will either be the default build ID or the one
|
175
|
+
# passed as a command-line argument.
|
176
|
+
add_version: auto
|
177
|
+
```
|
data/script/build
CHANGED
@@ -6,16 +6,10 @@ if [[ -z $1 ]]; then
|
|
6
6
|
fi
|
7
7
|
|
8
8
|
packager_bin() {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
#!/bin/sh -e
|
14
|
-
here=\$(dirname "\$(readlink -f "\$0")")
|
15
|
-
target=\$(readlink -f "\$here/../../${bin}")
|
16
|
-
exec "\$target" "\$@"
|
17
|
-
BIN
|
18
|
-
chmod +x ".packager/bin/${name}"
|
9
|
+
local bin=$1
|
10
|
+
local name=$(basename "$1")
|
11
|
+
mkdir -p .packager/bin
|
12
|
+
ln -s "../../$bin" ".packager/bin/$name"
|
19
13
|
}
|
20
14
|
|
21
15
|
TARGET=$1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zimbatm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.5.2
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Isolated test runner with Docker
|
data/docs/cide.yml.md
DELETED
@@ -1,154 +0,0 @@
|
|
1
|
-
CIDE.YML 1 "JUNE 2015" cide.yml "Cide Manual"
|
2
|
-
=============================================
|
3
|
-
|
4
|
-
NAME
|
5
|
-
----
|
6
|
-
|
7
|
-
cide.yml - file format that directs the `cide exec` execution
|
8
|
-
|
9
|
-
DESCRIPTION
|
10
|
-
-----------
|
11
|
-
|
12
|
-
The `cide.yml` file is encoded in the [YAML markup language](http://yaml.org/)
|
13
|
-
and describes mostly how the Dockerfile will be generated.
|
14
|
-
|
15
|
-
It has the following semantic:
|
16
|
-
|
17
|
-
Root document
|
18
|
-
-------------
|
19
|
-
|
20
|
-
```yaml
|
21
|
-
---
|
22
|
-
# Image to base the build on. Find images at http://index.docker.io/
|
23
|
-
#
|
24
|
-
# required
|
25
|
-
# type: string
|
26
|
-
from: 'ubuntu'
|
27
|
-
|
28
|
-
# A step executed as root. See the Step definition.
|
29
|
-
as_root: {}
|
30
|
-
|
31
|
-
# If set to true, inject the invoker's SSH key into the image.
|
32
|
-
# This is used for shared github access for example.
|
33
|
-
#
|
34
|
-
# type: boolean
|
35
|
-
use_ssh: no
|
36
|
-
|
37
|
-
# A step executed as the "cide" user. See the Step definition.
|
38
|
-
before: {}
|
39
|
-
|
40
|
-
# Environment variables set at runtime. See the ENV definition.
|
41
|
-
env: {}
|
42
|
-
|
43
|
-
# Selects a file or directory to export. When set and cide is invoked with
|
44
|
-
# --export the same directory will be copied back into the project's root.
|
45
|
-
#
|
46
|
-
# type: string
|
47
|
-
export_dir:
|
48
|
-
|
49
|
-
# When defined, executes and attaches the defined linked containers to the
|
50
|
-
# CI runtime. See the Link definition.
|
51
|
-
links: []
|
52
|
-
|
53
|
-
# Determines what script to run to execute the tests. This is the main command
|
54
|
-
# that is used to run the CI.
|
55
|
-
#
|
56
|
-
# The script has to exit with an exit-status of zero to succeed.
|
57
|
-
#
|
58
|
-
# default: "script/ci"
|
59
|
-
# type: string
|
60
|
-
run: rake
|
61
|
-
```
|
62
|
-
|
63
|
-
Step definition
|
64
|
-
---------------
|
65
|
-
|
66
|
-
Here is the format for a step.
|
67
|
-
|
68
|
-
```yaml
|
69
|
-
# An array or hash of files to add
|
70
|
-
#
|
71
|
-
# In the hash form, the target is on the left-hand side and source on the
|
72
|
-
# right-hand side. If multiple values are passed on to the right then they are
|
73
|
-
# all added to the same folder.
|
74
|
-
#
|
75
|
-
# If a URL is provided in the source it is fetched during the build.
|
76
|
-
#
|
77
|
-
# Note that source files should either come from a URL or from a file within
|
78
|
-
# the project's directory.
|
79
|
-
add:
|
80
|
-
/etc/cacert.pem: http://curl.se/cacert.pem
|
81
|
-
/src:
|
82
|
-
- Gemfile
|
83
|
-
- Gemfile.lock
|
84
|
-
# or
|
85
|
-
add:
|
86
|
-
- one
|
87
|
-
- two
|
88
|
-
|
89
|
-
# Sets environment variables in this step (and next ones). See the ENV
|
90
|
-
# definition.
|
91
|
-
env: {}
|
92
|
-
|
93
|
-
# A list of commands to run in that stage
|
94
|
-
#
|
95
|
-
# type: string or array of string
|
96
|
-
run:
|
97
|
-
- bundle exec
|
98
|
-
- npm install
|
99
|
-
# or
|
100
|
-
run: go get ./...
|
101
|
-
```
|
102
|
-
|
103
|
-
If the step is defined as a string or array, those are interpreted as commands
|
104
|
-
to add to that step.
|
105
|
-
|
106
|
-
ENV definition
|
107
|
-
--------------
|
108
|
-
|
109
|
-
An array or hash of environment variables to load
|
110
|
-
|
111
|
-
In the hash form, the left-hand side is the key and the right-hand side the
|
112
|
-
value.
|
113
|
-
|
114
|
-
If a hash value is nil or the array form is used, the environment variables
|
115
|
-
are loaded from the cide invoker environment.
|
116
|
-
|
117
|
-
```yaml
|
118
|
-
env:
|
119
|
-
HOME: /cide
|
120
|
-
AWS_ACCESS_KEY_ID:
|
121
|
-
# or
|
122
|
-
env:
|
123
|
-
- AWS_ACCESS_SECRET_KEY
|
124
|
-
```
|
125
|
-
|
126
|
-
Link definition
|
127
|
-
---------------
|
128
|
-
|
129
|
-
A hash that describes a linked containers. Linked containers are automatically
|
130
|
-
started before executing the main command and destroyed after that.
|
131
|
-
|
132
|
-
```yaml
|
133
|
-
# Gives a name to the container to execute. This also determines the hostname
|
134
|
-
# the main container will be able to address this container with.
|
135
|
-
#
|
136
|
-
# If the name is missing, the name is extracted from the `from` key. For
|
137
|
-
# example if the `from` value is "foobar/redis:2.6" the name will be "redis"
|
138
|
-
#
|
139
|
-
# type: string
|
140
|
-
name: 'mysql'
|
141
|
-
|
142
|
-
# Name of the image to pull and base the container on.
|
143
|
-
#
|
144
|
-
# type: string
|
145
|
-
from: 'redis:2.6'
|
146
|
-
|
147
|
-
# Environment variables for that container. See the ENV definition.
|
148
|
-
env: {}
|
149
|
-
|
150
|
-
# Single command to execute the container with.
|
151
|
-
#
|
152
|
-
# type: string
|
153
|
-
run: 'redis-server'
|
154
|
-
```
|