conjur-debify 3.0.3.pre.248 → 3.0.3.pre.1914
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/CHANGELOG.md +2 -9
- data/Dockerfile +2 -2
- data/Jenkinsfile +31 -165
- data/README.md +1 -1
- data/VERSION +1 -1
- data/distrib/secrets.yml +0 -2
- data/features/package.feature +7 -7
- data/image-tags +1 -4
- data/lib/conjur/debify/action/publish.rb +34 -53
- data/lib/conjur/debify.rb +315 -328
- data/push-image.sh +2 -8
- data/tag-image.sh +6 -0
- metadata +4 -5
- data/kics.config +0 -10
- data/push-manifest.sh +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b361743dc7723ab21f23aa6b3192161d8a4ef64f175654db610f3a0c30390486
|
|
4
|
+
data.tar.gz: 70d7d42091e3a99882af0a649e36188eda5f1da138c149ae718978675b119bff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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/Dockerfile
CHANGED
|
@@ -2,7 +2,7 @@ FROM ruby:3.2
|
|
|
2
2
|
|
|
3
3
|
RUN apt-get update -qq && \
|
|
4
4
|
apt-get upgrade -qqy && \
|
|
5
|
-
apt-get install
|
|
5
|
+
apt-get install -qqy \
|
|
6
6
|
apt-transport-https \
|
|
7
7
|
ca-certificates \
|
|
8
8
|
curl && \
|
|
@@ -10,7 +10,7 @@ RUN apt-get update -qq && \
|
|
|
10
10
|
rm -rf /var/lib/apt/lists/*
|
|
11
11
|
|
|
12
12
|
# Install Docker client tools
|
|
13
|
-
ENV DOCKERVERSION=
|
|
13
|
+
ENV DOCKERVERSION=24.0.2
|
|
14
14
|
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
|
|
15
15
|
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
|
|
16
16
|
-C /usr/local/bin docker/docker \
|
data/Jenkinsfile
CHANGED
|
@@ -1,66 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env groovy
|
|
2
2
|
|
|
3
|
-
@Library("product-pipelines-shared-library") _
|
|
4
|
-
|
|
5
|
-
def productName = 'Debify'
|
|
6
|
-
def productTypeName = 'Conjur Internal'
|
|
7
|
-
|
|
8
3
|
// Automated release, promotion and dependencies
|
|
9
4
|
properties([
|
|
10
|
-
// Include the automated release parameters for the build
|
|
11
5
|
release.addParams(),
|
|
12
|
-
|
|
13
|
-
dependencies([])
|
|
6
|
+
dependencies(['cyberark/conjur-base-image'])
|
|
14
7
|
])
|
|
15
8
|
|
|
16
|
-
// Performs release promotion. No other stages will be run
|
|
17
9
|
if (params.MODE == "PROMOTE") {
|
|
18
|
-
release.promote(params.VERSION_TO_PROMOTE) {
|
|
19
|
-
|
|
20
|
-
// Any version number updates from sourceVersion to targetVersion occur here
|
|
21
|
-
// Any publishing of targetVersion artifacts occur here
|
|
22
|
-
// Anything added to assetDirectory will be attached to the Github Release
|
|
23
|
-
|
|
24
|
-
env.INFRAPOOL_PRODUCT_NAME = "${productName}"
|
|
25
|
-
env.INFRAPOOL_DD_PRODUCT_TYPE_NAME = "${productTypeName}"
|
|
26
|
-
|
|
27
|
-
def scans = [:]
|
|
28
|
-
|
|
29
|
-
scans["AMD64"] = {
|
|
30
|
-
stage("Scan Docker image (AMD64 based)") {
|
|
31
|
-
runSecurityScans(infrapool,
|
|
32
|
-
image: "registry.tld/conjurinc/debify:${sourceVersion}-amd64",
|
|
33
|
-
buildMode: params.MODE,
|
|
34
|
-
branch: env.BRANCH_NAME,
|
|
35
|
-
architecure: 'linux/amd64')
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
scans["ARM64"] = {
|
|
40
|
-
stage("Scan Docker image (ARM64 based)") {
|
|
41
|
-
runSecurityScans(infrapool,
|
|
42
|
-
image: "registry.tld/conjurinc/debify:${sourceVersion}-arm64",
|
|
43
|
-
buildMode: params.MODE,
|
|
44
|
-
branch: env.BRANCH_NAME,
|
|
45
|
-
architecure: 'linux/arm64')
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
parallel(scans)
|
|
50
|
-
|
|
51
|
-
//Note: assetDirectory is on the infrapool agent, not the local Jenkins agent.
|
|
52
|
-
infrapool.agentSh './publish-rubygem.sh'
|
|
10
|
+
release.promote(params.VERSION_TO_PROMOTE) { sourceVersion, targetVersion, assetDirectory ->
|
|
11
|
+
sh './publish-rubygem.sh'
|
|
53
12
|
}
|
|
54
|
-
release.copyEnterpriseRelease(params.VERSION_TO_PROMOTE)
|
|
55
13
|
return
|
|
56
14
|
}
|
|
57
15
|
|
|
58
16
|
pipeline {
|
|
59
|
-
agent { label '
|
|
17
|
+
agent { label 'executor-v2' }
|
|
60
18
|
|
|
61
19
|
options {
|
|
62
20
|
timestamps()
|
|
63
|
-
buildDiscarder(logRotator(
|
|
21
|
+
buildDiscarder(logRotator(daysToKeepStr: '30'))
|
|
64
22
|
}
|
|
65
23
|
|
|
66
24
|
triggers {
|
|
@@ -68,16 +26,10 @@ pipeline {
|
|
|
68
26
|
}
|
|
69
27
|
|
|
70
28
|
environment {
|
|
71
|
-
// Sets the MODE to the specified or autocalculated value as appropriate
|
|
72
29
|
MODE = release.canonicalizeMode()
|
|
73
|
-
|
|
74
|
-
// Values to direct scan results to the right place in DefectDojo
|
|
75
|
-
INFRAPOOL_PRODUCT_NAME = "${productName}"
|
|
76
|
-
INFRAPOOL_DD_PRODUCT_TYPE_NAME = "${productTypeName}"
|
|
77
30
|
}
|
|
78
31
|
|
|
79
32
|
stages {
|
|
80
|
-
// Aborts any builds triggered by another project that wouldn't include any changes
|
|
81
33
|
stage ("Skip build if triggering job didn't create a release") {
|
|
82
34
|
when {
|
|
83
35
|
expression {
|
|
@@ -91,109 +43,34 @@ pipeline {
|
|
|
91
43
|
}
|
|
92
44
|
}
|
|
93
45
|
}
|
|
94
|
-
|
|
95
|
-
stage('Get InfraPool ExecutorV2 Agent(s)') {
|
|
96
|
-
steps {
|
|
97
|
-
script {
|
|
98
|
-
// Request ExecutorV2 agents for 1 hour(s)
|
|
99
|
-
INFRAPOOL_EXECUTORV2_AGENT_0 = getInfraPoolAgent.connected(type: "ExecutorV2", quantity: 1, duration: 1)[0]
|
|
100
|
-
INFRAPOOL_EXECUTORV2ARM_AGENT_0 = getInfraPoolAgent.connected(type: "ExecutorV2ARM", quantity: 1, duration: 1)[0]
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
46
|
stage('Prepare') {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// Initialize VERSION file
|
|
110
|
-
updateVersion(INFRAPOOL_EXECUTORV2_AGENT_0, "CHANGELOG.md", "${BUILD_NUMBER}")
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
stage('Prepare ARM64') {
|
|
115
|
-
steps {
|
|
116
|
-
// Initialize VERSION file
|
|
117
|
-
updateVersion(INFRAPOOL_EXECUTORV2ARM_AGENT_0, "CHANGELOG.md", "${BUILD_NUMBER}")
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
stage('Build Docker image') {
|
|
124
|
-
parallel {
|
|
125
|
-
stage('Build AMD64 image') {
|
|
126
|
-
steps {
|
|
127
|
-
script {
|
|
128
|
-
INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './build.sh'
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
stage('Build ARM64 image') {
|
|
134
|
-
steps {
|
|
135
|
-
script {
|
|
136
|
-
INFRAPOOL_EXECUTORV2ARM_AGENT_0.agentSh './build.sh'
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
stage('Push Docker image') {
|
|
143
|
-
parallel {
|
|
144
|
-
stage('Push AMD64 image') {
|
|
145
|
-
steps {
|
|
146
|
-
script {
|
|
147
|
-
INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './push-image.sh amd64'
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
stage('Push ARM64 image') {
|
|
153
|
-
steps {
|
|
154
|
-
script {
|
|
155
|
-
INFRAPOOL_EXECUTORV2ARM_AGENT_0.agentSh './push-image.sh arm64'
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
47
|
+
steps {
|
|
48
|
+
// Initialize VERSION file
|
|
49
|
+
updateVersion("CHANGELOG.md", "${BUILD_NUMBER}")
|
|
159
50
|
}
|
|
160
51
|
}
|
|
161
|
-
|
|
162
|
-
stage('Push Docker manifest with multi-arch') {
|
|
52
|
+
stage('Build docker image') {
|
|
163
53
|
steps {
|
|
164
|
-
|
|
165
|
-
INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './push-manifest.sh'
|
|
166
|
-
}
|
|
54
|
+
sh './build.sh'
|
|
167
55
|
}
|
|
168
56
|
}
|
|
57
|
+
|
|
169
58
|
stage('Scan Docker image') {
|
|
170
59
|
parallel {
|
|
171
|
-
stage('Scan Docker image
|
|
60
|
+
stage('Scan Docker image for fixable issues') {
|
|
172
61
|
steps{
|
|
173
62
|
script {
|
|
174
|
-
|
|
175
|
-
VERSION = INFRAPOOL_EXECUTORV2_AGENT_0.agentSh(returnStdout: true, script: './image-tags | cut -d" " -f1')
|
|
63
|
+
VERSION = sh(returnStdout: true, script: 'cat VERSION')
|
|
176
64
|
}
|
|
177
|
-
|
|
178
|
-
image: "registry.tld/conjurinc/debify:${VERSION}",
|
|
179
|
-
buildMode: MODE,
|
|
180
|
-
branch: env.BRANCH_NAME,
|
|
181
|
-
arch: "linux/amd64"
|
|
182
|
-
)
|
|
65
|
+
scanAndReport("debify:${VERSION}", "HIGH", false)
|
|
183
66
|
}
|
|
184
67
|
}
|
|
185
|
-
stage('Scan Docker image
|
|
68
|
+
stage('Scan Docker image for all issues') {
|
|
186
69
|
steps{
|
|
187
70
|
script {
|
|
188
|
-
|
|
189
|
-
VERSION = INFRAPOOL_EXECUTORV2ARM_AGENT_0.agentSh(returnStdout: true, script: './image-tags | cut -d" " -f1')
|
|
71
|
+
VERSION = sh(returnStdout: true, script: 'cat VERSION')
|
|
190
72
|
}
|
|
191
|
-
|
|
192
|
-
image: "registry.tld/conjurinc/debify:${VERSION}",
|
|
193
|
-
buildMode: MODE,
|
|
194
|
-
branch: env.BRANCH_NAME,
|
|
195
|
-
arch: "linux/arm64"
|
|
196
|
-
)
|
|
73
|
+
scanAndReport("debify:${VERSION}", "NONE", true)
|
|
197
74
|
}
|
|
198
75
|
}
|
|
199
76
|
}
|
|
@@ -201,18 +78,21 @@ pipeline {
|
|
|
201
78
|
|
|
202
79
|
stage('Run feature tests') {
|
|
203
80
|
steps {
|
|
204
|
-
|
|
205
|
-
INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './test.sh'
|
|
206
|
-
INFRAPOOL_EXECUTORV2_AGENT_0.agentStash name: 'test-results', includes: 'features/reports/*.xml'
|
|
207
|
-
}
|
|
81
|
+
sh './test.sh'
|
|
208
82
|
}
|
|
209
83
|
post { always {
|
|
210
|
-
unstash 'test-results'
|
|
211
84
|
junit 'features/reports/*.xml'
|
|
212
85
|
}}
|
|
213
86
|
}
|
|
214
87
|
|
|
215
|
-
stage('
|
|
88
|
+
stage('Push Docker image') {
|
|
89
|
+
steps {
|
|
90
|
+
sh './tag-image.sh'
|
|
91
|
+
sh './push-image.sh'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
stage('Publish to RubyGems') {
|
|
216
96
|
when {
|
|
217
97
|
expression {
|
|
218
98
|
MODE == "RELEASE"
|
|
@@ -220,31 +100,17 @@ pipeline {
|
|
|
220
100
|
}
|
|
221
101
|
|
|
222
102
|
steps {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
Copy any artifacts to assetDirectory on the infrapool node
|
|
227
|
-
to attach them to the Github release.
|
|
228
|
-
|
|
229
|
-
If your assets are on the infrapool node in the target
|
|
230
|
-
directory, use a copy like this:
|
|
231
|
-
infrapool.agentSh "cp target/* ${assetDirectory}"
|
|
232
|
-
Note That this will fail if there are no assets, add :||
|
|
233
|
-
if you want the release to succeed with no assets.
|
|
234
|
-
|
|
235
|
-
If your assets are in target on the main Jenkins agent, use:
|
|
236
|
-
infrapool.agentPut(from: 'target/', to: assetDirectory)
|
|
237
|
-
*/
|
|
238
|
-
INFRAPOOL_EXECUTORV2_AGENT_0.agentSh './publish-rubygem.sh'
|
|
239
|
-
INFRAPOOL_EXECUTORV2_AGENT_0.agentSh "cp conjur-debify-*.gem release-assets/."
|
|
240
|
-
}
|
|
103
|
+
release {
|
|
104
|
+
sh './publish-rubygem.sh'
|
|
105
|
+
sh "cp conjur-debify-*.gem release-assets/."
|
|
241
106
|
}
|
|
242
107
|
}
|
|
243
108
|
}
|
|
244
109
|
}
|
|
110
|
+
|
|
245
111
|
post {
|
|
246
112
|
always {
|
|
247
|
-
|
|
113
|
+
cleanupAndNotify(currentBuild.currentResult)
|
|
248
114
|
}
|
|
249
115
|
}
|
|
250
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/
|
|
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-
|
|
1
|
+
3.0.3-1914
|
data/distrib/secrets.yml
CHANGED
data/features/package.feature
CHANGED
|
@@ -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
|
|
12
|
-
And the
|
|
13
|
-
And the
|
|
14
|
-
And the
|
|
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
|
|
19
|
-
Then
|
|
20
|
-
And
|
|
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
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
module Conjur::Debify
|
|
2
2
|
module Action
|
|
3
3
|
class Publish
|
|
4
|
+
|
|
4
5
|
def detect_component
|
|
5
6
|
branch = ENV['GIT_BRANCH'] || ENV['BRANCH_NAME'] || `git rev-parse --abbrev-ref HEAD`.strip
|
|
6
|
-
if %w
|
|
7
|
+
if %w(master origin/master).include?(branch)
|
|
7
8
|
'stable'
|
|
8
9
|
else
|
|
9
10
|
branch.gsub('/', '.')
|
|
@@ -11,7 +12,6 @@ module Conjur::Debify
|
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
attr_reader :distribution, :project_name, :cmd_options
|
|
14
|
-
|
|
15
15
|
def initialize(distribution, project_name, cmd_options)
|
|
16
16
|
@distribution = distribution
|
|
17
17
|
@project_name = project_name
|
|
@@ -34,59 +34,44 @@ module Conjur::Debify
|
|
|
34
34
|
|
|
35
35
|
art_user = ENV['ARTIFACTORY_USER']
|
|
36
36
|
art_password = ENV['ARTIFACTORY_PASSWORD']
|
|
37
|
-
|
|
37
|
+
unless art_user && art_password
|
|
38
|
+
art_user, art_password = fetch_art_creds
|
|
39
|
+
end
|
|
38
40
|
|
|
39
|
-
# Publish
|
|
41
|
+
# Publish deb package
|
|
40
42
|
component = cmd_options[:component] || detect_component
|
|
41
43
|
deb_info = "#{distribution}/#{component}/amd64"
|
|
42
44
|
package_name = "conjur-#{project_name}_#{version}_amd64.deb"
|
|
43
45
|
publish_package(
|
|
44
|
-
publish_image
|
|
45
|
-
art_url
|
|
46
|
-
art_user
|
|
47
|
-
art_password
|
|
46
|
+
publish_image: publish_image,
|
|
47
|
+
art_url: art_url,
|
|
48
|
+
art_user: art_user,
|
|
49
|
+
art_password: art_password,
|
|
48
50
|
art_repo: deb_art_repo,
|
|
49
|
-
package_name
|
|
50
|
-
dir
|
|
51
|
-
deb_info:
|
|
51
|
+
package_name: package_name,
|
|
52
|
+
dir: dir,
|
|
53
|
+
deb_info: deb_info
|
|
52
54
|
)
|
|
53
55
|
|
|
54
|
-
# (Optional) Publish ARM64 deb package
|
|
55
|
-
unless Dir.glob('*_arm64.deb').empty?
|
|
56
|
-
deb_info = "#{distribution}/#{component}/arm64"
|
|
57
|
-
package_name = "conjur-#{project_name}_#{version}_arm64.deb"
|
|
58
|
-
publish_package(
|
|
59
|
-
publish_image:,
|
|
60
|
-
art_url:,
|
|
61
|
-
art_user:,
|
|
62
|
-
art_password:,
|
|
63
|
-
art_repo: deb_art_repo,
|
|
64
|
-
package_name:,
|
|
65
|
-
dir:,
|
|
66
|
-
deb_info:
|
|
67
|
-
)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
56
|
# Publish RPM package
|
|
71
57
|
# The rpm builder replaces dashes with underscores in the version
|
|
72
58
|
rpm_version = version.tr('-', '_')
|
|
73
|
-
package_name = "conjur-#{project_name}-#{rpm_version}-1
|
|
59
|
+
package_name = "conjur-#{project_name}-#{rpm_version}-1.x86_64.rpm"
|
|
74
60
|
rpm_art_repo = cmd_options['rpm-repo']
|
|
75
61
|
publish_package(
|
|
76
|
-
publish_image
|
|
77
|
-
art_url
|
|
78
|
-
art_user
|
|
79
|
-
art_password
|
|
62
|
+
publish_image: publish_image,
|
|
63
|
+
art_url: art_url,
|
|
64
|
+
art_user: art_user,
|
|
65
|
+
art_password: art_password,
|
|
80
66
|
art_repo: rpm_art_repo,
|
|
81
|
-
package_name
|
|
82
|
-
dir:
|
|
67
|
+
package_name: package_name,
|
|
68
|
+
dir: dir
|
|
83
69
|
)
|
|
84
70
|
end
|
|
85
71
|
end
|
|
86
72
|
|
|
87
73
|
def create_image
|
|
88
|
-
Docker::Image.build_from_dir File.expand_path('../../publish', File.dirname(__FILE__)), tag:
|
|
89
|
-
&DebugMixin::DOCKER
|
|
74
|
+
Docker::Image.build_from_dir File.expand_path('../../publish', File.dirname(__FILE__)), tag: "debify-publish", &DebugMixin::DOCKER
|
|
90
75
|
end
|
|
91
76
|
|
|
92
77
|
def fetch_art_creds
|
|
@@ -97,8 +82,8 @@ module Conjur::Debify
|
|
|
97
82
|
conjur = Conjur::Authn.connect nil, noask: true
|
|
98
83
|
|
|
99
84
|
account = Conjur.configuration.account
|
|
100
|
-
username_var = [account,
|
|
101
|
-
password_var = [account,
|
|
85
|
+
username_var = [account, "variable", "ci/artifactory/users/jenkins/username"].join(':')
|
|
86
|
+
password_var = [account, "variable", 'ci/artifactory/users/jenkins/password'].join(':')
|
|
102
87
|
[conjur.resource(username_var).value, conjur.resource(password_var).value]
|
|
103
88
|
end
|
|
104
89
|
|
|
@@ -114,24 +99,21 @@ module Conjur::Debify
|
|
|
114
99
|
)
|
|
115
100
|
|
|
116
101
|
cmd_args = [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
102
|
+
"jfrog", "rt", "upload",
|
|
103
|
+
"--url", art_url,
|
|
104
|
+
"--user", art_user,
|
|
105
|
+
"--password", art_password,
|
|
121
106
|
]
|
|
122
107
|
|
|
123
|
-
cmd_args += [
|
|
108
|
+
cmd_args += ["--deb", deb_info] if deb_info
|
|
124
109
|
cmd_args += [package_name, "#{art_repo}/"]
|
|
125
110
|
|
|
126
111
|
options = {
|
|
127
112
|
'Image' => publish_image.id,
|
|
128
113
|
'Cmd' => cmd_args,
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
|
|
132
|
-
]
|
|
133
|
-
},
|
|
134
|
-
'WorkingDir' => '/src'
|
|
114
|
+
'Binds' => [
|
|
115
|
+
[ dir, "/src" ].join(':')
|
|
116
|
+
]
|
|
135
117
|
}
|
|
136
118
|
options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
|
|
137
119
|
|
|
@@ -141,15 +123,14 @@ module Conjur::Debify
|
|
|
141
123
|
def publish(options)
|
|
142
124
|
container = Docker::Container.create(options)
|
|
143
125
|
begin
|
|
144
|
-
container.tap(&:start!).streaming_logs(follow: true, stdout: true, stderr: true)
|
|
145
|
-
puts "#{chunk}"
|
|
146
|
-
end
|
|
126
|
+
container.tap(&:start!).streaming_logs(follow: true, stdout: true, stderr: true) { |stream, chunk| puts "#{chunk}" }
|
|
147
127
|
status = container.wait
|
|
148
|
-
raise
|
|
128
|
+
raise "Failed to publish package" unless status['StatusCode'] == 0
|
|
149
129
|
ensure
|
|
150
130
|
container.delete(force: true)
|
|
151
131
|
end
|
|
152
132
|
end
|
|
133
|
+
|
|
153
134
|
end
|
|
154
135
|
end
|
|
155
136
|
end
|