Skip to content
This repository was archived by the owner on Jul 31, 2019. It is now read-only.

Commit 8652107

Browse files
hadleymglowkey
authored and
glowkey
committed
Add Verbosity to Jenkinsfile and upload NPM Artifact to Filely (#316)
* Enables profile.release tag on Cargo.toml * Enables debian Building for PR Testing * Reorders Jenkinsfile properly * Adds More Verbosity to Jenkins Stages * Removes Default --no-cache Behavior in Jenkinsfile for All Images * Cleans up Jenkinsfile * Moves Messages outside of Function Calls in Jenkinsfile * Uploads tgz to Filely
1 parent 1263faa commit 8652107

File tree

1 file changed

+87
-84
lines changed

1 file changed

+87
-84
lines changed

vcx/ci/Jenkinsfile

+87-84
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,62 @@ node('ubuntu') {
2020
}
2121

2222
// update the versions in the toml file and package.json
23-
updateVersions(rust)
23+
stage('Updating Versions') {
24+
updateVersions(rust)
25+
}
2426

2527
// build and test the so file
26-
buildRust(rust)
28+
stage ('Building Libvcx.so'){
29+
buildRust(rust)
30+
}
2731

2832
// test rust
29-
testRust(rust)
33+
stage ('Testing Rust'){
34+
testRust(rust)
35+
}
3036

3137
// update the so file to have version
32-
updateSo(rust)
38+
stage('Updating .so file version') {
39+
updateSo(rust)
40+
}
3341

3442
// image used as an intermediary, where the libvcx.so is placed into /usr/lib.
3543
// This image must be built after the rust build and tests have been run.
3644
stage ('Build Libindy Image') {
3745
libindy = build('libindy', 'vcx/ci/Dockerfile-libindy', 'vcx')
3846
}
3947
// test python wrapper, the image must be built after the libindy image build, and must be --no-cache
40-
stage (' Build Python and Node Images') {
48+
stage ('Build Python Image') {
4149
vcx_python = build('vcx-python', 'vcx/wrappers/python3/ci/Dockerfile-python-wrapper', 'vcx', '--no-cache')
4250
}
43-
testPythonWrapper(vcx_python)
51+
52+
stage ("Testing Python Wrapper"){
53+
testPythonWrapper(vcx_python)
54+
}
4455

4556
// test nodejs wrapper, the image must be built after the libindy image build, and must be --no-cache
46-
stage (' Build NodeJs Images') {
57+
stage ('Build NodeJs Images') {
4758
nodejs = build('nodejs', 'vcx/wrappers/node/ci/Dockerfile-nodejs', 'vcx')
4859
vcx_nodejs = build('vcx-nodejs', 'vcx/wrappers/node/ci/Dockerfile-nodejs-wrapper', 'vcx', '--no-cache')
4960
}
50-
testNodeWrapper(vcx_nodejs)
61+
62+
stage ('Test Node Wrapper'){
63+
testNodeWrapper(vcx_nodejs)
64+
}
5165

5266
if (env.BRANCH_NAME == "master") {
5367
// create the debian of the library (just the libvcx.so file)
54-
createDeb(rust)
68+
stage('Build libvcx Debian and compress .so file') {
69+
createDeb(rust)
70+
}
5571

5672
// create the npm deb
5773
createNpmDeb(rust)
5874

5975
// create pip installable artifact
60-
createPtyhonArtifact(vcx_python, getVcxVersion(vcx_python))
76+
stage ('Building Python Artifact') {
77+
createPtyhonArtifact(vcx_python, getVcxVersion(vcx_python))
78+
}
6179
}
6280

6381
} catch (Exception ex) {
@@ -87,120 +105,104 @@ def getVcxVersion(envn){
87105
}
88106

89107
def testPythonWrapper(envn){
90-
stage ("Testing Python Wrapper"){
91-
envn.inside {
92-
sh "python3 -m pytest"
93-
}
108+
envn.inside {
109+
sh "python3 -m pytest"
94110
}
111+
95112
}
96113

97-
def buildRust(envn){
98-
stage ('Building Rust Library'){
99-
envn.inside {
100-
sh "rustc --version"
101-
sh "gcc --version"
102-
sh "cd vcx/libvcx; cargo build --features ci --color=never"
103-
}
114+
def buildRust(envn){
115+
envn.inside {
116+
sh "rustc --version"
117+
sh "gcc --version"
118+
sh "cd vcx/libvcx; cargo build --features ci --color=never"
104119
}
105120
}
106121

107122
def testRust(envn) {
108-
stage ('Testing Rust'){
109-
sh "echo Testing"
110-
envn.inside {
111-
sh "cd vcx/libvcx; cargo test --color=never -- --test-threads=1"
112-
}
123+
envn.inside {
124+
sh "cd vcx/libvcx; cargo test --color=never -- --test-threads=1"
113125
}
114126
}
115127

116128
// Creates a tar.gz file that is installable from pip.
117129
def createPtyhonArtifact(envn, version) {
118-
stage ('Building Python Artifact') {
119-
dir('vcx/wrappers/python3'){
120-
sh 'echo Building Python Artifact'
121-
withEnv(["VCX_VERSION=${version}"]) {
122-
envn.inside {
123-
sh(
124-
script: "python3 setup.py sdist",
125-
returnStdout: true
126-
)
127-
archiveArtifacts allowEmptyArchive: true, artifacts: 'dist/**/*.tar.gz'
128-
}
130+
dir('vcx/wrappers/python3'){
131+
sh 'echo Building Python Artifact'
132+
withEnv(["VCX_VERSION=${version}"]) {
133+
envn.inside {
134+
sh(
135+
script: "python3 setup.py sdist",
136+
returnStdout: true
137+
)
138+
archiveArtifacts allowEmptyArchive: true, artifacts: 'dist/**/*.tar.gz'
129139
}
130140
}
131141
}
132142
}
133143

134144
// Update the version and revision in the Cargo.toml file, also the so file .
135145
def updateVersions(app) {
136-
stage('Updating Versions') {
137-
app.inside {
138-
sh 'ls -l'
139-
// TODO fix this ... these *SHOULD* be cargo commands.
140-
sh 'cd vcx/libvcx; ls -l; ls ../ci/scripts'
141-
sh 'cd vcx/libvcx; python ../ci/scripts/cargo-update-version'
146+
app.inside {
147+
sh 'ls -l'
148+
// TODO fix this ... these *SHOULD* be cargo commands.
149+
sh 'cd vcx/libvcx; ls -l; ls ../ci/scripts'
150+
sh 'cd vcx/libvcx; python ../ci/scripts/cargo-update-version'
142151

143-
}
144-
}
152+
}
145153
}
146154

147155
// Updates the libvcx.so file to libvcx<VER>.so
148156
def updateSo(app) {
149-
stage('Updating .so file version') {
150-
app.inside {
151-
sh 'cd vcx/libvcx; python ../ci/scripts/cargo-update-so'
152-
}
157+
app.inside {
158+
sh 'cd vcx/libvcx; python ../ci/scripts/cargo-update-so'
153159
}
154160
}
155161

156162
// Creates the debian package for the library, as well as gzips the libvcx.so.<version> file
157163
// Publishes both artifacts.
158164
def createDeb(envn) {
159-
stage('Build libvcx Debian and compress .so file') {
160-
envn.inside {
161-
CERT_SCRIPT = 'vcx/ci/scripts/getCert.sh'
162-
SCRIPT = 'vcx/ci/scripts/gzip_so_file.py'
163-
FILES = 'vcx/libvcx/target/debug/libvcx.so.* vcx/libvcx/scripts/provision_agent_keys.py'
164-
DEST = 'libvcx.tar.gz'
165-
166-
// get Evernym Certificate onto machine
167-
sh "${CERT_SCRIPT}"
168-
169-
// build debian
170-
sh 'cd vcx/libvcx/; cargo deb --no-build'
171-
165+
envn.inside {
166+
CERT_SCRIPT = 'vcx/ci/scripts/getCert.sh'
167+
SCRIPT = 'vcx/ci/scripts/gzip_so_file.py'
168+
FILES = 'vcx/libvcx/target/debug/libvcx.so.* vcx/libvcx/scripts/provision_agent_keys.py'
169+
DEST = 'libvcx.tar.gz'
172170

173-
if (env.BRANCH_NAME == "master") {
174-
// archive debian to Jenkins
175-
archiveArtifacts allowEmptyARchive: true, artifacts: "vcx/libvcx/target/debian/libvcx_*_amd64.deb"
171+
// get Evernym Certificate onto machine
172+
sh "${CERT_SCRIPT}"
173+
174+
// build debian
175+
sh 'cd vcx/libvcx/; cargo deb --no-build'
176176

177-
// archive .so file to Jenkins
178-
sh "python ${SCRIPT} ${FILES} ${DEST}"
179-
archiveArtifacts allowEmptyARchive: true, artifacts: DEST
180177

181-
// upload debian to Repo
182-
withCredentials([usernameColonPassword(credentialsId: 'jenkins-kraken-svc', variable: 'KRAKEN_CREDENTIALS')]) {
183-
sh "find vcx/libvcx/target/debian/ -type f -name 'libvcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/agency_dev/upload -F file=@{} \\;"
184-
sh "find vcx/libvcx/target/debian/ -type f -name 'libvcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/portal_dev/upload -F file=@{} \\;"
185-
}
178+
if (env.BRANCH_NAME == "master") {
179+
// archive debian to Jenkins
180+
archiveArtifacts allowEmptyARchive: true, artifacts: "vcx/libvcx/target/debian/libvcx_*_amd64.deb"
181+
182+
// archive .so file to Jenkins
183+
sh "python ${SCRIPT} ${FILES} ${DEST}"
184+
archiveArtifacts allowEmptyARchive: true, artifacts: DEST
185+
186+
// upload debian to Repo
187+
withCredentials([usernameColonPassword(credentialsId: 'jenkins-kraken-svc', variable: 'KRAKEN_CREDENTIALS')]) {
188+
sh "find vcx/libvcx/target/debian/ -type f -name 'libvcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/agency_dev/upload -F file=@{} \\;"
189+
sh "find vcx/libvcx/target/debian/ -type f -name 'libvcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/portal_dev/upload -F file=@{} \\;"
186190
}
187191
}
188192
}
189193
}
190194

191195
// Creates the tgz file that can be 'npm install'-ed.
192196
def testNodeWrapper(envn) {
193-
stage ('Test Node Wrapper'){
194-
dir('vcx/wrappers/node'){
195-
envn.inside() {
196-
sh 'npm install'
197-
sh 'npm -v'
198-
sh 'npm run lint'
199-
sh 'npm run compile'
200-
sh 'npm test'
201-
sh 'npm pack'
202-
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.tgz'
203-
}
197+
dir('vcx/wrappers/node'){
198+
envn.inside() {
199+
sh 'npm install'
200+
sh 'npm -v'
201+
sh 'npm run lint'
202+
sh 'npm run compile'
203+
sh 'npm test'
204+
sh 'npm pack'
205+
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.tgz'
204206
}
205207
}
206208
}
@@ -219,6 +221,7 @@ def createNpmDeb(app){
219221
// upload npm module
220222
sh "find wrappers/node/ -type f -name 'vcx-*.tgz' -exec curl --cacert /tmp/cert/ca.crt -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/agency_dev/upload -F file=@{} \\;"
221223
sh "find wrappers/node/ -type f -name 'vcx-*.tgz' -exec curl --cacert /tmp/cert/ca.crt -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/portal_dev/upload -F file=@{} \\;"
224+
sh "find wrappers/node/ -type f -name 'vcx-*.tgz' -exec curl --cacert /tmp/cert/ca.crt -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/npm/upload -F file = @{} \\;"
222225

223226
// upload debian
224227
sh "find . -type f -name 'vcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \"${KRAKEN_CREDENTIALS}\" -X POST https://kraken.corp.evernym.com/repo/agency_dev/upload -F file=@{} \\;"

0 commit comments

Comments
 (0)