conjur-debify 1.11.4 → 2.1.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/.gitignore +1 -0
- data/CHANGELOG.md +34 -0
- data/CONTRIBUTING.md +16 -0
- data/Dockerfile +13 -24
- data/Jenkinsfile +21 -2
- data/README.md +9 -6
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/ci/test.sh +0 -5
- data/debify.gemspec +6 -6
- data/distrib/docker-debify +4 -2
- data/distrib/entrypoint.sh +4 -7
- data/example/Gemfile.lock +1 -1
- data/example/net-test.sh +1 -1
- data/features/package.feature +12 -6
- data/features/sandbox.feature +9 -5
- data/features/step_definitions/debify_steps.rb +1 -3
- data/features/support/env.rb +3 -1
- data/features/test.feature +4 -4
- data/lib/conjur/debify/Dockerfile.fpm +0 -4
- data/lib/conjur/debify/action/publish.rb +63 -20
- data/lib/conjur/debify/utils.rb +1 -1
- data/lib/conjur/debify.rb +161 -92
- data/lib/conjur/fpm/Dockerfile +5 -9
- data/lib/conjur/fpm/package.sh +61 -32
- data/lib/conjur/publish/Dockerfile +1 -7
- data/spec/action/publish_spec.rb +4 -4
- data/spec/debify_utils_spec.rb +1 -1
- data/spec/utils_spec.rb +1 -1
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f1513a687cde9e9f2079436b6c9b290748d22a66ebd890c957e4dd1e9200592
|
4
|
+
data.tar.gz: bdbc0f7c3ce085d8ac9ad012b51c07498efcd21218896eb73e6bd4ef12806391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77413aeaa1c6e74e293522012375671357a265d25d7e9d70cae42df8218b265a12cdfe5612bcab58b569fc9cb07ba30a44ee595f962239322b4871849f8b3b69
|
7
|
+
data.tar.gz: dc986fbd9bb73204846c8a39ed791432c4d668ac9c1facb51863765e67c81d5ebe004152440ff67b963a5b69abb931924f984c980cd70208c83566d9c6fabcea
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
# 2.1.0
|
4
|
+
### Changed
|
5
|
+
|
6
|
+
- Refine bundler related steps in `debify package` flow: only `package.sh` file configures
|
7
|
+
and invokes bundler. `Dockerfile.fpm` only copies files and adjusts folder structure.
|
8
|
+
- Remove bundler 1.* support
|
9
|
+
|
10
|
+
# 2.0.0
|
11
|
+
### Changed
|
12
|
+
- Debify now receives the flag `--output` as input to indicate the file type that it should package (e.g `rpm`). If this
|
13
|
+
flag is not given, the default value is `deb`.
|
14
|
+
[conjurinc/debify#56](https://github.com/conjurinc/debify/issues/56)
|
15
|
+
|
16
|
+
# 1.12.0
|
17
|
+
|
18
|
+
### Added
|
19
|
+
- Debify now packages and publishes an RPM file, alongside a debian file.
|
20
|
+
[conjurinc/debify#49](https://github.com/conjurinc/debify/pull/49)
|
21
|
+
- `debify package` now offers an `--additional-files` flag to provide a comma
|
22
|
+
separated list of files to include in the FPM build that are not provided
|
23
|
+
automatically by `git ls-files`.
|
24
|
+
[conjurinc/debify#52](https://github.com/conjurinc/debify/pull/52)
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
- Bug causing `all` files in the git repo to be added to the debian file.
|
28
|
+
[conjurinc/debify#50](https://github.com/conjurinc/debify/pull/50)
|
29
|
+
|
30
|
+
# 1.11.5
|
31
|
+
|
32
|
+
### Changed
|
33
|
+
* Updated FPM and Test images to use a base image with FIPS-compliant Ruby and OpenSSL.
|
34
|
+
|
1
35
|
# 1.11.4
|
2
36
|
|
3
37
|
* Updated sandbox password to match Conjur password complexity requirements.
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
For general contribution and community guidelines, please see the [community repo](https://github.com/cyberark/community).
|
4
|
+
|
5
|
+
## Contributing
|
6
|
+
|
7
|
+
1. [Fork the project](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)
|
8
|
+
2. [Clone your fork](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository)
|
9
|
+
3. Make local changes to your fork by editing files
|
10
|
+
3. [Commit your changes](https://help.github.com/en/github/managing-files-in-a-repository/adding-a-file-to-a-repository-using-the-command-line)
|
11
|
+
4. [Push your local changes to the remote server](https://help.github.com/en/github/using-git/pushing-commits-to-a-remote-repository)
|
12
|
+
5. [Create new Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork)
|
13
|
+
|
14
|
+
From here your pull request will be reviewed and once you've responded to all
|
15
|
+
feedback it will be merged into the project. Congratulations, you're a
|
16
|
+
contributor!
|
data/Dockerfile
CHANGED
@@ -1,44 +1,33 @@
|
|
1
1
|
FROM ruby:2.6-stretch
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
### outdated) support for DockerInDocker. Creation of the official
|
7
|
-
### docker:dind image much more complicated and didn't lend itself to
|
8
|
-
### also running ruby.
|
9
|
-
|
10
|
-
RUN apt-get update -qq && apt-get install -qqy \
|
3
|
+
RUN apt-get update -qq && \
|
4
|
+
apt-get dist-upgrade -qqy && \
|
5
|
+
apt-get install -qqy \
|
11
6
|
apt-transport-https \
|
12
7
|
ca-certificates \
|
13
|
-
curl
|
14
|
-
lxc \
|
15
|
-
iptables
|
8
|
+
curl
|
16
9
|
|
17
|
-
# Install Docker
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
# Define additional metadata for our image.
|
25
|
-
VOLUME /var/lib/docker
|
26
|
-
|
27
|
-
### End of DockerInDocker support
|
10
|
+
# Install Docker client tools
|
11
|
+
ENV DOCKERVERSION=20.10.0
|
12
|
+
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
|
13
|
+
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
|
14
|
+
-C /usr/local/bin docker/docker \
|
15
|
+
&& rm docker-${DOCKERVERSION}.tgz
|
28
16
|
|
29
17
|
RUN mkdir -p /debify
|
30
18
|
WORKDIR /debify
|
31
19
|
|
32
20
|
COPY . ./
|
33
21
|
|
22
|
+
RUN gem install bundler:2.2.30
|
34
23
|
RUN gem build debify.gemspec
|
35
24
|
|
36
25
|
ARG VERSION
|
37
26
|
RUN gem install -N conjur-debify-${VERSION}.gem
|
38
27
|
|
39
28
|
ARG CONJUR_APPLIANCE_URL
|
40
|
-
ENV CONJUR_APPLIANCE_URL ${CONJUR_APPLIANCE_URL:-https://
|
29
|
+
ENV CONJUR_APPLIANCE_URL ${CONJUR_APPLIANCE_URL:-https://conjurops.itp.conjur.net}
|
41
30
|
ENV CONJUR_ACCOUNT ${CONJUR_ACCOUNT:-conjur}
|
42
|
-
ENV CONJUR_VERSION ${CONJUR_VERSION:-
|
31
|
+
ENV CONJUR_VERSION ${CONJUR_VERSION:-5}
|
43
32
|
|
44
33
|
ENTRYPOINT ["/debify/distrib/entrypoint.sh"]
|
data/Jenkinsfile
CHANGED
@@ -32,6 +32,27 @@ pipeline {
|
|
32
32
|
}
|
33
33
|
}
|
34
34
|
|
35
|
+
stage('Scan Docker image') {
|
36
|
+
parallel {
|
37
|
+
stage('Scan Docker image for fixable issues') {
|
38
|
+
steps{
|
39
|
+
script {
|
40
|
+
VERSION = sh(returnStdout: true, script: 'cat VERSION')
|
41
|
+
}
|
42
|
+
scanAndReport("debify:${VERSION}", "HIGH", false)
|
43
|
+
}
|
44
|
+
}
|
45
|
+
stage('Scan Docker image for all issues') {
|
46
|
+
steps{
|
47
|
+
script {
|
48
|
+
VERSION = sh(returnStdout: true, script: 'cat VERSION')
|
49
|
+
}
|
50
|
+
scanAndReport("debify:${VERSION}", "NONE", true)
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
35
56
|
stage('Run feature tests') {
|
36
57
|
steps {
|
37
58
|
sh './test.sh'
|
@@ -49,7 +70,6 @@ pipeline {
|
|
49
70
|
}
|
50
71
|
|
51
72
|
stage('Publish to RubyGems') {
|
52
|
-
agent { label 'releaser-v2' }
|
53
73
|
when {
|
54
74
|
allOf {
|
55
75
|
branch 'master'
|
@@ -73,7 +93,6 @@ pipeline {
|
|
73
93
|
steps {
|
74
94
|
checkout scm
|
75
95
|
sh './publish-rubygem.sh'
|
76
|
-
deleteDir()
|
77
96
|
}
|
78
97
|
}
|
79
98
|
}
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Debify
|
2
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
|
+
|
3
8
|
## Installation
|
4
9
|
|
5
10
|
There are two different ways of installing debify: as a gem, or as a Docker image.
|
@@ -284,7 +289,7 @@ Start a sandbox, see that it can resolve the hostname `mydb`:
|
|
284
289
|
|
285
290
|
```sh-session
|
286
291
|
|
287
|
-
example $ debify sandbox -t
|
292
|
+
example $ debify sandbox -t 5.0-stable --net testnet
|
288
293
|
example $ docker exec -it example-sandbox /bin/bash
|
289
294
|
root@7d4217655332:/src/example# getent hosts mydb
|
290
295
|
172.19.0.2 mydb
|
@@ -293,8 +298,6 @@ root@7d4217655332:/src/example# getent hosts mydb
|
|
293
298
|
|
294
299
|
## Contributing
|
295
300
|
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
300
|
-
5. Create a new Pull Request
|
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
CHANGED
@@ -33,7 +33,8 @@ if cucumber?
|
|
33
33
|
Cucumber::Rake::Task.new(:features) do |t|
|
34
34
|
opts = "features --format junit -o #{CUKE_RESULTS} --format pretty -x"
|
35
35
|
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
36
|
-
|
36
|
+
opts += " --tags ~@skip"
|
37
|
+
t.cucumber_opts = opts
|
37
38
|
t.fork = false
|
38
39
|
end
|
39
40
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
2.1.0
|
data/ci/test.sh
CHANGED
@@ -2,11 +2,6 @@
|
|
2
2
|
|
3
3
|
bundle
|
4
4
|
|
5
|
-
# Some tests need to be logged in to the registry, to pull a base
|
6
|
-
# image if it's not already available. Have entrypoint.sh do something
|
7
|
-
# simple, and log in as a side effect.
|
8
|
-
/debify/distrib/entrypoint.sh detect-version
|
9
|
-
|
10
5
|
for target in spec cucumber; do
|
11
6
|
bundle exec rake $target
|
12
7
|
done
|
data/debify.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'conjur/debify/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "conjur-debify"
|
8
8
|
spec.version = Conjur::Debify::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["CyberArk Software, Inc."]
|
10
|
+
spec.email = ["conj_maintainers@cyberark.com"]
|
11
11
|
spec.summary = %q{Utility commands to build and package Conjur services as Debian packages}
|
12
12
|
spec.homepage = "https://github.com/conjurinc/debify"
|
13
13
|
spec.license = "MIT"
|
@@ -18,20 +18,20 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "gli"
|
21
|
-
spec.add_dependency "docker-api", "~>
|
21
|
+
spec.add_dependency "docker-api", "~> 2.0"
|
22
22
|
spec.add_dependency "conjur-cli" , "~> 6"
|
23
23
|
spec.add_dependency "conjur-api", "~> 5"
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler", "
|
25
|
+
spec.add_development_dependency "bundler", ">= 2.2.30"
|
26
26
|
spec.add_development_dependency "fakefs", "~> 0"
|
27
|
-
spec.add_development_dependency "rake", "~>
|
27
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
28
28
|
|
29
29
|
# Pin to cucumbe v2. cucumber v3 changes (breaks) the behavior of
|
30
30
|
# unmatched capture groups with \(d+). In v3, the value of such a
|
31
31
|
# group is 0 instead of nil, which breaks aruba's "I successfully
|
32
32
|
# run...." steps.
|
33
33
|
spec.add_development_dependency "cucumber", '~> 2'
|
34
|
-
spec.add_development_dependency "aruba"
|
34
|
+
spec.add_development_dependency "aruba", "~> 1.0"
|
35
35
|
spec.add_development_dependency 'rspec', '~> 3'
|
36
36
|
spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
|
37
37
|
end
|
data/distrib/docker-debify
CHANGED
@@ -39,10 +39,12 @@ docker run -i $tty --rm \
|
|
39
39
|
-e CONJUR_APPLIANCE_URL -e CONJUR_SSL_CERTIFICATE \
|
40
40
|
-e GIT_BRANCH -e BRANCH_NAME \
|
41
41
|
-e ARTIFACTORY_USER -e ARTIFACTORY_PASSWORD \
|
42
|
+
-e HOME \
|
42
43
|
${envfile_arg} \
|
43
|
-
-v $PWD:$PWD -w $PWD \
|
44
|
+
-v "$PWD:$PWD" -w "$PWD" \
|
44
45
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
45
|
-
-v ${
|
46
|
+
-v "${HOME}:${HOME}" \
|
47
|
+
-v "${netrc}:${HOME}/.netrc:ro" \
|
46
48
|
${rc_arg} \
|
47
49
|
${DEBIFY_ENTRYPOINT+--entrypoint $DEBIFY_ENTRYPOINT} \
|
48
50
|
${DEBIFY_IMAGE-registry.tld/conjurinc/debify:@@DEBIFY_VERSION@@} "$@"
|
data/distrib/entrypoint.sh
CHANGED
@@ -6,17 +6,14 @@ set +x
|
|
6
6
|
|
7
7
|
creds=( $(ruby /debify/distrib/conjur_creds.rb) )
|
8
8
|
|
9
|
-
# If there are creds, use them to log in to the registry.
|
10
|
-
# the magic DockerInDocker wrapper script so debify can interact with
|
11
|
-
# the Docker daemon.
|
9
|
+
# If there are creds, use them to log in to the registry.
|
12
10
|
#
|
13
|
-
# If there are no creds,
|
11
|
+
# If there are no creds, any commands that do
|
14
12
|
# Docker stuff will fail, but the non-Docker commands (e.g. the config
|
15
13
|
# subcommands) will work fine.
|
16
14
|
if [[ ${#creds[*]} > 0 ]]; then
|
17
15
|
echo -n "${creds[1]}" | docker login registry.tld -u ${creds[0]} --password-stdin >/dev/null 2>&1
|
18
|
-
exec wrapdocker debify "$@"
|
19
|
-
else
|
20
|
-
exec debify "$@"
|
21
16
|
fi
|
22
17
|
|
18
|
+
exec debify "$@"
|
19
|
+
|
data/example/Gemfile.lock
CHANGED
data/example/net-test.sh
CHANGED
data/features/package.feature
CHANGED
@@ -2,16 +2,22 @@
|
|
2
2
|
Feature: Packaging
|
3
3
|
|
4
4
|
Background:
|
5
|
-
|
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`
|
6
9
|
|
7
10
|
Scenario: 'example' project can be packaged successfully
|
8
|
-
Then the stdout should contain "conjur-example_0.0.
|
9
|
-
And the stdout should contain "conjur-example-dev_0.0.
|
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"
|
10
15
|
|
11
16
|
Scenario: 'clean' command will delete non-Git-managed files
|
12
17
|
When I successfully run `env DEBUG=true GLI_DEBUG=true debify clean -d ../../example --force`
|
13
18
|
And I successfully run `find ../../example`
|
14
|
-
Then the stdout from "find ../../example" should not contain "conjur-example_0.0.
|
15
|
-
|
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
|
+
|
16
22
|
Scenario: 'example' project can be published
|
17
|
-
When I successfully run `env DEBUG=true GLI_DEBUG=true debify publish -v 0.0.1 -d ../../example
|
23
|
+
When I successfully run `env DEBUG=true GLI_DEBUG=true debify publish -v 0.0.1-suffix -d ../../example 5.0 example`
|
data/features/sandbox.feature
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
@announce-output
|
2
2
|
Feature: Running a sandbox
|
3
3
|
Background:
|
4
|
-
Given I successfully run `docker pull registry.tld/conjur-appliance-cuke-master:
|
4
|
+
Given I successfully run `docker pull registry.tld/conjur-appliance-cuke-master:5.0-stable`
|
5
|
+
# The extra containers will use the `alpine` image, so we need to pull it first on the
|
6
|
+
# host to use the authenticated DockerHub connection. This avoids hitting DockerHub
|
7
|
+
# rate limits.
|
8
|
+
And I successfully run `docker pull nginx`
|
5
9
|
|
6
10
|
Scenario: sandbox for 'example' project be started
|
7
|
-
Given I successfully start a sandbox for "example" with arguments "-t
|
11
|
+
Given I successfully start a sandbox for "example" with arguments "-t 5.0-stable --no-pull"
|
8
12
|
|
9
13
|
Scenario: sandbox for 'example' project be started linked to another container
|
10
14
|
Given I start a container named "other_host"
|
11
|
-
Then I successfully start a sandbox for "example" with arguments "-t
|
15
|
+
Then I successfully start a sandbox for "example" with arguments "-t 5.0-stable --no-pull --link other_host -c 'curl -s http://other_host > /dev/null'"
|
12
16
|
|
13
17
|
Scenario: sandbox for 'example' project be started on a network other than the default
|
14
18
|
Given I start a container named "other_host" on network "test-net"
|
15
|
-
Then I successfully start a sandbox for "example" with arguments "-t
|
19
|
+
Then I successfully start a sandbox for "example" with arguments "-t 5.0-stable --no-pull --net test-net -c 'curl -s http://other_host > /dev/null'"
|
16
20
|
|
17
21
|
Scenario: sandbox for 'example' project be started on a network other than the default with a host aliased
|
18
22
|
Given I start a container named "another_host" on network "test-net"
|
19
|
-
Then I successfully start a sandbox for "example" with arguments "-t
|
23
|
+
Then I successfully start a sandbox for "example" with arguments "-t 5.0-stable --no-pull --net test-net --link another_host:other_host -c 'curl -s http://other_host > /dev/null'"
|
@@ -12,11 +12,9 @@ When /^I start a container named "(.*?)"(?: on network "(.*?)")*$/ do |name, net
|
|
12
12
|
networks << network
|
13
13
|
end
|
14
14
|
|
15
|
-
alpine = Docker::Image.create('fromImage' => 'alpine')
|
16
15
|
options = {
|
17
16
|
'name' => name,
|
18
|
-
'
|
19
|
-
'Image' => alpine.id
|
17
|
+
'Image' => 'nginx'
|
20
18
|
}
|
21
19
|
options['HostConfig'] = { 'NetworkMode' => net_name } if net_name
|
22
20
|
|
data/features/support/env.rb
CHANGED
@@ -6,5 +6,7 @@ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
|
6
6
|
|
7
7
|
Aruba.configure do |config|
|
8
8
|
config.exit_timeout = 1200
|
9
|
+
# not a best practice from aruba's point of view
|
10
|
+
# but the only solution I've found to have docker credentials context
|
11
|
+
config.home_directory = ENV['HOME']
|
9
12
|
end
|
10
|
-
|
data/features/test.feature
CHANGED
@@ -5,20 +5,20 @@ Feature: Testing
|
|
5
5
|
Given I successfully run `env DEBUG=true GLI_DEBUG=true debify package -d ../../example -v 0.0.1 example -- --post-install /distrib/postinstall.sh`
|
6
6
|
|
7
7
|
Scenario: 'example' project can be tested successfully
|
8
|
-
When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t
|
8
|
+
When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t 5.0-stable -v 0.0.1 -d ../../example --no-pull example test.sh`
|
9
9
|
Then the stderr should contain "Test succeeded"
|
10
10
|
|
11
11
|
Scenario: 'example' project can be tested when linked to another container
|
12
12
|
Given I start a container named "other_host"
|
13
|
-
When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t
|
13
|
+
When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t 5.0-stable -v 0.0.1 -d ../../example --no-pull --link other_host example net-test.sh`
|
14
14
|
Then the stderr should contain "Test succeeded"
|
15
15
|
|
16
16
|
Scenario: 'example' project can be tested on a network other than the default
|
17
17
|
Given I start a container named "other_host" on network "test-net"
|
18
|
-
When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t
|
18
|
+
When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t 5.0-stable -v 0.0.1 -d ../../example --no-pull --net test-net example net-test.sh`
|
19
19
|
Then the stderr should contain "Test succeeded"
|
20
20
|
|
21
21
|
Scenario: 'example' project can be tested on a network other than the default with a host aliased
|
22
22
|
Given I start a container named "another_host" on network "test-net"
|
23
|
-
When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t
|
23
|
+
When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t 5.0-stable -v 0.0.1 -d ../../example --no-pull --link another_host:other_host --net test-net example net-test.sh`
|
24
24
|
Then the stderr should contain "Test succeeded"
|
@@ -25,14 +25,12 @@ module Conjur::Debify
|
|
25
25
|
|
26
26
|
Dir.chdir dir do
|
27
27
|
version = cmd_options[:version] || detect_version
|
28
|
-
component = cmd_options[:component] || detect_component
|
29
|
-
package_name = "conjur-#{project_name}_#{version}_amd64.deb"
|
30
28
|
|
31
29
|
publish_image = create_image
|
32
30
|
DebugMixin.debug_write "Built base publish image '#{publish_image.id}'\n"
|
33
31
|
|
34
32
|
art_url = cmd_options[:url]
|
35
|
-
|
33
|
+
deb_art_repo = cmd_options[:repo]
|
36
34
|
|
37
35
|
art_user = ENV['ARTIFACTORY_USER']
|
38
36
|
art_password = ENV['ARTIFACTORY_PASSWORD']
|
@@ -40,23 +38,35 @@ module Conjur::Debify
|
|
40
38
|
art_user, art_password = fetch_art_creds
|
41
39
|
end
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
41
|
+
# Publish deb package
|
42
|
+
component = cmd_options[:component] || detect_component
|
43
|
+
deb_info = "#{distribution}/#{component}/amd64"
|
44
|
+
package_name = "conjur-#{project_name}_#{version}_amd64.deb"
|
45
|
+
publish_package(
|
46
|
+
publish_image: publish_image,
|
47
|
+
art_url: art_url,
|
48
|
+
art_user: art_user,
|
49
|
+
art_password: art_password,
|
50
|
+
art_repo: deb_art_repo,
|
51
|
+
package_name: package_name,
|
52
|
+
dir: dir,
|
53
|
+
deb_info: deb_info
|
54
|
+
)
|
55
|
+
|
56
|
+
# Publish RPM package
|
57
|
+
# The rpm builder replaces dashes with underscores in the version
|
58
|
+
rpm_version = version.tr('-', '_')
|
59
|
+
package_name = "conjur-#{project_name}-#{rpm_version}-1.x86_64.rpm"
|
60
|
+
rpm_art_repo = cmd_options['rpm-repo']
|
61
|
+
publish_package(
|
62
|
+
publish_image: publish_image,
|
63
|
+
art_url: art_url,
|
64
|
+
art_user: art_user,
|
65
|
+
art_password: art_password,
|
66
|
+
art_repo: rpm_art_repo,
|
67
|
+
package_name: package_name,
|
68
|
+
dir: dir
|
69
|
+
)
|
60
70
|
end
|
61
71
|
end
|
62
72
|
|
@@ -77,6 +87,39 @@ module Conjur::Debify
|
|
77
87
|
[conjur.resource(username_var).value, conjur.resource(password_var).value]
|
78
88
|
end
|
79
89
|
|
90
|
+
def publish_package(
|
91
|
+
publish_image:,
|
92
|
+
art_url:,
|
93
|
+
art_user:,
|
94
|
+
art_password:,
|
95
|
+
art_repo:,
|
96
|
+
package_name:,
|
97
|
+
dir:,
|
98
|
+
deb_info: nil
|
99
|
+
)
|
100
|
+
|
101
|
+
cmd_args = [
|
102
|
+
"jfrog", "rt", "upload",
|
103
|
+
"--url", art_url,
|
104
|
+
"--user", art_user,
|
105
|
+
"--password", art_password,
|
106
|
+
]
|
107
|
+
|
108
|
+
cmd_args += ["--deb", deb_info] if deb_info
|
109
|
+
cmd_args += [package_name, "#{art_repo}/"]
|
110
|
+
|
111
|
+
options = {
|
112
|
+
'Image' => publish_image.id,
|
113
|
+
'Cmd' => cmd_args,
|
114
|
+
'Binds' => [
|
115
|
+
[ dir, "/src" ].join(':')
|
116
|
+
]
|
117
|
+
}
|
118
|
+
options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
|
119
|
+
|
120
|
+
publish(options)
|
121
|
+
end
|
122
|
+
|
80
123
|
def publish(options)
|
81
124
|
container = Docker::Container.create(options)
|
82
125
|
begin
|
data/lib/conjur/debify/utils.rb
CHANGED
@@ -6,7 +6,7 @@ module Conjur::Debify::Utils
|
|
6
6
|
# copy a file from container to the current working directory
|
7
7
|
def copy_from_container container, path
|
8
8
|
tar = StringIO.new
|
9
|
-
container.
|
9
|
+
container.archive_out(path) { |chunk| tar.write chunk }
|
10
10
|
tar.rewind
|
11
11
|
Gem::Package::TarReader.new(tar).each do |entry|
|
12
12
|
File.write entry.full_name, entry.read
|