Reputation: 608
Inside a jenkins stage and steps, I am trying to build an image; run the container with a volume and then stash a file in order to unstash it after.
But unfortunately it doesn't create the volume and doesn't stash.
Here is the jenkins code
stage('Android') {
agent {
label buildLabel()
}
steps {
checkout scm
sh '''
mkdir -p `pwd`/build_target
docker build -t android_build -f docker/Dockerfile.android .
docker run --rm -v `pwd`/build_target:/home/gradle/reactapp/android/app/build/outputs/apk/ android_build
ls -la `pwd`/build_target/*
'''
stash includes: 'build_target/app-release.apk', name: 'apk'
androidApkUpload apkFilesPattern: '**/app-release.apk', googleCredentialsId: 'jenkins_apk_upload', trackName: 'internal'
}
}
Upvotes: 0
Views: 174
Reputation: 391
My solution would be configuring a ENV in Global properties on http://jenkins-server/configure.
In build script, I can use the env to get the shared path in the host.
And in all agent hosts, I mount the same NFS path to it.
mount -t nfs 10.6.188.1:/root /root/pacotest1
on every node
Upvotes: 1