I have made a checkout in my directory of an SVN repository. The project take a lot of time to be completely checked. And so while creating my Hudson job I need this in order :
Clean up the directory (this resolves some ambiguous problems such as : "Hudson workspace locked while building" )
Revert the changes
Update
The choices that I have for Check-out Strategy, in the Hudson job creation form, are:
Use svn update as much as possible, with 'svn revert' before update
Use 'svn switch' as much as possible
Use 'svn update' as much as possible
Clean checkout folders and then checkout
Emulate clean checkout by first deleting unversioned/ignored files, then 'svn update'
Clean workspace and then checkout (Eliminated)
What is the right option for my case?
Thank you a lot!
If your build is done correctly, you should be able to simply do use 'svn update as much as possible. This is the fastest way to update your files. This means not modifying committed files, or placing build artifacts in directories where they will interfere with the build process. In a Java shop, simply keeping all built objects in a subdirectory (we use target to match Maven, but others use build or diet) and out of the way of the rest of the process.
Most people do a clean as part of their build step. This, in theory, should not be necessary, and doing so will lengthen build times. The idea of the build is not to do any unnecessary work. If a source file isn't changed, the corresponding object file should not need to be rebuilt. However, Java is pretty fast at compiling, that most Java projects simply wipe the build directory clean. In C projects, not deleting old objects is better since it really reduces build time.
If there is a problem with your build process where use 'svn update' as much as possible can't work, you should fix your build process. However, there are a couple of projects on our old Jenkins server that do have problems, and they simply aren't updated enough to worry about it. For those, I do Always checkout a fresh copy. This takes the longest, but if you're having problems with your build process, I wouldn't bother using emulate a clean checkout by first deleting unversioned/modified files and use svn revert first. These can cause update conflicts, and cause problems with your build. Either get the build working correctly, or do a clean checkout.
I would go with "Use svn update as much as possible, with 'svn revert' before update". If that is not sufficient, check out the EnvInject Plugin. It can run a script before the SCm checkout happens. You can use it to run a svn cleanup for your job, before the Subversion plugin takes over with the revert and the update. Caveat, you need to install some kind of SVN command line client on your build server.
Related
I am working with an older version of TFS and am trying to save time by only doing an npm install if the packages have changed or only webpack if the javascript files have been changed. There are a few projects in the repository that are built every time but if we can skip the unchanged projects it will save a bunch of time. After a bit of research I think the answer is an incremental build.
The build's initial Get Sources step has Clean set to false.
I don't see any other places to toggle clean build other than the initial Get Sources. Or any options with the npm build steps to check before doing an install or webpack.
I found this documentation note in the Clean build options:
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/vsbuild-v1?view=azure-pipelines-2018
This option has no practical effect unless you also set the Clean repository to false.
But I don't understand where the Clean repository setting is, or if the Get Sources Clean is the Clean repository setting and I need to find a different Clean option.
If it isn't obvious I'm pretty new to TFS builds so breaking down the answer will be helpful.
I have a Jenkins pipeline build that reports on cucumber tests using the "CucumberReportPublisher". When I delete tests or refactor a whole feature, many times the old tests hang around in the jenkins test report, showing as "skipped".
Is there a way to make Jenkins/CucmberReportPublisher forget about these old tests and stop reporting them as skipped?
It sounds like you don't have a clean environment when you build your project.
I would make sure that Jenkins deleted the work space for the job and checked out the entire project from scratch for every build. I don't have a Jenkins to look at here, but there are different checkout options available for the job near the version control settings. Choose one that deletes the work space before checkout.
Another option can be to clean as the first step in your build. Assuming that you use Maven, it could look like this
mvn clean deploy
This may solve your problem with ghost tests hanging around after deletion. But it may not solve your problem with a dirty work space.
I am using the cleanup feature in Jenkins, which delete the previous build directory and create a new one every time. This is great, except that I need to maintain certain files in the build directory, so I am trying to delete just the source folder that contain the code.
The problem is that when the build start, the first thing that happen is the git checkout of the code, which means that if I put a delete command in the jenkins script area, it will delete the directory that was checked out, and that obviously won't work.
Is there a way to tell Jenkins to perform commands before the git checkout happen? Or to cleanup selectively the build folder, so Jenkins know what to keep and what to delete?
Use the pre-scm-buildstep plugin. It will let you do all sorts of things prior to touching your SCM.
JENKINS
I am noticing that the every time I run one of my jobs in Jenkins, there are two files created in the /workspace/build/distributions dir. The two files have the extensions of .tar and .tgz. Every time, I run the job, another set of these files are created. So, if I run the job 3 times, there will be 6 files all together. I have noticed that during the dependency check phase, these artifacts slow things down. Therefore, I wanted to remove them automatically before each time this job runs. I have attempted the configs in the image below. In addition, I have tried the workspace cleanup plugin and that completely deleted the workspace. That is definitely not what I wanted.
Therefore, what would be the best way to go about this.
What scm plugin are you using? Some of the scm plugins allow you to clean the workspace before an update (e.g. SVN's "Emulate clean checkout" and Git's "Clean before checkout" options).
If you're not using a scm plugin, can you remove the files in a batch/shell script during the first build step?
Or perhaps you can go about it from the reverse direction. Can you get rid of the files as the last build step of the job? That way, they are gone when the next build comes along.
I'm already finishing my project build automation :) with Hudson and Nant.
My project structure is something like
$/Project
build.scripts
script1.build
script2.build
build.properties.xml
Code
Project1
Project2
So Hudson downloads from the root $/Project to the workspace folder.
And everything is ok since the build.scripts are in the workspace, I run them very easily, however what is bugging me is the fact that since the build scripts are inside the workspace, then I can't program Hudson to run automatically either based on time or changes because it will always detect changes to the files (note build.properties.xml which I check out and check in at build time to store some stats).
Where do you recommend these files to go in and still get the advantage of having them source-controlled?
What I ended up doing is to NOT check-in changes to those files. I changed my CI workflow to create another file (local to the workspace only) where the changes are written to.
This way, I still get the last build info written somewhere to pick it up, and avoid the issue of Jenkins detecting the change.
PS: I changed from Hudson to Jenkins since I saw that most plugins ran away from the former. The transition was too smooth to be true.