Created
November 10, 2023 07:06
-
-
Save mauricioduarte01/fba0de12457c9c3167fa0694c6a9b566 to your computer and use it in GitHub Desktop.
nada
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://app.eraser.io/workspace/zXtfgL0Wih22fXbAK8cm | |
| In a Jenkins pipeline, the cleanWs() step is used to clean up the workspace, deleting directories and files that may have been left from previous builds. Whether you should use it at the beginning or the end of a pipeline (or both) can depend on your specific needs and workflow. | |
| Here are the common practices: | |
| At the Beginning: Using cleanWs() at the start of a pipeline ensures that you have a clean state before you begin your build process. This is helpful to prevent any conflicts or inconsistencies that may arise from residual files from a previous build. | |
| At the End: Placing cleanWs() at the end of a pipeline is useful for housekeeping purposes, ensuring that no unnecessary files are left on the build agent after the job is completed. This helps to conserve disk space on the agent. | |
| Both: Using cleanWs() both at the beginning and the end can be considered a more rigorous approach, where you ensure a clean workspace before you start and also clean up after yourself when you're done. | |
| It's also important to consider the following: | |
| If you have multiple builds running on the same agent in parallel, you should be careful with the cleanup process so that one build does not delete the workspace of another. | |
| If your builds are incremental and rely on artifacts from previous builds, using cleanWs() might not be appropriate as it would delete those needed artifacts. | |
| Some teams prefer to clean up at the beginning to minimize the time spent in the "post" section of the pipeline, which is generally used for steps like sending notifications, collecting artifacts, and other end-of-pipeline tasks. | |
| It's always good to tailor the usage of cleanWs() to the specific needs of your CI/CD process. |
Author
mauricioduarte01
commented
Nov 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment