# TSSW Jenkins Workspace Cleaning TunableLaser

XMLWordPrintable

## Details

• Type: Bug
• Status: Invalid
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
None
• Story Points:
0.125
• Team:
SQuaRE

## Description

Per email from Eric Coughlin:

 Hi Joshua,   I need a workspace cleaning on the ts_TunableLaser repository. https://ts-ci.lsst.codes/job/ts_TunableLaser/job/feature%252Fcouger01%252Fdm-17604/       Thank you very much for your time,   Eric 

## Activity

Hide
Joshua Hoblitt added a comment -

Eric Coughlin I'm not sure exactly what it being requested, could you clarify?

Looking at the console log of most recent build of ts_TunableLaser, https://ts-ci.lsst.codes/job/ts_TunableLaser/job/feature%252Fcouger01%252Fdm-17604/13/console , I see this exception:

 Required context class hudson.FilePath is missing Perhaps you forgot to surround the code with a step that provides this, such as: node Error when executing always post condition: org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing 

That error is most likely being caused as the pipeline doesn't have a node (Ie., a workspace) allocated inside of the cleanup block. If you move deleteDir() step to be under post { always {... I suspect it would resolve that exception. Was that would you needed help with?

  post {  always {  ...  }  cleanup {  // clean up the workspace  deleteDir()  }  } 

Show
Joshua Hoblitt added a comment - Eric Coughlin I'm not sure exactly what it being requested, could you clarify? Looking at the console log of most recent build of ts_TunableLaser , https://ts-ci.lsst.codes/job/ts_TunableLaser/job/feature%252Fcouger01%252Fdm-17604/13/console , I see this exception: Required context class hudson.FilePath is missing Perhaps you forgot to surround the code with a step that provides this , such as: node Error when executing always post condition: org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing That error is most likely being caused as the pipeline doesn't have a node (Ie., a workspace) allocated inside of the cleanup block. If you move deleteDir() step to be under post { always {... I suspect it would resolve that exception. Was that would you needed help with? post { always { ... } cleanup { // clean up the workspace deleteDir() } }
Hide
Eric Coughlin added a comment -

Joshua Hoblitt I would expect that you are correct, but my Jenkinsfile does follow that as far as I can tell. https://github.com/lsst-ts/ts_TunableLaser/blob/feature/couger01/dm-17604/Jenkinsfile  I had to change my docker image that I was testing from and so needed to make some changes. Then I started running into trouble with this. I spoke with Te-Wei Tsai and he told me to try several things and then told me that one of the configurations I tried needed to have the workspace cleaned up.

Show
Eric Coughlin added a comment - Joshua Hoblitt I would expect that you are correct, but my Jenkinsfile does follow that as far as I can tell. https://github.com/lsst-ts/ts_TunableLaser/blob/feature/couger01/dm-17604/Jenkinsfile   I had to change my docker image that I was testing from and so needed to make some changes. Then I started running into trouble with this. I spoke with Te-Wei Tsai and he told me to try several things and then told me that one of the configurations I tried needed to have the workspace cleaned up.
Hide
Joshua Hoblitt added a comment - - edited

Eric Coughlin This is post block I see in the Jenkinsfile:

  post {  always {  // The path of xml needed by JUnit is relative to  // the workspace.  junit 'jenkinsReport/*.xml'    // Publish the HTML report  publishHTML (target: [  allowMissing: false,  alwaysLinkToLastBuild: false,  keepAll: true,  reportDir: 'htmlcov',  reportFiles: 'index.html',  reportName: "Coverage Report"  ])  }  cleanup {  // clean up the workspace  deleteDir()  } } 

The deleteDir step is clearly not under the always block. This Jenkinsfile, in its current form, will always fail regardless of the state or existence of a workspace.

Show
Joshua Hoblitt added a comment - - edited Eric Coughlin This is post block I see in the Jenkinsfile : post { always { // The path of xml needed by JUnit is relative to // the workspace. junit 'jenkinsReport/*.xml'   // Publish the HTML report publishHTML (target: [ allowMissing: false , alwaysLinkToLastBuild: false , keepAll: true , reportDir: 'htmlcov' , reportFiles: 'index.html' , reportName: "Coverage Report" ]) } cleanup { // clean up the workspace deleteDir() } } The deleteDir step is clearly not under the always block. This Jenkinsfile , in its current form, will always fail regardless of the state or existence of a workspace.
Hide
Eric Coughlin added a comment - - edited

Sorry Joshua Hoblitt, I was not clearly seeing what you meant. I have rectified it to be

 // code placeholder post {  always {  // The path of xml needed by JUnit is relative to  // the workspace.  junit 'jenkinsReport/*.xml' // Publish the HTML report  publishHTML (target: [  allowMissing: false,  alwaysLinkToLastBuild: false,  keepAll: true,  reportDir: 'htmlcov',  reportFiles: 'index.html',  reportName: "Coverage Report"  ])  deleteDir()  }

I am still getting that error on the junit step about a filepath context missing. It seems like the docker container that's being pulled in the pipeline is not starting for some reason. Which I believe is the missing context for the following steps. This is a little strange because it runs fine when locally built. Sorry if I'm wrong about any of this.

Show
Eric Coughlin added a comment - - edited Sorry Joshua Hoblitt , I was not clearly seeing what you meant. I have rectified it to be  // code placeholder post { always { // The path of xml needed by JUnit is relative to // the workspace. junit 'jenkinsReport/*.xml' // Publish the HTML report publishHTML (target: [ allowMissing: false , alwaysLinkToLastBuild: false , keepAll: true , reportDir: 'htmlcov' , reportFiles: 'index.html' , reportName: "Coverage Report" ]) deleteDir() } I am still getting that error on the junit step about a filepath context missing. It seems like the docker container that's being pulled in the pipeline  is not starting for some reason. Which I believe is the missing context for the following steps. This is a little strange because it runs fine when locally built. Sorry if I'm wrong about any of this.

## People

• Assignee:
Joshua Hoblitt
Reporter:
Joshua Hoblitt
Watchers:
Andy Clements, Eric Coughlin, Joshua Hoblitt, Rob Bovill, Simon Krughoff