You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "ADITYA-KUMAR-2358 (via GitHub)" <gi...@apache.org> on 2026/09/18 08:36:24 UTC
[PR] Add optional workspace cleanup stage to Jenkinsfile [camel-spring-boot]
ADITYA-KUMAR-2358 opened a new pull request, #1987:
URL: https://github.com/apache/camel-spring-boot/pull/1987
## Summary
Adds a new `Clean workspace` stage to the pipeline that runs before
`Build & Deploy`, along with a `CLEAN` boolean parameter (default:
`true`) to control it.
## Motivation
Builds could previously pick up stale files from a previous run's
workspace (e.g. leftover build artifacts, cached files), which risks
non-reproducible or inconsistent build results. This adds an explicit,
opt-out cleanup step to guard against that.
## Changes
- Added `CLEAN` boolean parameter (defaults to `true`).
- Added `Clean workspace` stage, gated on `params.CLEAN`, using
`cleanWs()` from the Workspace Cleanup plugin.
- Wrapped `cleanWs()` in a try/catch so a cleanup failure logs a
warning instead of failing the whole pipeline.
## Testing
- [ ] Ran pipeline with `CLEAN=true` confirms workspace is wiped
before build.
- [ ] Ran pipeline with `CLEAN=false` confirms cleanup stage is
skipped and build proceeds as before.
- [ ] Verified `Build & Deploy` stage behavior is unchanged.
## Notes
- `cleanWs()` requires the [Workspace Cleanup
plugin](https://plugins.jenkins.io/ws-cleanup/) to be installed on
the Jenkins controller/agents — please confirm it's available in
the target environment before merging.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional workspace cleanup stage to Jenkinsfile [camel-spring-boot]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway merged PR #1987:
URL: https://github.com/apache/camel-spring-boot/pull/1987
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional workspace cleanup stage to Jenkinsfile [camel-spring-boot]
Posted by "ADITYA-KUMAR-2358 (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org