Permalink
Browse files

Publish windows zip archive from ubuntu node

Signed-off-by: artem.ivanov <artem.ivanov@dsr-company.com>
  • Loading branch information...
Artemkaaas committed Jun 7, 2018
1 parent c1c7b90 commit 3443fdd2220d9232474d99333086970ff3e136cc
Showing with 47 additions and 45 deletions.
  1. +27 −30 Jenkinsfile.cd
  2. +18 −15 ci/win-zip-and-upload.sh
  3. +2 −0 libindy/ci/ubuntu.dockerfile
@@ -454,49 +454,46 @@ def ubuntuPublishing() {
def windowsPublishing() {
def libindyVersion
node('win2016') {
node('ubuntu') {
stage('Publish Libindy Windows Files') {
def ws_path = "workspace/${env.JOB_NAME}".replace(' ', '_')
ws(ws_path) {
try {
echo 'Publish Windows files: Checkout csm'
checkout scm
try {
echo 'Publish Windows files: Checkout csm'
checkout scm
libindyVersion = getSrcVersion("libindy")
libindyVersion = getSrcVersion("libindy")
dir('libindy') {
echo 'Publish Libindy Windows files'
windowsPublishArtifact("libindy", "lib", libindyVersion, "LibindyWindowsBuildResult")
}
echo 'Publish Windows files: Build docker image'
testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu.dockerfile libindy/ci')
dir('cli') {
echo 'Publish Indy Cli Windows files'
windowsPublishArtifact("indy-cli", "executable", libindyVersion, "IndyCliWindowsBuildResult")
}
echo 'Publish Libindy Windows files'
windowsPublishArtifact(testEnv, "libindy", "libindy", "lib", libindyVersion, "LibindyWindowsBuildResult")
dir('libnullpay') {
def libnullpayVersion = getSrcVersion("libnullpay")
echo 'Publish Indy Cli Windows files'
windowsPublishArtifact(testEnv, "cli", "indy-cli", "executable", libindyVersion, "IndyCliWindowsBuildResult")
echo 'Publish Libnullpay Cli Windows files'
windowsPublishArtifact("libnullpay", "lib", libnullpayVersion, "LibnullpayWindowsBuildResult")
}
}
finally {
echo 'Publish Windows files: Cleanup'
cleanWs()
}
def libnullpayVersion = getSrcVersion("libnullpay")
echo 'Publish Libnullpay Cli Windows files'
windowsPublishArtifact(testEnv, "libnullpay", "libnullpay", "lib", libnullpayVersion, "LibnullpayWindowsBuildResult")
}
finally {
echo 'Publish Windows files: Cleanup'
step([$class: 'WsCleanup'])
}
}
cleanWs()
}
return libindyVersion
}
def windowsPublishArtifact(packageName, packageType, packageVersion, stashName) {
unstash name: stashName
def windowsPublishArtifact(testEnv, folder, packageName, packageType, packageVersion, stashName) {
testEnv.inside {
sh 'chmod -R 777 ci'
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'repo_key')]) {
sh "../ci/win-zip-and-upload.sh $packageName $packageType $packageVersion '${repo_key}' ${env.BRANCH_NAME} $env.BUILD_NUMBER"
unstash name: stashName
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'repo_key')]) {
sh "ci/win-zip-and-upload.sh $folder $packageName $packageType $packageVersion '${repo_key}' master 1"
}
}
}
@@ -1,30 +1,32 @@
#!/bin/bash -xe
if [ "$1" = "--help" ] ; then
echo "Usage: <package> <package_type> <version> <key> <type> <number>"
echo "Usage: <folder> <package> <package_type> <version> <key> <type> <number>"
return
fi
package="$1"
package_type="$2"
version="$3"
key="$4"
type="$5"
number="$6"
folder="$1"
package="$2"
package_type="$3"
version="$4"
key="$5"
type="$6"
number="$7"
[ -z $package ] && exit 1
[ -z $package_type ] && exit 2
[ -z $version ] && exit 3
[ -z $key ] && exit 4
[ -z $type ] && exit 5
[ -z $number ] && exit 6
[ -z $folder ] && exit 1
[ -z $package ] && exit 2
[ -z $package_type ] && exit 3
[ -z $version ] && exit 4
[ -z $key ] && exit 5
[ -z $type ] && exit 6
[ -z $number ] && exit 7
TEMP_ARCH_DIR=./${package}-zip
mkdir ${TEMP_ARCH_DIR}
if [ ${package_type} = "lib" ] ; then
mkdir ${TEMP_ARCH_DIR}/lib
cp -r ./include ${TEMP_ARCH_DIR}
cp -r ${folder}/include ${TEMP_ARCH_DIR}
cp ./target/release/*.dll ${TEMP_ARCH_DIR}/lib/
elif [ ${package_type} = "executable" ] ; then
cp ./target/release/*.dll ${TEMP_ARCH_DIR}/
@@ -33,7 +35,8 @@ else
exit 2
fi
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('${TEMP_ARCH_DIR}', '${package}_${version}.zip'); }"
cd ${TEMP_ARCH_DIR} && zip -r ${package}_${version}.zip ./* && mv ${package}_${version}.zip .. && cd ..
rm -rf ${TEMP_ARCH_DIR}
cat <<EOF | sftp -v -oStrictHostKeyChecking=no -i $key repo@192.168.11.115
@@ -47,6 +47,8 @@ RUN apt-get update && apt-get install openjdk-8-jdk -y
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
RUN apt-get update && apt-get install -y maven
RUN apt-get install -y zip
RUN useradd -ms /bin/bash -u $uid indy
USER indy

0 comments on commit 3443fdd

Please sign in to comment.