-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 2.73.2 docker image (extended to include a few extra required tools installed via apt), running on a Kubernetes cluster using sibling containers.
We are using declarative pipelines and one of the steps uses the Dockerfile agent and mounts the workspace as a volume inside the container and then runs a simple test to make sure a file exists. Frequently the step fails despite it clearly exiting with a 0. This test was originally put in place because later in our pipeline we were getting strange build fails and I needed to verify the volume was correctly mounted by the Dockerfile agent. It is strange it regularly (and randomly) fails despite clearly succeeding.
stage('Dockerfile volume test') { agent { dockerfile { dir 'docker/web_base' args '-v $WORKSPACE:/var/www' } } steps { echo 'Testing volume is mounted' sh ''' if [ -f /var/www/readme.MD ]; then echo "Volume mounted" exit 0 else echo "Error volume not mounted" exit 1 fi ''' } }
Here is some sanitised console output from the relevant stage:
Jenkins does not seem to be running inside a container $ docker run -t -d -u 1000:1000 -v $WORKSPACE:/var/www -w /var/jenkins_home/workspace/****_feature_****-XQI4C6XJ4O5UMBXPFXK73HT2RDSRQFVROIGJ25NECTJ73F7HNLVQ@2 -v /var/jenkins_home/workspace/****_feature_****-XQI4C6XJ4O5UMBXPFXK73HT2RDSRQFVROIGJ25NECTJ73F7HNLVQ@2:/var/jenkins_home/workspace/****_feature_****-XQI4C6XJ4O5UMBXPFXK73HT2RDSRQFVROIGJ25NECTJ73F7HNLVQ@2:rw,z -v /var/jenkins_home/workspace/****_feature_****-XQI4C6XJ4O5UMBXPFXK73HT2RDSRQFVROIGJ25NECTJ73F7HNLVQ@2@tmp:/var/jenkins_home/workspace/****_feature_****-XQI4C6XJ4O5UMBXPFXK73HT2RDSRQFVROIGJ25NECTJ73F7HNLVQ@2@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat c922be38aabaa3f9b626be62fcd3107c46ab8f7b [Pipeline] { [Pipeline] echo Testing volume is mounted [Pipeline] sh [****_feature_****-XQI4C6XJ4O5UMBXPFXK73HT2RDSRQFVROIGJ25NECTJ73F7HNLVQ@2] Running shell script + [ -f /var/www/readme.MD ] + echo Volume mounted Volume mounted + exit 0 [Pipeline] } $ docker stop --time=1 3cda9418fb950f1004224a071cde0260b3b387997041380a220230038f5eda0d $ docker rm -f 3cda9418fb950f1004224a071cde0260b3b387997041380a220230038f5eda0d
It is curious that it reports Jenkins does not appear to be running in a container. We are using sibling containers. I am not sure that is directly relevant to the issue though.
We're still seeing this issue intermittently.
Is there anything anyone can suggest to get more info for debugging what is causing it?