ADITYA-KUMAR-2358 commented on PR #1987:
URL: 
https://github.com/apache/camel-spring-boot/pull/1987#issuecomment-5728861405

   > Thanks for the contribution! As written, `cleanWs()` runs after Jenkins 
has already checked out the repository, so it deletes `mvnw` and the sources, 
and the `Build & Deploy` stage then fails on every default (`CLEAN=true`) run.
   > 
   > To stay consistent with the other Jenkinsfiles in this repo 
(`Jenkinsfile.sb`, `Jenkinsfile.sb.ppc64le`) and with Camel core's 
`Jenkinsfile.deploy`, could you use the same pattern?
   > 
   > ```groovy
   > parameters {
   >     booleanParam(name: 'CLEAN', defaultValue: true, description: 'Perform 
the build in clean workspace')
   > }
   > 
   > stages {
   >     stage('Clean workspace') {
   >          when {
   >              expression { params.CLEAN }
   >          }
   >          steps {
   >              sh 'git clean -fdx'
   >          }
   >     }
   >     ...
   > }
   > 
   > post {
   >     always {
   >         emailext(...)
   >         cleanWs(
   >             cleanWhenNotBuilt: false,
   >             cleanWhenUnstable: false,
   >             cleanWhenFailure: false,
   >             cleanWhenAborted: false,
   >             cleanWhenSuccess: true,
   >             deleteDirs: true,
   >             disableDeferredWipeout: true,
   >             notFailBuild: true)
   >     }
   > }
   > ```
   > 
   > * `git clean -fdx` removes untracked and ignored files but keeps the 
checkout, so the build still has its sources.
   > * `cleanWs(...)` in `post` wipes the workspace only after a successful 
run, which keeps a failed workspace around for debugging. `notFailBuild: true` 
replaces the try/catch.
   > * Please also restore the trailing newline at the end of the file.
   
   Sure , i'll do the needful right away


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to