conjur-debify 3.0.0.pre.1118 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +1 -0
  3. data/.gitignore +22 -0
  4. data/.project +18 -0
  5. data/.rvmrc +60 -0
  6. data/CHANGELOG.md +246 -0
  7. data/CONTRIBUTING.md +16 -0
  8. data/Dockerfile +33 -0
  9. data/Gemfile +2 -0
  10. data/Jenkinsfile +116 -0
  11. data/LICENSE.txt +22 -0
  12. data/README.md +303 -0
  13. data/Rakefile +75 -0
  14. data/VERSION +1 -1
  15. data/bin/debify +5 -0
  16. data/build.sh +8 -0
  17. data/ci/test.sh +8 -0
  18. data/debify.gemspec +36 -0
  19. data/distrib/conjur_creds.rb +7 -0
  20. data/distrib/docker-debify +50 -0
  21. data/distrib/entrypoint.sh +19 -0
  22. data/distrib/script +1 -0
  23. data/distrib/secrets +1 -0
  24. data/distrib/secrets.yml +2 -0
  25. data/example/Gemfile +9 -0
  26. data/example/Gemfile.lock +32 -0
  27. data/example/debify.sh +3 -0
  28. data/example/distrib/postinstall.sh +8 -0
  29. data/example/docker-compose.yml +11 -0
  30. data/example/net-test.sh +7 -0
  31. data/example/test.sh +4 -0
  32. data/features/detect_version.feature +12 -0
  33. data/features/package.feature +23 -0
  34. data/features/sandbox.feature +23 -0
  35. data/features/step_definitions/debify_steps.rb +29 -0
  36. data/features/support/env.rb +12 -0
  37. data/features/support/hooks.rb +29 -0
  38. data/features/support/world.rb +10 -0
  39. data/features/test.feature +24 -0
  40. data/image-tags +23 -0
  41. data/lib/conjur/debify/Dockerfile.fpm +13 -0
  42. data/lib/conjur/debify/action/publish.rb +136 -0
  43. data/lib/conjur/debify/utils.rb +16 -0
  44. data/lib/conjur/debify/version.rb +5 -0
  45. data/lib/conjur/debify.rb +850 -0
  46. data/lib/conjur/fpm/Dockerfile +26 -0
  47. data/lib/conjur/fpm/debify_utils.sh +32 -0
  48. data/lib/conjur/fpm/package.sh +107 -0
  49. data/lib/conjur/publish/Dockerfile +5 -0
  50. data/publish-rubygem.sh +10 -0
  51. data/push-image.sh +6 -0
  52. data/secrets.yml +3 -0
  53. data/spec/action/publish_spec.rb +54 -0
  54. data/spec/data/Makefile +5 -0
  55. data/spec/data/test.tar +0 -0
  56. data/spec/debify_utils_spec.rb +55 -0
  57. data/spec/spec_helper.rb +1 -0
  58. data/spec/utils_spec.rb +22 -0
  59. data/tag-image.sh +6 -0
  60. data/test.sh +6 -0
  61. metadata +80 -7
data/README.md ADDED
@@ -0,0 +1,303 @@
1
+ # Debify
2
+
3
+ Debify is a tool used for building and testing DAP appliance packages.
4
+ It is mainly used to package and publish debian packages that are consumed into the
5
+ appliance image in its build stage. However, it also packages and publishes an
6
+ RPM package whenever it does so for a debian.
7
+
8
+ ## Installation
9
+
10
+ There are two different ways of installing debify: as a gem, or as a Docker image.
11
+
12
+ ### Installing the gem
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'conjur-debify'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ ```sh-session
22
+ $ bundle
23
+ ```
24
+
25
+ Or install it yourself as a ruby gem:
26
+
27
+ ```sh-session
28
+ $ gem install conjur-debify
29
+ ```
30
+
31
+ ### Installing the Docker image
32
+ Pull the Docker image:
33
+
34
+ ```sh-session
35
+ $ VERSION=3.0.0
36
+ $ docker pull registry.tld/conjurinc/debify:$VERSION
37
+ ```
38
+
39
+ Images are tagged with the version specified in [VERSION](./VERSION)
40
+
41
+ Use the `config` subcommand to get a copy of the wrapper script and the secret definitions for publishing:
42
+
43
+ ```sh-session
44
+ $ docker run --rm debify:$VERSION config script > docker-debify
45
+ $ chmod +x docker-debify
46
+ # Optionally, if publishing a deb
47
+ $ docker run --rm debify:$VERSION config secrets > publishing-secrets.yml
48
+ ```
49
+
50
+ Running `docker-debify` will then start a container configured to run debify:
51
+
52
+ ```sh-session
53
+ $ ./docker-debify help
54
+ NAME
55
+ debify - Utility commands for building and testing Conjur appliance Debian packages
56
+
57
+ SYNOPSIS
58
+ debify [global options] command [command options] [arguments...]
59
+
60
+ VERSION
61
+ 3.0.0
62
+
63
+
64
+ GLOBAL OPTIONS
65
+ --env=arg - Set an environment variable (e.g. TERM=xterm) when starting a container (may be used more than once, default:
66
+ none)
67
+ --help - Show this message
68
+ --[no-]local-bundle - Mount local bundle to reuse gems from previous installation
69
+ --version - Display the program version
70
+
71
+ COMMANDS
72
+ clean - Clean current working directory of non-Git-managed files
73
+ config - Show the given configuration
74
+ detect-version - Auto-detect and print the repository version
75
+ help - Shows a list of commands or help for one command
76
+ initconfig - Initialize the config file using current global options
77
+ package - Build a debian package for a project
78
+ publish - Publish a debian package to apt repository
79
+ sandbox - Setup a development sandbox for a Conjur debian package in a Conjur appliance container
80
+ test - Test a Conjur debian package in a Conjur appliance container
81
+ ```
82
+
83
+
84
+ Note that debify itself creates images and starts containers, so it
85
+ needs access to the host's `docker.sock`. Additionally, it requires
86
+ that it be started in root directory of the project being packaged.
87
+
88
+ ## Build a package
89
+
90
+ Builds a Conjur Debian package from a Ruby gem.
91
+
92
+ ```
93
+ $ debify help package
94
+ NAME
95
+ package - Build a debian package for a project
96
+
97
+ SYNOPSIS
98
+ debify [global options] package [command options] project_name -- <fpm-arguments>
99
+ b
100
+ DESCRIPTION
101
+ The package is built using fpm (https://github.com/jordansissel/fpm).
102
+
103
+ The project directory is required to contain:
104
+
105
+ * A Gemfile and Gemfile.lock * A shell script called debify.sh
106
+
107
+ debify.sh is invoked by the package build process to create any custom files, other than the project source tree. For example, config files can be
108
+ created in /opt/conjur/etc.
109
+
110
+ The distrib folder in the project source tree is intended to create scripts for package pre-install, post-install etc. The distrib folder is not
111
+ included in the deb package, so its contents should be copied to the file system or packaged using fpm arguments.
112
+
113
+ All arguments to this command which follow the double-dash are propagated to the fpm command.
114
+
115
+ COMMAND OPTIONS
116
+ -d, --dir=arg - Set the current working directory (default: none)
117
+ -v, --version=arg - Specify the deb version; by default, it's read from the VERSION file (default: none)
118
+ ```
119
+
120
+ ### Example usage
121
+
122
+ ```sh-session
123
+ $ package_name=$(debify package -d example -v 0.0.1 example -- --post-install /distrib/postinstall.sh)
124
+ $ echo $package_name
125
+ conjur-example_0.0.1_amd64.deb
126
+ ```
127
+
128
+ ## Test a package
129
+
130
+ ```
131
+ $ debify help test
132
+ NAME
133
+ test - Test a Conjur debian package in a Conjur appliance container
134
+
135
+ SYNOPSIS
136
+ debify [global options] test [command options] project-name test-script
137
+
138
+ DESCRIPTION
139
+ First, a Conjur appliance container is created and started. By default, the container image is registry.tld/conjur-appliance-cuke-master. An image tag
140
+ MUST be supplied. This image is configured with all the CONJUR_ environment variables setup for the local environment (appliance URL, cert path, admin
141
+ username and password, etc). The project source tree is also mounted into the container, at /src/<project-name>.
142
+
143
+ This command then waits for Conjur to initialize and be healthy. It proceeds by installing the conjur-<project-name>_latest_amd64.deb from the project
144
+ working directory.
145
+
146
+ Then the evoke "test-install" command is used to install the test code in the /src/<project-name>. Basically, the development bundle is installed and
147
+ the database configuration (if any) is setup.
148
+
149
+ Next, an optional "configure-script" from the project source tree is run, with the container id as the program argument. This command waits for Conjur
150
+ to be healthy again.
151
+
152
+ Finally, a test script from the project source tree is run, again with the container id as the program argument.
153
+
154
+ Then the Conjur container is deleted (use --keep to leave it running).
155
+
156
+ COMMAND OPTIONS
157
+ -c, --configure-script=arg - Shell script to configure the appliance before testing (default: none)
158
+ -d, --dir=arg - Set the current working directory (default: none)
159
+ -i, --image=arg - Image name (default: registry.tld/conjur-appliance-cuke-master)
160
+ -k, --[no-]keep - Keep the Conjur appliance container after the command finishes
161
+ --[no-]pull - Pull the image, even if it's in the Docker engine already (default: enabled)
162
+ -t, --image-tag=arg - Image tag, e.g. 4.5-stable, 4.6-stable (default: none)
163
+ ```
164
+
165
+ ### Example usage
166
+
167
+ ```sh-session
168
+ $ debify test -i conjur-appliance-cuke-master --image-tag 4.6-dev --no-pull -d example example test.sh
169
+ ```
170
+
171
+ ## Publish a package
172
+
173
+ ```
174
+ $ debify help publish
175
+ NAME
176
+ publish - Publish a debian package to apt repository
177
+
178
+ SYNOPSIS
179
+ debify [global options] publish [command options] distribution project-name
180
+
181
+ DESCRIPTION
182
+ Publishes a deb created with `debify package` to our private apt repository.
183
+
184
+ "distribution" should match the major/minor version of the Conjur appliance you want to install to.
185
+
186
+ The package name is a required option. The package version can be specified as a CLI option, or it will be auto-detected from Git.
187
+
188
+ --component should be 'stable' if run after package tests pass or 'testing' if the package is not yet ready for release. If you don't specify the component, it will be set to
189
+ 'testing' unless the current git branch is 'master' or 'origin/master'. The git branch is first detected from the env var GIT_BRANCH, and then by checking `git rev-parse
190
+ --abbrev-ref HEAD` (which won't give you the answer you want when detached).
191
+
192
+ COMMAND OPTIONS
193
+ -c, --component=arg - Maturity stage of the package, 'testing' or 'stable' (default: none)
194
+ -d, --dir=arg - Set the current working directory (default: none)
195
+ -v, --version=arg - Specify the deb package version; by default, it's computed automatically (default: none)
196
+ ```
197
+
198
+ ### Example usage
199
+
200
+ You will need read permission for the `ci/artifactory/users/jenkins/username` and `ci/artifactory/users/jenkins/password` variables in order to run this command from your local machine.
201
+
202
+ ```sh-session
203
+ $ debify publish -c stable 0.0.1 example
204
+ [Thread 0] Uploading artifact: https://conjurinc.artifactoryonline.com/conjurinc/debian-local/conjur-example_0.1.1-c9fd618_amd64.deb;deb.distribution=0.1.1;deb.component=possum;deb.architecture=amd64
205
+ [Thread 0] Artifactory response: 201 Created
206
+ Uploaded 1 artifacts to Artifactory.
207
+ ```
208
+
209
+ ## Create a development session in a Conjur appliance container
210
+
211
+
212
+ ```
213
+ $ debify help sandbox
214
+ NAME
215
+ sandbox - Setup a development sandbox for a Conjur debian package in a Conjur appliance container
216
+
217
+ SYNOPSIS
218
+ debify [global options] sandbox [command options]
219
+
220
+ DESCRIPTION
221
+ First, a Conjur appliance container is created and started. By default, the container image is
222
+ registry.tld/conjur-appliance-cuke-master. An image tag MUST be supplied. This image
223
+ is configured with all the CONJUR_ environment variables setup for the local environment (appliance URL,
224
+ cert path, admin username and password, etc). The project source tree is
225
+ also mounted into the container, at /src/<project-name>, where <project-name> is taken from the name of the
226
+ current working directory.
227
+
228
+ Once in the container, use "/opt/conjur/evoke/bin/dev-install" to install the development bundle of your project.
229
+
230
+ COMMAND OPTIONS
231
+ --bind=arg - Bind another source directory into the container. Use <src>:<dest>, where both are full paths. (default: none)
232
+ -d, --dir=arg - Set the current working directory (default: none)
233
+ -i, --image=arg - Image name (default: registry.tld/conjur-appliance-cuke-master)
234
+ --[no-]pull - 'docker pull' the Conjur container image
235
+ -t, --image-tag=arg - Image tag, e.g. 4.5-stable, 4.6-stable (default: none)
236
+ ```
237
+
238
+ ### Example usage
239
+
240
+ ```sh-session
241
+ authz $ debify sandbox -t $(cat VERSION_APPLIANCE)-stable
242
+ ... much logging
243
+ authz $ docker exec -it authz-sandbox bash
244
+ root@7d4217655332:/src/authz# /opt/conjur/evoke/bin/dev-install authz
245
+ ...
246
+ root@7d4217655332:/src/authz# export RAILS_ENV=test
247
+ root@7d4217655332:/src/authz# bundle exec rake db:migrate
248
+ ```
249
+
250
+ ## Usage with docker-compose
251
+
252
+ As of v1.10.0, both the `test` and `sandbox` subcommands support the `--net` switch. This allows you to specify a network to which the Conjur appliance container should be attached.
253
+
254
+ There are a variety of ways to make use of this feature. One
255
+ possiblity is creating a network using `docker network create`, then
256
+ attaching both the docker-compose services, as well as the Conjur
257
+ appliance container created by debify, to it.
258
+
259
+ As a (somewhat contrived) example, create a new docker network:
260
+
261
+ ```sh-session
262
+ $ docker network create testnet
263
+ ```
264
+
265
+ Use a docker-compose file like [example/docker-compose.yml](example/docker-compose.yml)
266
+
267
+ ```yaml
268
+ version: "2"
269
+ networks:
270
+ svcnet:
271
+ external:
272
+ name: testnet
273
+ services:
274
+ db:
275
+ image: postgres
276
+ container_name: mydb
277
+ networks:
278
+ - svcnet
279
+ ```
280
+
281
+ Bring up the db service:
282
+
283
+ ```sh-session
284
+ debify $ cd example
285
+ example $ docker-compose up -d
286
+ ```
287
+
288
+ Start a sandbox, see that it can resolve the hostname `mydb`:
289
+
290
+ ```sh-session
291
+
292
+ example $ debify sandbox -t 5.0-stable --net testnet
293
+ example $ docker exec -it example-sandbox /bin/bash
294
+ root@7d4217655332:/src/example# getent hosts mydb
295
+ 172.19.0.2 mydb
296
+ ```
297
+
298
+
299
+ ## Contributing
300
+
301
+ For instructions on how to get started and
302
+ descriptions of our development workflows, please see our
303
+ [contributing guide](CONTRIBUTING.md).
data/Rakefile ADDED
@@ -0,0 +1,75 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+
6
+ def cucumber?
7
+ require 'cucumber'
8
+ require 'cucumber/rake/task'
9
+ rescue LoadError
10
+ false
11
+ end
12
+
13
+ def rspec?
14
+ require 'rspec/core/rake_task'
15
+ require 'ci/reporter/rake/rspec'
16
+ end
17
+
18
+ Rake::RDocTask.new do |rd|
19
+ rd.main = "README.rdoc"
20
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
21
+ rd.title = 'Your application title'
22
+ end
23
+
24
+ spec = eval(File.read('debify.gemspec'))
25
+
26
+ Gem::PackageTask.new(spec) do |pkg|
27
+ end
28
+
29
+ if cucumber?
30
+ CUKE_RESULTS = 'features/reports'
31
+
32
+ desc 'Run features'
33
+ Cucumber::Rake::Task.new(:features) do |t|
34
+ opts = [
35
+ "features",
36
+ "--format",
37
+ "junit",
38
+ "-o",
39
+ CUKE_RESULTS,
40
+ "--format",
41
+ "pretty",
42
+ "-x"]
43
+ opts += ["--tags", ENV['TAGS']] if ENV['TAGS']
44
+ opts += ["--tags", "not @skip"]
45
+ t.cucumber_opts = opts
46
+ t.fork = false
47
+ end
48
+
49
+ desc 'Run features tagged as work-in-progress (@wip)'
50
+ Cucumber::Rake::Task.new('features:wip') do |t|
51
+ tag_opts = %w[--tags @wip]
52
+ opts = [
53
+ "features",
54
+ "--format",
55
+ "junit",
56
+ "-o",
57
+ CUKE_RESULTS,
58
+ "--format",
59
+ "pretty",
60
+ "-x",
61
+ "-s"]
62
+ t.cucumber_opts = opts + tag_opts
63
+ t.fork = false
64
+ end
65
+
66
+ task :cucumber => :features
67
+ task 'cucumber:wip' => 'features:wip'
68
+ task :wip => 'features:wip'
69
+ end
70
+
71
+ if rspec?
72
+ desc 'Run specs'
73
+ RSpec::Core::RakeTask.new(:spec)
74
+ task :spec => 'ci:setup:rspec'
75
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.0-1118
1
+ 3.0.0
data/bin/debify ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ require 'conjur/debify'
4
+
5
+ exit run(ARGV)
data/build.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash -ex
2
+
3
+ if [ ! -f "VERSION" ]; then
4
+ echo -n "0.0.1.dev" > VERSION
5
+ fi
6
+
7
+ VERSION=$(< VERSION)
8
+ docker build --build-arg VERSION=$VERSION -t debify:$VERSION .
data/ci/test.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash -ex
2
+
3
+ bundle
4
+
5
+ for target in spec cucumber; do
6
+ bundle exec rake $target
7
+ done
8
+
data/debify.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'conjur/debify/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "conjur-debify"
8
+ spec.version = Conjur::Debify::VERSION
9
+ spec.authors = ["CyberArk Software, Inc."]
10
+ spec.email = ["conj_maintainers@cyberark.com"]
11
+ spec.summary = %q{Utility commands to build and package Conjur services as Debian packages}
12
+ spec.homepage = "https://github.com/conjurinc/debify"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").append("VERSION")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "gli"
21
+ spec.add_dependency "docker-api", "~> 2.0"
22
+ spec.add_dependency "conjur-cli" , "~> 6"
23
+ spec.add_dependency "conjur-api", "~> 5.3"
24
+ spec.add_development_dependency "bundler", ">= 2.2.30"
25
+ spec.add_development_dependency "fakefs", "~> 0"
26
+ spec.add_development_dependency "rake", "~> 13.0"
27
+
28
+ # Pin to cucumbe v2. cucumber v3 changes (breaks) the behavior of
29
+ # unmatched capture groups with \(d+). In v3, the value of such a
30
+ # group is 0 instead of nil, which breaks aruba's "I successfully
31
+ # run...." steps.
32
+ spec.add_development_dependency "cucumber", '~> 7.1'
33
+ spec.add_development_dependency "aruba", "~> 2.0"
34
+ spec.add_development_dependency 'rspec', '~> 3.10'
35
+ spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
36
+ end
@@ -0,0 +1,7 @@
1
+ require 'netrc'
2
+ Netrc.configure do |c|
3
+ c[:allow_permissive_netrc_file] = true
4
+ end
5
+
6
+ creds = Netrc.read('/root/.netrc')[ENV['CONJUR_APPLIANCE_URL'] + '/authn']
7
+ print "#{creds.login} #{creds.password}" if creds
@@ -0,0 +1,50 @@
1
+ #!/bin/bash -e
2
+
3
+ # If we're running in jenkins, there will be a conjur.identity file
4
+ # with Conjur creds in it. Otherwise, assume the user's netrc has
5
+ # them.
6
+ if [[ -f /etc/conjur.identity ]]; then
7
+ netrc=/etc/conjur.identity
8
+ else
9
+ netrc=$HOME/.netrc
10
+ fi
11
+
12
+ : ${CONJURRC=/etc/conjur.conf}
13
+
14
+ conjur_config() {
15
+ local name=$1; shift
16
+ grep $name $CONJURRC | awk '{print $2}' | tr -d '"'
17
+ }
18
+
19
+ export CONJUR_APPLIANCE_URL=$(conjur_config appliance_url)
20
+ export CONJUR_SSL_CERTIFICATE="$(< $(conjur_config cert_file))"
21
+
22
+ [[ -f "$HOME/.debifyrc" ]] && rc_arg="-v $HOME/.debifyrc:/root/.debifyrc:ro"
23
+
24
+ : ${DEBIFY_ENVFILE=debify.env}
25
+ [[ -f $DEBIFY_ENVFILE ]] && envfile_arg="--env-file $DEBIFY_ENVFILE"
26
+
27
+ # Mounting docker socket is required because subcommands launch
28
+ # containers.
29
+ #
30
+ # The environment variables can't go into an env-file, because docker
31
+ # doesn't handle env-file variables the same way it handles
32
+ # command-line variables. In particular, when a variable in an
33
+ # env-file is unset in the calling enviroment, it gets set in the
34
+ # container without a value. When such a variable is mentioned on the
35
+ # command line, it doesn't get set in the container.
36
+ tty=$(tty -s && echo "-t" || true)
37
+ docker run -i $tty --rm \
38
+ -e GLI_DEBUG -e DEBUG \
39
+ -e CONJUR_APPLIANCE_URL -e CONJUR_SSL_CERTIFICATE \
40
+ -e GIT_BRANCH -e BRANCH_NAME \
41
+ -e ARTIFACTORY_USER -e ARTIFACTORY_PASSWORD \
42
+ -e HOME \
43
+ ${envfile_arg} \
44
+ -v "$PWD:$PWD" -w "$PWD" \
45
+ -v /var/run/docker.sock:/var/run/docker.sock \
46
+ -v "${HOME}:${HOME}" \
47
+ -v "${netrc}:${HOME}/.netrc:ro" \
48
+ ${rc_arg} \
49
+ ${DEBIFY_ENTRYPOINT+--entrypoint $DEBIFY_ENTRYPOINT} \
50
+ ${DEBIFY_IMAGE-registry.tld/conjurinc/debify:@@DEBIFY_VERSION@@} "$@"
@@ -0,0 +1,19 @@
1
+ #!/bin/bash -e
2
+
3
+ # Make sure we don't echo commands as executed, otherwise the user's
4
+ # Conjur API key will show up in the logs.
5
+ set +x
6
+
7
+ creds=( $(ruby /debify/distrib/conjur_creds.rb) )
8
+
9
+ # If there are creds, use them to log in to the registry.
10
+ #
11
+ # If there are no creds, any commands that do
12
+ # Docker stuff will fail, but the non-Docker commands (e.g. the config
13
+ # subcommands) will work fine.
14
+ if [[ ${#creds[*]} > 0 ]]; then
15
+ echo -n "${creds[1]}" | docker login registry.tld -u ${creds[0]} --password-stdin >/dev/null 2>&1
16
+ fi
17
+
18
+ exec debify "$@"
19
+
data/distrib/script ADDED
@@ -0,0 +1 @@
1
+ docker-debify
data/distrib/secrets ADDED
@@ -0,0 +1 @@
1
+ secrets.yml
@@ -0,0 +1,2 @@
1
+ ARTIFACTORY_USER: !var ci/artifactory/users/jenkins/username
2
+ ARTIFACTORY_PASSWORD: !var ci/artifactory/users/jenkins/password
data/example/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'pry'
5
+ end
6
+
7
+ group :test do
8
+ gem 'rspec'
9
+ end
@@ -0,0 +1,32 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ coderay (1.1.2)
5
+ diff-lcs (1.3)
6
+ method_source (0.9.0)
7
+ pry (0.11.3)
8
+ coderay (~> 1.1.0)
9
+ method_source (~> 0.9.0)
10
+ rspec (3.7.0)
11
+ rspec-core (~> 3.7.0)
12
+ rspec-expectations (~> 3.7.0)
13
+ rspec-mocks (~> 3.7.0)
14
+ rspec-core (3.7.1)
15
+ rspec-support (~> 3.7.0)
16
+ rspec-expectations (3.7.0)
17
+ diff-lcs (>= 1.2.0, < 2.0)
18
+ rspec-support (~> 3.7.0)
19
+ rspec-mocks (3.7.0)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.7.0)
22
+ rspec-support (3.7.1)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ pry
29
+ rspec
30
+
31
+ BUNDLED WITH
32
+ 2.1.4
data/example/debify.sh ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/bash -e
2
+
3
+ echo "running debify.sh"
@@ -0,0 +1,8 @@
1
+ #!/bin/sh -e
2
+ # Example postinstall script.
3
+
4
+ case $1 in
5
+ configure)
6
+ echo 'Executing post-install script'
7
+ ;;
8
+ esac
@@ -0,0 +1,11 @@
1
+ version: "2"
2
+ networks:
3
+ svcnet:
4
+ external:
5
+ name: testnet
6
+ services:
7
+ db:
8
+ image: postgres
9
+ container_name: mydb
10
+ networks:
11
+ - svcnet
@@ -0,0 +1,7 @@
1
+ #!/bin/bash -ex
2
+
3
+ cid=$1
4
+
5
+ docker exec $cid curl -s http://other_host > /dev/null
6
+
7
+ echo Test succeeded
data/example/test.sh ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/bash -ex
2
+
3
+ ruby -rrspec -e 'puts RSpec::Version::STRING'
4
+ echo Test succeeded
@@ -0,0 +1,12 @@
1
+ @announce-output
2
+ Feature: Automatic version string
3
+
4
+ Scenario: 'example' project gets a default version
5
+ When I run `env DEBUG=true GLI_DEBUG=true debify detect-version -d ../../example`
6
+ Then the exit status should be 0
7
+ And the output should match /\d+.\d+.\d+-\d+-.*/
8
+
9
+ @skip
10
+ Scenario: Test @skip tag, failed by default
11
+ When I run `env DEBUG=true GLI_DEBUG=true debify detect-version -d ../../example`
12
+ Then the exit status should be 1
@@ -0,0 +1,23 @@
1
+ @announce-output
2
+ Feature: Packaging
3
+
4
+ Background:
5
+ # We use version 0.0.1-suffix to verify that RPM converts dashes to underscores
6
+ # in the version as we expect
7
+ Given I successfully run `env DEBUG=true GLI_DEBUG=true debify package -d ../../example -v 0.0.1-suffix example -- --post-install /distrib/postinstall.sh`
8
+ And I successfully run `env DEBUG=true GLI_DEBUG=true debify package -d ../../example --output rpm -v 0.0.1-suffix example -- --post-install /distrib/postinstall.sh`
9
+
10
+ Scenario: 'example' project can be packaged successfully
11
+ Then the stdout should contain "conjur-example_0.0.1-suffix_amd64.deb"
12
+ And the stdout should contain "conjur-example-dev_0.0.1-suffix_amd64.deb"
13
+ And the stdout should contain "conjur-example-0.0.1_suffix-1.x86_64.rpm"
14
+ And the stdout should contain "conjur-example-dev-0.0.1_suffix-1.x86_64.rpm"
15
+
16
+ Scenario: 'clean' command will delete non-Git-managed files
17
+ When I successfully run `env DEBUG=true GLI_DEBUG=true debify clean -d ../../example --force`
18
+ And I successfully run `find ../../example`
19
+ Then the stdout from "find ../../example" should not contain "conjur-example_0.0.1-suffix_amd64.deb"
20
+ And the stdout from "find ../../example" should not contain "conjur-example-0.0.1_suffix-1.x86_64.rpm"
21
+
22
+ Scenario: 'example' project can be published
23
+ When I successfully run `env DEBUG=true GLI_DEBUG=true debify publish -v 0.0.1-suffix -d ../../example 5.0 example`