conjur-debify 2.0.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f76a5ea0e2c4fc01e0666594176690174cf1894f478570118056908c03c5e81
4
- data.tar.gz: ebdb065547d044394079979326f759118e264a640a5feb41341fdba6386de661
3
+ metadata.gz: 2f1513a687cde9e9f2079436b6c9b290748d22a66ebd890c957e4dd1e9200592
4
+ data.tar.gz: bdbc0f7c3ce085d8ac9ad012b51c07498efcd21218896eb73e6bd4ef12806391
5
5
  SHA512:
6
- metadata.gz: ed14d2fecc7c4229f8c3c59d289acd39b7defd6c046b5417d332d7adfe6b921cdc5dc16b81f95825b07e9d595f92ecc7924508fc0529f6ccce00bd182e0d8f65
7
- data.tar.gz: 9c8aaaa932d2971d549a2db859c2e47c16f26890fc25ed6491c5cd854fb4d363af289312947e5f9deb950d55b044a6bc32158472445c391241bd19604d7a5725
6
+ metadata.gz: 77413aeaa1c6e74e293522012375671357a265d25d7e9d70cae42df8218b265a12cdfe5612bcab58b569fc9cb07ba30a44ee595f962239322b4871849f8b3b69
7
+ data.tar.gz: dc986fbd9bb73204846c8a39ed791432c4d668ac9c1facb51863765e67c81d5ebe004152440ff67b963a5b69abb931924f984c980cd70208c83566d9c6fabcea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
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
+
3
10
  # 2.0.0
4
11
  ### Changed
5
12
  - Debify now receives the flag `--output` as input to indicate the file type that it should package (e.g `rpm`). If this
data/Dockerfile CHANGED
@@ -19,14 +19,15 @@ WORKDIR /debify
19
19
 
20
20
  COPY . ./
21
21
 
22
+ RUN gem install bundler:2.2.30
22
23
  RUN gem build debify.gemspec
23
24
 
24
25
  ARG VERSION
25
26
  RUN gem install -N conjur-debify-${VERSION}.gem
26
27
 
27
28
  ARG CONJUR_APPLIANCE_URL
28
- 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}
29
30
  ENV CONJUR_ACCOUNT ${CONJUR_ACCOUNT:-conjur}
30
- ENV CONJUR_VERSION ${CONJUR_VERSION:-4}
31
+ ENV CONJUR_VERSION ${CONJUR_VERSION:-5}
31
32
 
32
33
  ENTRYPOINT ["/debify/distrib/entrypoint.sh"]
data/Jenkinsfile CHANGED
@@ -42,10 +42,14 @@ pipeline {
42
42
  scanAndReport("debify:${VERSION}", "HIGH", false)
43
43
  }
44
44
  }
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.
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
+ }
49
53
  }
50
54
  }
51
55
 
@@ -89,7 +93,6 @@ pipeline {
89
93
  steps {
90
94
  checkout scm
91
95
  sh './publish-rubygem.sh'
92
- deleteDir()
93
96
  }
94
97
  }
95
98
  }
data/README.md CHANGED
@@ -289,7 +289,7 @@ Start a sandbox, see that it can resolve the hostname `mydb`:
289
289
 
290
290
  ```sh-session
291
291
 
292
- example $ debify sandbox -t 4.9-stable --net testnet
292
+ example $ debify sandbox -t 5.0-stable --net testnet
293
293
  example $ docker exec -it example-sandbox /bin/bash
294
294
  root@7d4217655332:/src/example# getent hosts mydb
295
295
  172.19.0.2 mydb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
data/debify.gemspec CHANGED
@@ -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", "~> 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
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
@@ -1,4 +1,3 @@
1
- @skip
2
1
  @announce-output
3
2
  Feature: Packaging
4
3
 
@@ -6,6 +5,7 @@ Feature: Packaging
6
5
  # We use version 0.0.1-suffix to verify that RPM converts dashes to underscores
7
6
  # in the version as we expect
8
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
9
 
10
10
  Scenario: 'example' project can be packaged successfully
11
11
  Then the stdout should contain "conjur-example_0.0.1-suffix_amd64.deb"
@@ -20,4 +20,4 @@ Feature: Packaging
20
20
  And the stdout from "find ../../example" should not contain "conjur-example-0.0.1_suffix-1.x86_64.rpm"
21
21
 
22
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 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,23 +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
5
  # The extra containers will use the `alpine` image, so we need to pull it first on the
6
6
  # host to use the authenticated DockerHub connection. This avoids hitting DockerHub
7
7
  # rate limits.
8
- And I successfully run `docker pull alpine`
8
+ And I successfully run `docker pull nginx`
9
9
 
10
10
  Scenario: sandbox for 'example' project be started
11
- 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"
12
12
 
13
13
  Scenario: sandbox for 'example' project be started linked to another container
14
14
  Given I start a container named "other_host"
15
- 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'"
16
16
 
17
17
  Scenario: sandbox for 'example' project be started on a network other than the default
18
18
  Given I start a container named "other_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 -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'"
20
20
 
21
21
  Scenario: sandbox for 'example' project be started 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
- 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'"
@@ -14,8 +14,7 @@ When /^I start a container named "(.*?)"(?: on network "(.*?)")*$/ do |name, net
14
14
 
15
15
  options = {
16
16
  'name' => name,
17
- 'Cmd' => [ "sh", "-c", "while true; do sleep 1; done" ],
18
- 'Image' => 'alpine'
17
+ 'Image' => 'nginx'
19
18
  }
20
19
  options['HostConfig'] = { 'NetworkMode' => net_name } if net_name
21
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
 
@@ -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
data/lib/conjur/debify.rb CHANGED
@@ -91,7 +91,13 @@ def detect_version
91
91
  end
92
92
 
93
93
  def git_files
94
- (`git ls-files -z`.split("\x0") + ['Gemfile.lock']).uniq
94
+ files = (`git ls-files -z`.split("\x0") + ['Gemfile.lock']).uniq
95
+ # Since submodule directories are listed, but are not files, we remove them.
96
+ # Currently, `conjur-project-config` is the only submodule in Conjur, and it
97
+ # can safely be removed because it's a developer-only tool. If we add another
98
+ # submodule in the future needed for production, we'll need to update this
99
+ # code. But YAGNI for now.
100
+ files.select { |f| File.file?(f) }
95
101
  end
96
102
 
97
103
  def login_to_registry(appliance_image_id)
@@ -266,7 +272,17 @@ command "package" do |c|
266
272
  additional_files = cmd_options[:'additional-files'].split(',').map(&:strip)
267
273
  end
268
274
 
269
- fpm_image = Docker::Image.build_from_dir File.expand_path('fpm', File.dirname(__FILE__)), tag: "debify-fpm", &DebugMixin::DOCKER
275
+ begin
276
+ tries ||= 2
277
+ fpm_image = Docker::Image.build_from_dir File.expand_path('fpm', File.dirname(__FILE__)), tag: "debify-fpm", &DebugMixin::DOCKER
278
+ rescue
279
+ image_id = File.readlines(File.expand_path('fpm/Dockerfile', File.dirname(__FILE__)))
280
+ .find { | line | line =~ /^FROM/ }
281
+ .split(' ')
282
+ .last
283
+ login_to_registry image_id
284
+ retry unless (tries -= 1).zero?
285
+ end
270
286
  DebugMixin.debug_write "Built base fpm image '#{fpm_image.id}'\n"
271
287
  dir = File.expand_path(dir)
272
288
 
@@ -1,5 +1,5 @@
1
1
  # Build from the same version of ubuntu as phusion/baseimage
2
- FROM cyberark/phusion-ruby-fips:0.11-latest
2
+ FROM cyberark/phusion-ruby-fips:latest
3
3
 
4
4
  RUN apt-get update -y && \
5
5
  apt-get dist-upgrade -y && \
@@ -8,14 +8,12 @@ RUN apt-get update -y && \
8
8
  libffi-dev \
9
9
  rpm
10
10
 
11
- RUN gem install --no-document bundler:1.17.3 \
12
- fpm
11
+ RUN gem install --no-document fpm
13
12
 
14
13
  ENV GEM_HOME /usr/local/bundle
15
14
  ENV BUNDLE_PATH="$GEM_HOME" \
16
15
  BUNDLE_BIN="$GEM_HOME/bin" \
17
- BUNDLE_SILENCE_ROOT_WARNING=1 \
18
- BUNDLE_APP_CONFIG="$GEM_HOME"
16
+ BUNDLE_SILENCE_ROOT_WARNING=1
19
17
  ENV PATH $BUNDLE_BIN:$PATH
20
18
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" && \
21
19
  chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
@@ -37,11 +37,13 @@ echo params at the end are $@
37
37
 
38
38
  # Build dev package first
39
39
  prefix=/src/opt/conjur/project
40
- cp -al $prefix /dev-pkg
41
40
  cd $prefix
42
- bundle --without development test
41
+ bundle config set --local deployment 'true' && \
42
+ bundle config set --local path 'vendor/bundle' && \
43
+ bundle
44
+ cp -al $prefix /dev-pkg
45
+ bundle config set --local without 'development test'
43
46
  bundle clean
44
- cp /usr/local/bundle/config .bundle/config # bundler for some reason stores config there...
45
47
  cd /dev-pkg
46
48
  remove_matching $prefix
47
49
  bundle_clean
@@ -83,7 +85,7 @@ mkdir -p opt/conjur/etc
83
85
 
84
86
  [ -d opt/conjur/"$project_name"/distrib ] && mv opt/conjur/"$project_name"/distrib /
85
87
 
86
- echo "Building conjur-$project_name-dev $file_type package"
88
+ echo "Building conjur-$project_name $file_type package"
87
89
 
88
90
  fpm \
89
91
  -s dir \
@@ -1,11 +1,5 @@
1
- FROM buildpack-deps:curl
1
+ FROM releases-docker.jfrog.io/jfrog/jfrog-cli:1.52.0
2
2
 
3
3
  ENV JFROG_CLI_OFFER_CONFIG=false
4
- ENV JFROG_VERSION=1.13.1
5
-
6
- RUN curl -kL \
7
- -o /usr/bin/jfrog \
8
- https://bintray.com/jfrog/jfrog-cli-go/download_file?file_path=${JFROG_VERSION}%2Fjfrog-cli-linux-amd64%2Fjfrog && \
9
- chmod +x /usr/bin/jfrog
10
4
 
11
5
  WORKDIR /src
@@ -30,7 +30,7 @@ describe "remove_matching()", type: :aruba do
30
30
  end
31
31
 
32
32
  def remove_matching
33
- run_simple "bash -c 'source #{DEBIFY_UTILS_PATH}; cd #{herepath}; remove_matching #{therepath}'"
33
+ run_command_and_stop "bash -c 'source #{DEBIFY_UTILS_PATH}; cd #{herepath}; remove_matching #{therepath}'"
34
34
  end
35
35
 
36
36
  def here files
data/spec/utils_spec.rb CHANGED
@@ -6,7 +6,7 @@ describe 'Conjur::Debify::Utils.copy_from_container' do
6
6
  it "copies a file from the container to the current directory" do
7
7
  tar = File.read "#{__dir__}/data/test.tar"
8
8
  container = instance_double Docker::Container
9
- allow(container).to receive(:copy).with "/tmp/test.tar" do |&b|
9
+ allow(container).to receive(:archive_out).with "/tmp/test.tar" do |&b|
10
10
  StringIO.new(tar).each(nil, 512) do |c|
11
11
  # docker api sends three arguments, so emulate that
12
12
  b[c, nil, nil]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-debify
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CyberArk Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-16 00:00:00.000000000 Z
11
+ date: 2021-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.33'
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.33'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: conjur-cli
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.7'
75
+ version: 2.2.30
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '1.7'
82
+ version: 2.2.30
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: fakefs
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 12.3.3
103
+ version: '13.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 12.3.3
110
+ version: '13.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: cucumber
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.14'
131
+ version: '1.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.14'
138
+ version: '1.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  - !ruby/object:Gem::Version
251
251
  version: '0'
252
252
  requirements: []
253
- rubygems_version: 3.1.2
253
+ rubygems_version: 3.1.6
254
254
  signing_key:
255
255
  specification_version: 4
256
256
  summary: Utility commands to build and package Conjur services as Debian packages