Skip to content

Commit 41a748e

Browse files
authored
Merge pull request hyperledger-indy#847 from Artemkaaas/feature/publish-win-artifacts-from-ubuntu
Publish windows zip archive from ubuntu node
2 parents c1c7b90 + 3443fdd commit 41a748e

File tree

3 files changed

+47
-45
lines changed

3 files changed

+47
-45
lines changed

Jenkinsfile.cd

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -454,49 +454,46 @@ def ubuntuPublishing() {
454454

455455
def windowsPublishing() {
456456
def libindyVersion
457-
node('win2016') {
457+
node('ubuntu') {
458458
stage('Publish Libindy Windows Files') {
459-
def ws_path = "workspace/${env.JOB_NAME}".replace(' ', '_')
460-
ws(ws_path) {
461-
try {
462-
echo 'Publish Windows files: Checkout csm'
463-
checkout scm
459+
try {
460+
echo 'Publish Windows files: Checkout csm'
461+
checkout scm
464462

465-
libindyVersion = getSrcVersion("libindy")
463+
libindyVersion = getSrcVersion("libindy")
466464

467-
dir('libindy') {
468-
echo 'Publish Libindy Windows files'
469-
windowsPublishArtifact("libindy", "lib", libindyVersion, "LibindyWindowsBuildResult")
470-
}
465+
echo 'Publish Windows files: Build docker image'
466+
testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu.dockerfile libindy/ci')
471467

472-
dir('cli') {
473-
echo 'Publish Indy Cli Windows files'
474-
windowsPublishArtifact("indy-cli", "executable", libindyVersion, "IndyCliWindowsBuildResult")
475-
}
468+
echo 'Publish Libindy Windows files'
469+
windowsPublishArtifact(testEnv, "libindy", "libindy", "lib", libindyVersion, "LibindyWindowsBuildResult")
476470

477-
dir('libnullpay') {
478-
def libnullpayVersion = getSrcVersion("libnullpay")
471+
echo 'Publish Indy Cli Windows files'
472+
windowsPublishArtifact(testEnv, "cli", "indy-cli", "executable", libindyVersion, "IndyCliWindowsBuildResult")
479473

480-
echo 'Publish Libnullpay Cli Windows files'
481-
windowsPublishArtifact("libnullpay", "lib", libnullpayVersion, "LibnullpayWindowsBuildResult")
482-
}
483-
}
484-
finally {
485-
echo 'Publish Windows files: Cleanup'
486-
cleanWs()
487-
}
474+
def libnullpayVersion = getSrcVersion("libnullpay")
475+
476+
echo 'Publish Libnullpay Cli Windows files'
477+
windowsPublishArtifact(testEnv, "libnullpay", "libnullpay", "lib", libnullpayVersion, "LibnullpayWindowsBuildResult")
478+
}
479+
finally {
480+
echo 'Publish Windows files: Cleanup'
481+
step([$class: 'WsCleanup'])
488482
}
489483
}
490-
cleanWs()
491484
}
492485
return libindyVersion
493486
}
494487

495-
def windowsPublishArtifact(packageName, packageType, packageVersion, stashName) {
496-
unstash name: stashName
488+
def windowsPublishArtifact(testEnv, folder, packageName, packageType, packageVersion, stashName) {
489+
testEnv.inside {
490+
sh 'chmod -R 777 ci'
497491

498-
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'repo_key')]) {
499-
sh "../ci/win-zip-and-upload.sh $packageName $packageType $packageVersion '${repo_key}' ${env.BRANCH_NAME} $env.BUILD_NUMBER"
492+
unstash name: stashName
493+
494+
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'repo_key')]) {
495+
sh "ci/win-zip-and-upload.sh $folder $packageName $packageType $packageVersion '${repo_key}' master 1"
496+
}
500497
}
501498
}
502499

ci/win-zip-and-upload.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
#!/bin/bash -xe
22

33
if [ "$1" = "--help" ] ; then
4-
echo "Usage: <package> <package_type> <version> <key> <type> <number>"
4+
echo "Usage: <folder> <package> <package_type> <version> <key> <type> <number>"
55
return
66
fi
77

8-
package="$1"
9-
package_type="$2"
10-
version="$3"
11-
key="$4"
12-
type="$5"
13-
number="$6"
8+
folder="$1"
9+
package="$2"
10+
package_type="$3"
11+
version="$4"
12+
key="$5"
13+
type="$6"
14+
number="$7"
1415

15-
[ -z $package ] && exit 1
16-
[ -z $package_type ] && exit 2
17-
[ -z $version ] && exit 3
18-
[ -z $key ] && exit 4
19-
[ -z $type ] && exit 5
20-
[ -z $number ] && exit 6
16+
[ -z $folder ] && exit 1
17+
[ -z $package ] && exit 2
18+
[ -z $package_type ] && exit 3
19+
[ -z $version ] && exit 4
20+
[ -z $key ] && exit 5
21+
[ -z $type ] && exit 6
22+
[ -z $number ] && exit 7
2123

2224
TEMP_ARCH_DIR=./${package}-zip
2325
mkdir ${TEMP_ARCH_DIR}
2426

2527
if [ ${package_type} = "lib" ] ; then
2628
mkdir ${TEMP_ARCH_DIR}/lib
27-
cp -r ./include ${TEMP_ARCH_DIR}
29+
cp -r ${folder}/include ${TEMP_ARCH_DIR}
2830
cp ./target/release/*.dll ${TEMP_ARCH_DIR}/lib/
2931
elif [ ${package_type} = "executable" ] ; then
3032
cp ./target/release/*.dll ${TEMP_ARCH_DIR}/
@@ -33,7 +35,8 @@ else
3335
exit 2
3436
fi
3537

36-
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('${TEMP_ARCH_DIR}', '${package}_${version}.zip'); }"
38+
cd ${TEMP_ARCH_DIR} && zip -r ${package}_${version}.zip ./* && mv ${package}_${version}.zip .. && cd ..
39+
3740
rm -rf ${TEMP_ARCH_DIR}
3841

3942
cat <<EOF | sftp -v -oStrictHostKeyChecking=no -i $key [email protected]

libindy/ci/ubuntu.dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ RUN apt-get update && apt-get install openjdk-8-jdk -y
4747
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
4848
RUN apt-get update && apt-get install -y maven
4949

50+
RUN apt-get install -y zip
51+
5052
RUN useradd -ms /bin/bash -u $uid indy
5153
USER indy
5254

0 commit comments

Comments
 (0)