#!/usr/bin/env groovy@Library('shared-...@1.1.0') _
pipeline { agent { kubernetes { label buildId() containerTemplate { name 'node' image 'node:8.9.4-alpine' ttyEnabled true command 'cat' } } } stages {
stage('Build') { steps { sh "echo npm run build" // stash build directory //stash includes: 'build/**', name: 'app' } }
stage('Unit Test') { steps { script { try { sh "echo npm run test" } catch (err) { println "Failed" //} finally { // junit 'build/reports/**/*.xml' } } } } stage('Package') { agent { node { label 'docker1' } } options { skipDefaultCheckout() } steps { sh "/bin/sleep 120" } } }}
[_location-service_PR-2-head-RP4JKIYE4QYJREC2YOQQGNKQG5UC56YLZET3VDC2IPW4C5FSH7EQ] Running shell script sh: can't create /home/jenkins/workspace/_location-service_PR-2-head-RP4JKIYE4QYJREC2YOQQGNKQG5UC56YLZET3VDC2IPW4C5FSH7EQ@tmp/durable-de461dce/jenkins-log.txt: nonexistent directory
Since the node I am accessing in that step is a container I thought maybe it was a permissions issue. However I validated this wasn't the case by making that agent (node { label 'docker1' }} the top level agent and the pipeline runs fine.
So my thought is that during the switch between agents/nodes it is expecting that directory to exist (it does create the workspace directory though, just not durable).
Any help would be appreciated.
Thanks
#!/usr/bin/env groovy@Library('shared-...@1.1.0') _
pipeline {
agent none stages {
stage('Build') {
agent { kubernetes { label buildId() containerTemplate { name 'node' image 'node:8.9.4-alpine' ttyEnabled true command 'cat' } } }
steps { sh "echo npm run build"
sh "/bin/sleep 120"
// stash build directory //stash includes: 'build/**', name: 'app' } }