conjur-debify 1.11.5 → 2.1.1.pre.957

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58a50a072fd2700fa612ac0a6113f2a6227787ed67ac732767443dc26a6f9e72
4
- data.tar.gz: ba642699eb85c6506091ccdb8c82779a1f4daf9b5e00f45e071f910b889883e5
3
+ metadata.gz: 900a9fd06b803b1a556d3b718cb8db6ac73b442eb78b414417af39764783d214
4
+ data.tar.gz: d634ed0e025e341cca3a0e085bdbd75dde1f965112dffcb2bdbf9c920209aa6b
5
5
  SHA512:
6
- metadata.gz: 3674127fd6cc68ee9696f552edac2a089efe2c9ab6e1b0ac212ee78b4b282735e03ec65f15c7502592e2c31702a182756e6744c8a3bbc90a2e04b1c06ad6ffeb
7
- data.tar.gz: 31b3d6dd4a7c414ea09ea97e98ef1a56963d4724b4bd637fbd0379f7f53db0c9d0be22981a1de2de748aa8925a5b15d82b6551e4eb7b4edf6c68579c7f5b9d3b
6
+ metadata.gz: a143de7e6c1b954d95ed224c96d477afdaa63cf4642019b7b01392b68f5e214246eb3c3a568d1dfc3d43b8d05c288f7b449dc9a8ad6500bf3ca2c45a516897e5
7
+ data.tar.gz: 154e6740f311f41038631cadc7aeff5a52922b6dbf150d7058cf0bb90fd6fc4b0119ecef507cc301cf6f10621ce132254189e39582de1e2897876d81842f0d0f
data/.gitignore CHANGED
@@ -16,5 +16,6 @@ features/reports
16
16
  results.html
17
17
  mkmf.log
18
18
  *.deb
19
+ *.rpm
19
20
  *.gem
20
21
  docker-debify
data/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## [2.1.1]
2
+ ### Changed
3
+
4
+ - Update to use automated release process
5
+
6
+ # 2.1.0
7
+ ### Changed
8
+
9
+ - Refine bundler related steps in `debify package` flow: only `package.sh` file configures
10
+ and invokes bundler. `Dockerfile.fpm` only copies files and adjusts folder structure.
11
+ - Remove bundler 1.* support
12
+
13
+ # 2.0.0
14
+ ### Changed
15
+ - Debify now receives the flag `--output` as input to indicate the file type that it should package (e.g `rpm`). If this
16
+ flag is not given, the default value is `deb`.
17
+ [conjurinc/debify#56](https://github.com/conjurinc/debify/issues/56)
18
+
19
+ # 1.12.0
20
+
21
+ ### Added
22
+ - Debify now packages and publishes an RPM file, alongside a debian file.
23
+ [conjurinc/debify#49](https://github.com/conjurinc/debify/pull/49)
24
+ - `debify package` now offers an `--additional-files` flag to provide a comma
25
+ separated list of files to include in the FPM build that are not provided
26
+ automatically by `git ls-files`.
27
+ [conjurinc/debify#52](https://github.com/conjurinc/debify/pull/52)
28
+
29
+ ### Fixed
30
+ - Bug causing `all` files in the git repo to be added to the debian file.
31
+ [conjurinc/debify#50](https://github.com/conjurinc/debify/pull/50)
32
+
1
33
  # 1.11.5
2
34
 
3
35
  ### Changed
data/Dockerfile CHANGED
@@ -1,46 +1,33 @@
1
1
  FROM ruby:2.6-stretch
2
2
 
3
- ### DockerInDocker support is take from
4
- ### https://github.com/jpetazzo/dind/blob/master/Dockerfile . I
5
- ### elected to base this image on ruby, then pull in the (slightly
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
3
  RUN apt-get update -qq && \
11
4
  apt-get dist-upgrade -qqy && \
12
5
  apt-get install -qqy \
13
6
  apt-transport-https \
14
7
  ca-certificates \
15
- curl \
16
- lxc \
17
- iptables
8
+ curl
18
9
 
19
- # Install Docker from Docker Inc. repositories.
20
- RUN curl -sSL https://get.docker.com/ | sh
21
-
22
- # Install the magic wrapper.
23
- RUN curl -sSL -o /usr/local/bin/wrapdocker https://raw.githubusercontent.com/jpetazzo/dind/master/wrapdocker
24
- RUN chmod +x /usr/local/bin/wrapdocker
25
-
26
- # Define additional metadata for our image.
27
- VOLUME /var/lib/docker
28
-
29
- ### 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
30
16
 
31
17
  RUN mkdir -p /debify
32
18
  WORKDIR /debify
33
19
 
34
20
  COPY . ./
35
21
 
22
+ RUN gem install bundler:2.2.30
36
23
  RUN gem build debify.gemspec
37
24
 
38
25
  ARG VERSION
39
- RUN gem install -N conjur-debify-${VERSION}.gem
26
+ RUN gem install -N conjur-debify-*.gem
40
27
 
41
28
  ARG CONJUR_APPLIANCE_URL
42
- ENV CONJUR_APPLIANCE_URL ${CONJUR_APPLIANCE_URL:-https://conjur-master-v2.itp.conjur.net/api}
29
+ ENV CONJUR_APPLIANCE_URL ${CONJUR_APPLIANCE_URL:-https://conjurops.itp.conjur.net}
43
30
  ENV CONJUR_ACCOUNT ${CONJUR_ACCOUNT:-conjur}
44
- ENV CONJUR_VERSION ${CONJUR_VERSION:-4}
31
+ ENV CONJUR_VERSION ${CONJUR_VERSION:-5}
45
32
 
46
33
  ENTRYPOINT ["/debify/distrib/entrypoint.sh"]
data/Jenkinsfile CHANGED
@@ -1,5 +1,18 @@
1
1
  #!/usr/bin/env groovy
2
2
 
3
+ // Automated release, promotion and dependencies
4
+ properties([
5
+ release.addParams(),
6
+ dependencies(['cyberark/conjur-base-image'])
7
+ ])
8
+
9
+ if (params.MODE == "PROMOTE") {
10
+ release.promote(params.VERSION_TO_PROMOTE) { sourceVersion, targetVersion, assetDirectory ->
11
+ sh './publish-rubygems.sh'
12
+ }
13
+ return
14
+ }
15
+
3
16
  pipeline {
4
17
  agent { label 'executor-v2' }
5
18
 
@@ -13,8 +26,25 @@ pipeline {
13
26
  cron(getDailyCronString())
14
27
  }
15
28
 
29
+ environment {
30
+ MODE = release.canonicalizeMode()
31
+ }
32
+
16
33
  stages {
17
- stage('Checkout') {
34
+ stage ("Skip build if triggering job didn't create a release") {
35
+ when {
36
+ expression {
37
+ MODE == "SKIP"
38
+ }
39
+ }
40
+ steps {
41
+ script {
42
+ currentBuild.result = 'ABORTED'
43
+ error("Aborting build because this build was triggered from upstream, but no release was built")
44
+ }
45
+ }
46
+ }
47
+ stage('Prepare') {
18
48
  steps {
19
49
  // One of our cukes tests to see if debify can correctly
20
50
  // determine the version for the package being created, based
@@ -24,6 +54,9 @@ pipeline {
24
54
  // I couldn't find any way to configure the plugin, so I used
25
55
  // the Snippet Generator to create this:
26
56
  checkout([$class: 'GitSCM', branches: [[name: env.BRANCH_NAME]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'conjur-jenkins', url: 'git@github.com:conjurinc/debify.git']]])
57
+
58
+ // Initialize VERSION file
59
+ updateVersion("CHANGELOG.md", "${BUILD_NUMBER}")
27
60
  }
28
61
  }
29
62
  stage('Build docker image') {
@@ -42,10 +75,14 @@ pipeline {
42
75
  scanAndReport("debify:${VERSION}", "HIGH", false)
43
76
  }
44
77
  }
45
- // No all report generated because it currently adds 10-12 minutes of
46
- // build time just to write the trivy report. It'll be added once we've
47
- // cleaned up and/or ignored enough issues to reduce the impact
48
- // on build time.
78
+ stage('Scan Docker image for all issues') {
79
+ steps{
80
+ script {
81
+ VERSION = sh(returnStdout: true, script: 'cat VERSION')
82
+ }
83
+ scanAndReport("debify:${VERSION}", "NONE", true)
84
+ }
85
+ }
49
86
  }
50
87
  }
51
88
 
@@ -66,31 +103,16 @@ pipeline {
66
103
  }
67
104
 
68
105
  stage('Publish to RubyGems') {
69
- agent { label 'releaser-v2' }
70
106
  when {
71
- allOf {
72
- branch 'master'
73
- /* expression {
74
- boolean publish = false
75
-
76
- try {
77
- timeout(time: 5, unit: 'MINUTES') {
78
- input(message: 'Publish to RubyGems?')
79
- publish = true
80
- }
81
- } catch (final ignore) {
82
- publish = false
83
- }
84
-
85
- return publish
86
- }*/
107
+ expression {
108
+ MODE == "RELEASE"
87
109
  }
88
110
  }
89
111
 
90
112
  steps {
91
- checkout scm
92
- sh './publish-rubygem.sh'
93
- deleteDir()
113
+ release {
114
+ sh './publish-rubygem.sh'
115
+ }
94
116
  }
95
117
  }
96
118
  }
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 4.9-stable --net testnet
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
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
- t.cucumber_opts = opts
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.11.5
1
+ 2.1.1-957
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,32 +6,32 @@ 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 = ["Kevin Gilpin"]
10
- spec.email = ["kgilpin@conjur.net"]
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"
14
14
 
15
- spec.files = `git ls-files -z`.split("\x0")
15
+ spec.files = `git ls-files -z`.split("\x0").append("VERSION")
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "gli"
21
- spec.add_dependency "docker-api", "~> 1.33"
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", "~> 1.7"
25
+ spec.add_development_dependency "bundler", ">= 2.2.30"
26
26
  spec.add_development_dependency "fakefs", "~> 0"
27
- spec.add_development_dependency "rake", "~> 12.3.3"
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", "~> 0.14"
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
@@ -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 ${netrc}:/root/.netrc:ro \
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@@} "$@"
@@ -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. Then, run
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, just run debify itself. Any commands that do
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
@@ -29,4 +29,4 @@ DEPENDENCIES
29
29
  rspec
30
30
 
31
31
  BUNDLED WITH
32
- 1.16.1
32
+ 2.1.4
data/example/net-test.sh CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  cid=$1
4
4
 
5
- docker exec $cid ping -c1 other_host
5
+ docker exec $cid curl -s http://other_host > /dev/null
6
6
 
7
7
  echo Test succeeded
@@ -2,16 +2,22 @@
2
2
  Feature: Packaging
3
3
 
4
4
  Background:
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`
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.1_amd64.deb"
9
- And the stdout should contain "conjur-example-dev_0.0.1_amd64.deb"
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.1_amd64.deb"
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 4.9 example`
23
+ When I successfully run `env DEBUG=true GLI_DEBUG=true debify publish -v 0.0.1-suffix -d ../../example 5.0 example`
@@ -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.9-stable`
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 4.9-stable --no-pull"
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 4.9-stable --no-pull --link other_host -c 'ping -c1 other_host'"
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 4.9-stable --no-pull --net test-net -c 'ping -c1 other_host'"
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 4.9-stable --no-pull --net test-net --link another_host:other_host -c 'ping -c1 other_host'"
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
- 'Cmd' => [ "sh", "-c", "while true; do sleep 1; done" ],
19
- 'Image' => alpine.id
17
+ 'Image' => 'nginx'
20
18
  }
21
19
  options['HostConfig'] = { 'NetworkMode' => net_name } if net_name
22
20
 
@@ -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
-
@@ -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 4.9-stable -v 0.0.1 -d ../../example --no-pull example test.sh`
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 4.9-stable -v 0.0.1 -d ../../example --no-pull --link other_host example net-test.sh`
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 4.9-stable -v 0.0.1 -d ../../example --no-pull --net test-net example net-test.sh`
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 4.9-stable -v 0.0.1 -d ../../example --no-pull --link another_host:other_host --net test-net example net-test.sh`
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"
@@ -7,10 +7,6 @@ WORKDIR /src/opt/conjur/project
7
7
  COPY Gemfile ./
8
8
  COPY Gemfile.lock ./
9
9
 
10
- RUN bundle --deployment
11
- RUN mkdir -p .bundle
12
- RUN cp /usr/local/bundle/config .bundle/config
13
-
14
10
  COPY . .
15
11
  ADD debify.sh /
16
12
 
@@ -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
- art_repo = cmd_options[:repo]
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
- options = {
44
- 'Image' => publish_image.id,
45
- 'Cmd' => [
46
- "jfrog", "rt", "upload",
47
- "--url", art_url,
48
- "--user", art_user,
49
- "--password", art_password,
50
- "--deb", "#{distribution}/#{component}/amd64",
51
- package_name, "#{art_repo}/"
52
- ],
53
- 'Binds' => [
54
- [ dir, "/src" ].join(':')
55
- ]
56
- }
57
- options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
58
-
59
- publish(options)
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
@@ -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.copy(path) { |chunk| tar.write chunk }
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