conjur-debify 3.0.3.pre.10 → 3.0.3.pre.1914

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: 436c92c5c492573a754e82a9b35ef13aca64a795fd4a01e125951488a107978c
4
- data.tar.gz: bdecbbddaf1e13882847e3d11eb8e2c4ae597f95c036dcb74021c3ff1dc340f5
3
+ metadata.gz: b361743dc7723ab21f23aa6b3192161d8a4ef64f175654db610f3a0c30390486
4
+ data.tar.gz: 70d7d42091e3a99882af0a649e36188eda5f1da138c149ae718978675b119bff
5
5
  SHA512:
6
- metadata.gz: a971c4675b727301536f00a606dbe54d1f011fc660daa29708c060fe2be55967a21caa872f5aaeca3c4cef04f37b79cea3887d83a86222b2326801553e822490
7
- data.tar.gz: 4529e3f15f359cdd0009c6cbd2ba3c70db72ee122aea0f9de41bf1573df45f393a77030b987a58b61ea718222b5d3ed9b2e01b3a8157abf3eea7bd5a02927298
6
+ metadata.gz: 5156842479768b6005995b228589e61834bab51a19f553c1e602b59c0ef31d57419959622bad33754a76899d0bb6bb1f5323735447fcba73792ec8ced473defe
7
+ data.tar.gz: 1841a0b4ec0b5507593b7d8f38cdccc512e9f0b9b3a40fc8e94bba35bd5ef73024918a257a96d50ed0d09e4b7c98f6c021de7a53785e728748917a7930780c78
data/CHANGELOG.md CHANGED
@@ -1,11 +1,4 @@
1
1
  ## [3.0.3]
2
- ### Added
3
- - Build arm64 image on separate agent with dedicated architecture
4
- - Upload artifacts for all packaged architectures to artifactory
5
-
6
- ### Fixed
7
- - Fixed regressions introduced by incorrect linting fixes. Most significantly,
8
- preventing the `VERSION` file from being included in release packages.
9
2
 
10
3
  ## [3.0.2]
11
4
  ### Changed
@@ -44,11 +37,11 @@
44
37
 
45
38
  - Refine bundler related steps in `debify package` flow: only `package.sh` file configures
46
39
  and invokes bundler. `Dockerfile.fpm` only copies files and adjusts folder structure.
47
- - Remove bundler 1.* support
40
+ - Remove bundler 1.* support
48
41
 
49
42
  # 2.0.0
50
43
  ### Changed
51
- - Debify now receives the flag `--output` as input to indicate the file type that it should package (e.g `rpm`). If this
44
+ - Debify now receives the flag `--output` as input to indicate the file type that it should package (e.g `rpm`). If this
52
45
  flag is not given, the default value is `deb`.
53
46
  [conjurinc/debify#56](https://github.com/conjurinc/debify/issues/56)
54
47
 
data/Jenkinsfile CHANGED
@@ -2,33 +2,23 @@
2
2
 
3
3
  // Automated release, promotion and dependencies
4
4
  properties([
5
- // Include the automated release parameters for the build
6
5
  release.addParams(),
7
- // Dependencies of the project that should trigger builds
8
- dependencies([])
6
+ dependencies(['cyberark/conjur-base-image'])
9
7
  ])
10
8
 
11
- // Performs release promotion. No other stages will be run
12
9
  if (params.MODE == "PROMOTE") {
13
- release.promote(params.VERSION_TO_PROMOTE) { infrapool, sourceVersion, targetVersion, assetDirectory ->
14
- // Any assets from sourceVersion Github release are available in assetDirectory
15
- // Any version number updates from sourceVersion to targetVersion occur here
16
- // Any publishing of targetVersion artifacts occur here
17
- // Anything added to assetDirectory will be attached to the Github Release
18
-
19
- //Note: assetDirectory is on the infrapool agent, not the local Jenkins agent.
20
- infrapool.agentSh './publish-rubygem.sh'
10
+ release.promote(params.VERSION_TO_PROMOTE) { sourceVersion, targetVersion, assetDirectory ->
11
+ sh './publish-rubygem.sh'
21
12
  }
22
- release.copyEnterpriseRelease(params.VERSION_TO_PROMOTE)
23
13
  return
24
14
  }
25
15
 
26
16
  pipeline {
27
- agent { label 'conjur-enterprise-common-agent' }
17
+ agent { label 'executor-v2' }
28
18
 
29
19
  options {
30
20
  timestamps()
31
- buildDiscarder(logRotator(numToKeepStr: '30'))
21
+ buildDiscarder(logRotator(daysToKeepStr: '30'))
32
22
  }
33
23
 
34
24
  triggers {
@@ -36,12 +26,10 @@ pipeline {
36
26
  }
37
27
 
38
28
  environment {
39
- // Sets the MODE to the specified or autocalculated value as appropriate
40
29
  MODE = release.canonicalizeMode()
41
30
  }
42
31
 
43
32
  stages {
44
- // Aborts any builds triggered by another project that wouldn't include any changes
45
33
  stage ("Skip build if triggering job didn't create a release") {
46
34
  when {
47
35
  expression {
@@ -55,86 +43,34 @@ pipeline {
55
43
  }
56
44
  }
57
45
  }
58
-
59
- stage('Get InfraPool ExecutorV2 Agent(s)') {
46
+ stage('Prepare') {
60
47
  steps {
61
- script {
62
- // Request ExecutorV2 agents for 1 hour(s)
63
- INFRAPOOL_EXECUTORV2_AGENT_0 = getInfraPoolAgent.connected(type: "ExecutorV2", quantity: 1, duration: 1)[0]
64
- INFRAPOOL_EXECUTORV2ARM_AGENT_0 = getInfraPoolAgent.connected(type: "ExecutorV2ARM", quantity: 1, duration: 1)[0]
65
- }
48
+ // Initialize VERSION file
49
+ updateVersion("CHANGELOG.md", "${BUILD_NUMBER}")
66
50
  }
67
51
  }
68
-
69
- stage('Prepare') {
70
- parallel {
71
- stage('Prepare AMD64') {
72
- steps {
73
- // Initialize VERSION file
74
- updateVersion(INFRAPOOL_EXECUTORV2_AGENT_0, "CHANGELOG.md", "${BUILD_NUMBER}")
75
- }
76
- }
77
-
78
- stage('Prepare ARM64') {
79
- steps {
80
- // Initialize VERSION file
81
- updateVersion(INFRAPOOL_EXECUTORV2ARM_AGENT_0, "CHANGELOG.md", "${BUILD_NUMBER}")
82
- }
83
- }
52
+ stage('Build docker image') {
53
+ steps {
54
+ sh './build.sh'
84
55
  }
85
56
  }
86
57
 
87
- stage('Build Docker image') {
88
- parallel {
89
- stage('Build AMD64 image') {
90
- steps {
91
- script {
92
- INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './build.sh'
93
- }
94
- }
95
- }
96
-
97
- stage('Build ARM64 image') {
98
- steps {
99
- script {
100
- INFRAPOOL_EXECUTORV2ARM_AGENT_0.agentSh './build.sh'
101
- }
102
- }
103
- }
104
- }
105
- }
106
58
  stage('Scan Docker image') {
107
59
  parallel {
108
- stage('Scan Docker image for fixable issues (AMD64 based)') {
60
+ stage('Scan Docker image for fixable issues') {
109
61
  steps{
110
62
  script {
111
- VERSION = INFRAPOOL_EXECUTORV2_AGENT_0.agentSh(returnStdout: true, script: 'cat VERSION')
63
+ VERSION = sh(returnStdout: true, script: 'cat VERSION')
112
64
  }
113
- scanAndReport(INFRAPOOL_EXECUTORV2_AGENT_0, "debify:${VERSION}", "HIGH", false)
65
+ scanAndReport("debify:${VERSION}", "HIGH", false)
114
66
  }
115
67
  }
116
- stage('Scan Docker image for all issues (AMD64 based)') {
68
+ stage('Scan Docker image for all issues') {
117
69
  steps{
118
70
  script {
119
- VERSION = INFRAPOOL_EXECUTORV2_AGENT_0.agentSh(returnStdout: true, script: 'cat VERSION')
71
+ VERSION = sh(returnStdout: true, script: 'cat VERSION')
120
72
  }
121
- scanAndReport(INFRAPOOL_EXECUTORV2_AGENT_0, "debify:${VERSION}", "NONE", true)
122
- }
123
- }
124
- stage('Scan Docker image for fixable issues (ARM64 based)') {
125
- steps{
126
- script {
127
- VERSION = INFRAPOOL_EXECUTORV2ARM_AGENT_0.agentSh(returnStdout: true, script: 'cat VERSION')
128
- }
129
- scanAndReport(INFRAPOOL_EXECUTORV2ARM_AGENT_0, "debify:${VERSION}", "HIGH", false)
130
- }
131
- }
132
- stage('Scan Docker image for all issues (ARM64 based)') {
133
- steps{
134
- script {
135
- VERSION = INFRAPOOL_EXECUTORV2ARM_AGENT_0.agentSh(returnStdout: true, script: 'cat VERSION')
136
- }
137
- scanAndReport(INFRAPOOL_EXECUTORV2ARM_AGENT_0, "debify:${VERSION}", "NONE", true)
73
+ scanAndReport("debify:${VERSION}", "NONE", true)
138
74
  }
139
75
  }
140
76
  }
@@ -142,46 +78,21 @@ pipeline {
142
78
 
143
79
  stage('Run feature tests') {
144
80
  steps {
145
- script {
146
- INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './test.sh'
147
- INFRAPOOL_EXECUTORV2_AGENT_0.agentStash name: 'test-results', includes: 'features/reports/*.xml'
148
- }
81
+ sh './test.sh'
149
82
  }
150
83
  post { always {
151
- unstash 'test-results'
152
84
  junit 'features/reports/*.xml'
153
85
  }}
154
86
  }
155
87
 
156
88
  stage('Push Docker image') {
157
- parallel {
158
- stage('Push AMD64 image') {
159
- steps {
160
- script {
161
- INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './push-image.sh amd64'
162
- }
163
- }
164
- }
165
-
166
- stage('Push ARM64 image') {
167
- steps {
168
- script {
169
- INFRAPOOL_EXECUTORV2ARM_AGENT_0.agentSh './push-image.sh arm64'
170
- }
171
- }
172
- }
173
- }
174
- }
175
-
176
- stage('Push Docker manifest with multi-arch') {
177
89
  steps {
178
- script {
179
- INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './push-manifest.sh'
180
- }
90
+ sh './tag-image.sh'
91
+ sh './push-image.sh'
181
92
  }
182
93
  }
183
94
 
184
- stage('Release') {
95
+ stage('Publish to RubyGems') {
185
96
  when {
186
97
  expression {
187
98
  MODE == "RELEASE"
@@ -189,31 +100,17 @@ pipeline {
189
100
  }
190
101
 
191
102
  steps {
192
- script {
193
- release(INFRAPOOL_EXECUTORV2_AGENT_0) { billOfMaterialsDirectory, assetDirectory ->
194
- /* Publish release artifacts to all the appropriate locations
195
- Copy any artifacts to assetDirectory on the infrapool node
196
- to attach them to the Github release.
197
-
198
- If your assets are on the infrapool node in the target
199
- directory, use a copy like this:
200
- infrapool.agentSh "cp target/* ${assetDirectory}"
201
- Note That this will fail if there are no assets, add :||
202
- if you want the release to succeed with no assets.
203
-
204
- If your assets are in target on the main Jenkins agent, use:
205
- infrapool.agentPut(from: 'target/', to: assetDirectory)
206
- */
207
- INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './publish-rubygem.sh'
208
- INFRAPOOL_EXECUTORV2_AGENT_0.agentSh "cp conjur-debify-*.gem release-assets/."
209
- }
103
+ release {
104
+ sh './publish-rubygem.sh'
105
+ sh "cp conjur-debify-*.gem release-assets/."
210
106
  }
211
107
  }
212
108
  }
213
109
  }
110
+
214
111
  post {
215
112
  always {
216
- releaseInfraPoolAgent()
113
+ cleanupAndNotify(currentBuild.currentResult)
217
114
  }
218
115
  }
219
- }
116
+ }
data/README.md CHANGED
@@ -116,7 +116,7 @@ COMMAND OPTIONS
116
116
  --additional-files=arg - Specify files to add to the FPM image that are not included from the git repo (default: none)
117
117
  -d, --dir=arg - Set the current working directory (default: none)
118
118
  --dockerfile=arg - Specify a custom Dockerfile.fpm (default: none)
119
- -i, --image=arg - Image name (default: cyberark/ubuntu-ruby-builder)
119
+ -i, --image=arg - Image name (default: cyberark/phusion-ruby-fips)
120
120
  -o, --output=arg - Set the output file type of the fpm command (e.g rpm) (default: none)
121
121
  -t, --image-tag=arg - Image tag, e.g. 4.5-stable, 4.6-stable (default: latest)
122
122
  -v, --version=arg - Specify the deb version; by default, it's read from the VERSION file (default: none)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.3-10
1
+ 3.0.3-1914
@@ -8,16 +8,16 @@ Feature: Packaging
8
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
- Then the output should match /conjur-example_0\.0\.1-suffix_(amd64|arm64)\.deb/
12
- And the output should match /conjur-example-dev_0\.0\.1-suffix_(amd64|arm64)\.deb/
13
- And the output should match /conjur-example-0\.0\.1_suffix-1\.(x86_64|aarch64)\.rpm/
14
- And the output should match /conjur-example-dev-0\.0\.1_suffix-1\.(x86_64|aarch64)\.rpm/
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
15
 
16
16
  Scenario: 'clean' command will delete non-Git-managed files
17
17
  When I successfully run `env DEBUG=true GLI_DEBUG=true debify clean -d ../../example --force`
18
- And I cd to "../../example"
19
- Then a file matching %r</conjur-example_0\.0\.1-suffix_(amd64|arm64)\.deb/> should not exist
20
- And a file matching %r</conjur-example-0\.0\.1_suffix-1\.(x86_64|aarch64)\.rpm/> should not exist
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
21
 
22
22
  Scenario: 'example' project can be published
23
23
  When I successfully run `env DEBUG=true GLI_DEBUG=true debify publish -v 0.0.1-suffix -d ../../example 5.0 example`
data/image-tags CHANGED
@@ -9,12 +9,9 @@ show_master_tags() {
9
9
  }
10
10
 
11
11
  show_branch_tags() {
12
- VERSION=$(< VERSION)
13
- docker run --rm debify:$VERSION config script > docker-debify
14
- chmod +x docker-debify
15
12
  # tail and tr, to remove the grottiness from the detect-version
16
13
  # output
17
- local version="$(DEBIFY_IMAGE=debify:$VERSION ./docker-debify detect-version | tail -1 | tr -d '\r')"
14
+ local version="$(DEBIFY_IMAGE=debify:$(<VERSION) ./docker-debify detect-version | tail -1 | tr -d '\r')"
18
15
 
19
16
  echo "$BRANCH_NAME $version"
20
17
  }
@@ -38,7 +38,7 @@ module Conjur::Debify
38
38
  art_user, art_password = fetch_art_creds
39
39
  end
40
40
 
41
- # Publish AMD64 deb package
41
+ # Publish deb package
42
42
  component = cmd_options[:component] || detect_component
43
43
  deb_info = "#{distribution}/#{component}/amd64"
44
44
  package_name = "conjur-#{project_name}_#{version}_amd64.deb"
@@ -53,26 +53,10 @@ module Conjur::Debify
53
53
  deb_info: deb_info
54
54
  )
55
55
 
56
- # (Optional) Publish ARM64 deb package
57
- unless Dir.glob('*_arm64.deb').empty?
58
- deb_info = "#{distribution}/#{component}/arm64"
59
- package_name = "conjur-#{project_name}_#{version}_arm64.deb"
60
- publish_package(
61
- publish_image: publish_image,
62
- art_url: art_url,
63
- art_user: art_user,
64
- art_password: art_password,
65
- art_repo: deb_art_repo,
66
- package_name: package_name,
67
- dir: dir,
68
- deb_info: deb_info
69
- )
70
- end
71
-
72
56
  # Publish RPM package
73
57
  # The rpm builder replaces dashes with underscores in the version
74
58
  rpm_version = version.tr('-', '_')
75
- package_name = "conjur-#{project_name}-#{rpm_version}-1.*.rpm"
59
+ package_name = "conjur-#{project_name}-#{rpm_version}-1.x86_64.rpm"
76
60
  rpm_art_repo = cmd_options['rpm-repo']
77
61
  publish_package(
78
62
  publish_image: publish_image,
data/lib/conjur/debify.rb CHANGED
@@ -5,7 +5,6 @@ require 'gli'
5
5
  require 'json'
6
6
  require 'base64'
7
7
  require 'tmpdir'
8
- require 'rbconfig'
9
8
 
10
9
  require 'conjur/debify/utils'
11
10
 
@@ -32,24 +31,24 @@ Docker.options[:read_timeout] = 300
32
31
  module DebugMixin
33
32
  DEBUG = ENV['DEBUG'].nil? ? true : ENV['DEBUG'].downcase == 'true'
34
33
 
35
- def debug(* a)
34
+ def debug *a
36
35
  DebugMixin.debug *a
37
36
  end
38
37
 
39
- def self.debug(* a)
38
+ def self.debug *a
40
39
  $stderr.puts *a if DEBUG
41
40
  end
42
41
 
43
- def debug_write(* a)
42
+ def debug_write *a
44
43
  DebugMixin.debug_write *a
45
44
  end
46
45
 
47
- def self.debug_write(* a)
46
+ def self.debug_write *a
48
47
  $stderr.write *a if DEBUG
49
48
  end
50
49
 
51
50
  # you can give this to various docker methods to print output if debug is on
52
- def self.docker_debug(* a)
51
+ def self.docker_debug *a
53
52
  if a.length == 2 && a[0].is_a?(Symbol)
54
53
  debug a.last
55
54
  else
@@ -91,26 +90,8 @@ def detect_version
91
90
  end
92
91
  end
93
92
 
94
- def detect_architecture
95
- architecture = RbConfig::CONFIG['arch']
96
- result_map = {}
97
-
98
- case architecture
99
- when /x86_64|amd64/
100
- result_map['deb'] = 'amd64'
101
- result_map['rpm'] = 'x86_64'
102
- when /arm64|aarch64/
103
- result_map['deb'] = 'arm64'
104
- result_map['rpm'] = 'aarch64'
105
- else
106
- raise "Unsupported architecture type: #{architecture}"
107
- end
108
-
109
- result_map
110
- end
111
-
112
93
  def git_files
113
- files = (`git ls-files -z`.split("\x0") + %w[Gemfile.lock VERSION]).uniq
94
+ files = (`git ls-files -z`.split("\x0") + ['Gemfile.lock', 'VERSION']).uniq
114
95
  # Since submodule directories are listed, but are not files, we remove them.
115
96
  # Currently, `conjur-project-config` is the only submodule in Conjur, and it
116
97
  # can safely be removed because it's a developer-only tool. If we add another
@@ -160,7 +141,7 @@ command "clean" do |c|
160
141
  c.desc "Force file deletion even if if this doesn't look like a Jenkins environment"
161
142
  c.switch [:force]
162
143
 
163
- c.action do |_, cmd_options, _|
144
+ c.action do |global_options, cmd_options, args|
164
145
  def looks_like_jenkins?
165
146
  require 'etc'
166
147
  Etc.getlogin == 'jenkins' && ENV['BUILD_NUMBER']
@@ -168,12 +149,12 @@ command "clean" do |c|
168
149
 
169
150
  require 'set'
170
151
  perform_deletion = cmd_options[:force] || looks_like_jenkins?
171
- unless perform_deletion
152
+ if !perform_deletion
172
153
  $stderr.puts "No --force, and this doesn't look like Jenkins. I won't actually delete anything"
173
154
  end
174
- @ignore_list = Array(cmd_options[:ignore]) + %w[. .. .git]
155
+ @ignore_list = Array(cmd_options[:ignore]) + ['.', '..', '.git']
175
156
 
176
- def ignore_file?(f)
157
+ def ignore_file? f
177
158
  @ignore_list.find { |ignore| f.index(ignore) == 0 }
178
159
  end
179
160
 
@@ -191,7 +172,7 @@ command "clean" do |c|
191
172
  File.directory?(file) || ignore_file?(file)
192
173
  }
193
174
  if perform_deletion
194
- image = Docker::Image.create 'fromImage' => "alpine:3.19.0"
175
+ image = Docker::Image.create 'fromImage' => "alpine:3.3"
195
176
  options = {
196
177
  'Cmd' => ["sh", "-c", "while true; do sleep 1; done"],
197
178
  'Image' => image.id,
@@ -209,7 +190,7 @@ command "clean" do |c|
209
190
  file = "/src/#{file}"
210
191
  cmd = ["rm", "-f", file]
211
192
 
212
- _, _, status = container.exec cmd, &DebugMixin::DOCKER
193
+ stdout, stderr, status = container.exec cmd, &DebugMixin::DOCKER
213
194
  $stderr.puts "Failed to delete #{file}" unless status == 0
214
195
  end
215
196
  ensure
@@ -274,15 +255,15 @@ command "package" do |c|
274
255
  c.flag [:'additional-files']
275
256
 
276
257
  c.desc "Image name"
277
- c.default_value "cyberark/ubuntu-ruby-builder"
258
+ c.default_value "cyberark/phusion-ruby-fips"
278
259
  c.flag [:i, :image]
279
260
 
280
261
  c.desc "Image tag, e.g. 4.5-stable, 4.6-stable"
281
262
  c.default_value "latest"
282
263
  c.flag [:t, :'image-tag']
283
264
 
284
- c.action do |_, cmd_options, args|
285
- raise "project-name is required" unless (project_name = args.shift)
265
+ c.action do |global_options, cmd_options, args|
266
+ raise "project-name is required" unless project_name = args.shift
286
267
 
287
268
  fpm_args = []
288
269
  if (delimeter = args.shift) == '--'
@@ -358,20 +339,30 @@ command "package" do |c|
358
339
  }
359
340
  options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
360
341
 
361
- file_path, dev_file_path = determine_file_path(file_type, detect_architecture, project_name, version)
362
-
363
342
  container = Docker::Container.create options
364
343
  begin
365
344
  DebugMixin.debug_write "Packaging #{project_name} in container #{container.id}\n"
366
- container.tap(&:start!).streaming_logs(follow: true, stdout: true, stderr: true) { |_, chunk| $stderr.puts "#{chunk}" }
345
+ container.tap(&:start!).streaming_logs(follow: true, stdout: true, stderr: true) { |stream, chunk| $stderr.puts "#{chunk}" }
367
346
  status = container.wait
368
347
  raise "Failed to package #{project_name}" unless status['StatusCode'] == 0
369
348
 
370
- copy_packages_from_container(
371
- container,
372
- file_path,
373
- dev_file_path
374
- )
349
+ if file_type == "deb"
350
+ # Copy deb packages
351
+ copy_packages_from_container(
352
+ container,
353
+ "conjur-#{project_name}_#{version}_amd64.deb",
354
+ "conjur-#{project_name}-dev_#{version}_amd64.deb"
355
+ )
356
+ elsif file_type == "rpm"
357
+ # Copy rpm packages
358
+ # The rpm builder replaces dashes with underscores in the version
359
+ rpm_version = version.tr('-', '_')
360
+ copy_packages_from_container(
361
+ container,
362
+ "conjur-#{project_name}-#{rpm_version}-1.x86_64.rpm",
363
+ "conjur-#{project_name}-dev-#{rpm_version}-1.x86_64.rpm"
364
+ )
365
+ end
375
366
  ensure
376
367
  container.delete(force: true)
377
368
  end
@@ -379,33 +370,13 @@ command "package" do |c|
379
370
  end
380
371
  end
381
372
 
382
- def determine_file_path(file_type, architecture_map, project_name, version)
383
- if file_type == "deb"
384
- architecture = architecture_map[file_type]
385
- file_path = "conjur-#{project_name}_#{version}_#{architecture}.#{file_type}"
386
- dev_file_path = "conjur-#{project_name}-dev_#{version}_#{architecture}.#{file_type}"
387
- elsif file_type == "rpm"
388
- architecture = architecture_map[file_type]
389
-
390
- # The rpm builder replaces dashes with underscores in the version
391
- version = version.tr('-', '_')
392
-
393
- file_path = "conjur-#{project_name}-#{version}-1.#{architecture}.#{file_type}"
394
- dev_file_path = "conjur-#{project_name}-dev-#{version}-1.#{architecture}.#{file_type}"
395
- else
396
- raise "Unrecognized file type: #{file_type}, must be one of the following: deb, rpm"
397
- end
398
-
399
- [file_path, dev_file_path]
400
- end
401
-
402
- def container_command(container, *args)
403
- stdout, _, exitcode = container.exec args, &DebugMixin::DOCKER
373
+ def container_command container, *args
374
+ stdout, stderr, exitcode = container.exec args, &DebugMixin::DOCKER
404
375
  exit_now! "Command failed : #{args.join(' ')}", exitcode unless exitcode == 0
405
376
  stdout
406
377
  end
407
378
 
408
- def wait_for_conjur(container)
379
+ def wait_for_conjur appliance_image, container
409
380
  container_command container, '/opt/conjur/evoke/bin/wait_for_conjur'
410
381
  rescue
411
382
  $stderr.puts container.logs(stdout: true, stderr: true)
@@ -509,8 +480,8 @@ command "test" do |c|
509
480
  network_options(c)
510
481
 
511
482
  c.action do |global_options, cmd_options, args|
512
- raise "project-name is required" unless (project_name = args.shift)
513
- raise "test-script is required" unless (test_script = args.shift)
483
+ raise "project-name is required" unless project_name = args.shift
484
+ raise "test-script is required" unless test_script = args.shift
514
485
  raise "Received extra command-line arguments" if args.shift
515
486
 
516
487
  dir = cmd_options[:dir] || '.'
@@ -582,11 +553,11 @@ RUN touch /etc/service/conjur/down
582
553
  options = {
583
554
  'Image' => appliance_image.id,
584
555
  'name' => project_name,
585
- 'Env' => %w[
586
- CONJUR_AUTHN_LOGIN=admin
587
- CONJUR_ENV=appliance
588
- CONJUR_AUTHN_API_KEY=SEcret12!!!!
589
- CONJUR_ADMIN_PASSWORD=SEcret12!!!!
556
+ 'Env' => [
557
+ "CONJUR_AUTHN_LOGIN=admin",
558
+ "CONJUR_ENV=appliance",
559
+ "CONJUR_AUTHN_API_KEY=SEcret12!!!!",
560
+ "CONJUR_ADMIN_PASSWORD=SEcret12!!!!",
590
561
  ] + global_options[:env],
591
562
  'HostConfig' => {
592
563
  'Binds' => [
@@ -619,9 +590,9 @@ RUN touch /etc/service/conjur/down
619
590
 
620
591
  # Wait for pg/main so that migrations can run
621
592
  30.times do
622
- stdout, _, exitcode = container.exec %w(sv status pg/main), &DebugMixin::DOCKER
593
+ stdout, stderr, exitcode = container.exec %w(sv status pg/main), &DebugMixin::DOCKER
623
594
  status = stdout.join
624
- break if exitcode == 0 && status =~ /^run/
595
+ break if exitcode == 0 && status =~ /^run\:/
625
596
  sleep 1
626
597
  end
627
598
 
@@ -636,7 +607,7 @@ RUN touch /etc/service/conjur/down
636
607
 
637
608
  container_command container, "rm", "/etc/service/conjur/down"
638
609
  container_command container, "sv", "start", "conjur"
639
- wait_for_conjur container
610
+ wait_for_conjur appliance_image, container
640
611
 
641
612
  system "./#{test_script} #{container.id}"
642
613
  exit_now! "#{test_script} failed with exit code #{$?.exitstatus}", $?.exitstatus unless $?.exitstatus == 0
@@ -732,11 +703,11 @@ command "sandbox" do |c|
732
703
  'name' => "#{project_name}-sandbox",
733
704
  'Image' => appliance_image.id,
734
705
  'WorkingDir' => "/src/#{project_name}",
735
- 'Env' => %w[
736
- CONJUR_AUTHN_LOGIN=admin
737
- CONJUR_ENV=appliance
738
- CONJUR_AUTHN_API_KEY=SEcret12!!!!
739
- CONJUR_ADMIN_PASSWORD=SEcret12!!!!
706
+ 'Env' => [
707
+ "CONJUR_AUTHN_LOGIN=admin",
708
+ "CONJUR_ENV=appliance",
709
+ "CONJUR_AUTHN_API_KEY=SEcret12!!!!",
710
+ "CONJUR_ADMIN_PASSWORD=SEcret12!!!!",
740
711
  ] + global_options[:env]
741
712
  }
742
713
 
@@ -775,7 +746,7 @@ command "sandbox" do |c|
775
746
  $stdout.puts container.id
776
747
  container.start!
777
748
 
778
- wait_for_conjur container
749
+ wait_for_conjur appliance_image, container
779
750
 
780
751
  if cmd_options[:'dev-install']
781
752
  container_command(container, "/opt/conjur/evoke/bin/dev-install", project_name)
@@ -827,10 +798,10 @@ command "publish" do |c|
827
798
  c.default_value "redhat-private"
828
799
  c.flag ['rpm-repo']
829
800
 
830
- c.action do |_, cmd_options, args|
801
+ c.action do |global_options, cmd_options, args|
831
802
  require 'conjur/debify/action/publish'
832
- raise "distribution is required" unless (distribution = args.shift)
833
- raise "project-name is required" unless (project_name = args.shift)
803
+ raise "distribution is required" unless distribution = args.shift
804
+ raise "project-name is required" unless project_name = args.shift
834
805
  raise "Received extra command-line arguments" if args.shift
835
806
 
836
807
  Conjur::Debify::Action::Publish.new(distribution, project_name, cmd_options).run
@@ -841,7 +812,7 @@ desc "Auto-detect and print the repository version"
841
812
  command "detect-version" do |c|
842
813
  c.desc "Set the current working directory"
843
814
  c.flag [:d, :dir]
844
- c.action do |_, cmd_options, args|
815
+ c.action do |global_options, cmd_options, args|
845
816
  raise "Received extra command-line arguments" if args.shift
846
817
 
847
818
  dir = cmd_options[:dir] || '.'
@@ -859,7 +830,7 @@ desc 'Show the given configuration'
859
830
  arg_name 'configuration'
860
831
  command 'config' do |c|
861
832
  c.action do |_, _, args|
862
- raise 'no configuration provided' unless (config = args.shift)
833
+ raise 'no configuration provided' unless config = args.shift
863
834
  raise "Received extra command-line arguments" if args.shift
864
835
 
865
836
  File.open(File.join('distrib', config)).each do |line|
@@ -867,3 +838,25 @@ command 'config' do |c|
867
838
  end
868
839
  end
869
840
  end
841
+
842
+
843
+ pre do |global, command, options, args|
844
+ # Pre logic here
845
+ # Return true to proceed; false to abort and not call the
846
+ # chosen command
847
+ # Use skips_pre before a command to skip this block
848
+ # on that command only
849
+ true
850
+ end
851
+
852
+ post do |global, command, options, args|
853
+ # Post logic here
854
+ # Use skips_post before a command to skip this
855
+ # block on that command only
856
+ end
857
+
858
+ on_error do |exception|
859
+ # Error logic here
860
+ # return false to skip default error handling
861
+ true
862
+ end
data/push-image.sh CHANGED
@@ -1,12 +1,6 @@
1
1
  #!/bin/bash -ex
2
2
 
3
- TAG=$(< VERSION)
4
- ARCH="$1"
5
- if [ -z "$ARCH" ]; then
6
- ARCH="amd64"
7
- fi
8
-
9
3
  for t in $(./image-tags); do
10
- docker tag "debify:$TAG" "registry.tld/conjurinc/debify:$t-$ARCH"
11
- docker push "registry.tld/conjurinc/debify:$t-$ARCH"
4
+ docker push registry.tld/conjurinc/debify:$t
12
5
  done
6
+
data/tag-image.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/bash -ex
2
+
3
+ TAG=$(< VERSION)
4
+ for t in $(./image-tags); do
5
+ docker tag debify:$TAG registry.tld/conjurinc/debify:$t
6
+ done
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: 3.0.3.pre.10
4
+ version: 3.0.3.pre.1914
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: 2024-01-11 00:00:00.000000000 Z
11
+ date: 2023-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -223,7 +223,6 @@ files:
223
223
  - lib/conjur/publish/Dockerfile
224
224
  - publish-rubygem.sh
225
225
  - push-image.sh
226
- - push-manifest.sh
227
226
  - secrets.yml
228
227
  - spec/action/publish_spec.rb
229
228
  - spec/data/Makefile
@@ -231,6 +230,7 @@ files:
231
230
  - spec/debify_utils_spec.rb
232
231
  - spec/spec_helper.rb
233
232
  - spec/utils_spec.rb
233
+ - tag-image.sh
234
234
  - test.sh
235
235
  homepage: https://github.com/conjurinc/debify
236
236
  licenses:
data/push-manifest.sh DELETED
@@ -1,14 +0,0 @@
1
- #!/bin/bash -ex
2
-
3
- for t in $(./image-tags); do
4
- docker pull "registry.tld/conjurinc/debify:$t-amd64"
5
- docker pull "registry.tld/conjurinc/debify:$t-arm64"
6
-
7
- docker manifest create \
8
- --insecure \
9
- "registry.tld/conjurinc/debify:$t" \
10
- --amend "registry.tld/conjurinc/debify:$t-amd64" \
11
- --amend "registry.tld/conjurinc/debify:$t-arm64"
12
-
13
- docker manifest push --insecure "registry.tld/conjurinc/debify:$t"
14
- done