How can Hudson delete the artifacts created by my build? - build-process

Our organization's custom build tools write out a lot of intermediate data, and I'd like it if Hudson could detect which files were created as part of a build and archive those. I'm not sure if it already does so, but if it does there's no user-visible explanation of it, and certainly deleting a build does not delete its output.
In detail here's what I want. Suppose I start with a bare workspace. After build 1, I have this:
ws/
src/...
obj/
1/...
log/
1/...
pkg/
pkg-1.tgz
Now, I run build 2:
ws/
src/...
obj/
1/...
2/...
log/
1/..
2/..
pkg/
pkg-1.tgz
pkg-2.tgz
The source code is checked out into ws/src each build; there's a custom checkout process, so I can't use the svn RCS method :/.
When I delete a build, I'd like to delete everything that came from that build. Can I do this?

The Hudson way would be to clean up all temporary files at the beginning of the build, and then use Hudson's artifacts archive facility to save the output from each build - specify pkg/**/*.tgz for the "Archive the Artifacts" post build step and then the tgz files will all be copied into the job specific storage area.
The workspace is just a workspace - it's not intended for long term storage.

What I would do, if I were in your shoes, would be to solve the problem a different way. I would write a task or script that specifically deletes everything you don't want to keep, and run that task or script at the end of each job.
Hudson assumes you're cleaning up temp files on your own. If that's not happening, I don't believe Hudson has any facility to help you.

It's difficult to answer without understanding your "custom checkout process", but typically all of the project's build artifacts are created beneath a single directory apart from the src, e.g. "build" or "target".
That way, the project's "clean" target can simply remove that directory, and you can instruct Hudson to include this target for each build.
It appears your build artifacts are contained in multiple directories relative to 'src': 'obj', 'log', and 'pkg'. Can you introduce a "clean" target that will explicitly delete each of those directories?

Related

Alter an already published build

Is there a way to alter a build using the CLI after having published it?
UseCase: A deployer (be it automated or manual) wants to add additional files (e.g. Testresult-logs) to an already published build (because they need very long to be created but the artifacts of the fresh build should be published asap).
When I redo a jfrog rt bp over and over again I get "new" builds with the same description (same buildnumer etc.) instead of overwriting/extending existing build.
Appreciating any hint :-)
The main idea of the buildinfo in Artifactory is that they are immutable, which means they cannot be modified post publish. This is to make sure the integrity of them.
In your case, a possible way to achieve this may be:
When publishing the artifacts themselves, you might want to not publish the buildinfo.
You can collect buildinfo through your build cycle, and publish everything as a single buildinfo object after all the tests.

Proper way to remove Gruntjs, package.json and other files from release branch

I am developing a wordpress theme. I am new to using Grunt and composer for packages.
I have also integrated git flows. At the moment I am developing on develop branch and then merge to master once I am satisfied with the code.
The problem I am facing is that my master branch has Gruntfile.js as well as package.json in it. Similarly there are sass files in css folders. I want a clean release branch, in which there are only required theme files and no gruntjs, pacakge.json and sass files.
These all files are being tracked in master, how can I create a clean release branch.
I have followed the Woocommerce repository for making my development environment.
I could not find a build process in it also. Am I missing any proper step?
P.S : I don't know if I should be sharing any code samples here, but if you want anything I can share it here.
As far as I'm aware you can't do what you're trying to do and I don't believe git is meant to work that way. Having your grunt & SASS files in the master branch is the correct way of doing this, those files are also in the Woocommerce repository you've linked to.
I'm guessing what you're trying to do is create a release of a theme that doesn't have any of the 'development only files', for lack of a better term, to give to the the end user installing the theme? If so that release would be a separate 'thing' to git as git is mainly for developer version control. What I think you're after is just creating a stand-alone downloadable zip file by the sounds of things?
For example if you were to submit your theme to WordPrss.org they take it as a zip file rather than a link to a git repository.

Ignore git files locally but do not remove them from the repository

My team has is working on a git repository which contains a fully deployable Wordpress app. This was configured in this way so that it could be deployed to a AWS stack quite easily. The repository contains a caching plugin which creates two folders in the wp-content/ folder named
cache/
w3tc-config/
When devs are checking out this application they are removing the caching features for development and thus the plugin is writing these changes to the two directories it uses. Which then encourages .git to stage them for a commit.
Is there anyway we can ignore these folders on dev machines but not remove them from the repo? Also i'd be interested in hearing other solutions which might help me get round this problem even if it is a larger change.
If you check out your repository and let master follow that, then you can create a devel branch where you just add cache w3tc-config to .gitignore.
I do something similar at work where I use git-svn to work with a svn repository which "links" in another svn repository for a sub module. Git clone did not fetch that sub module, so I just copied in the content from a svn checkout, checked into a devel branch (leaving master following the svn trunk branch), and added the sub module directory to .gitignore.
This is a solution that will require specific action from each developer, and not something you can push out from the repository. But similar to git hooks, if you create a tools/do_it.sh script that does the required actions it is possible to lower the bar considerably.
You cannot have it both ways. Either the files are tracked or they are not. You cannot keep files in the repository but avoid tracking changes to them. Once they are tracked, it is up to you to not git add them. (And it is worth noting that git does not track folders ever.)
Create an archive called UnzipMeRightAfterCloning.zip that contains all the stuff you want ignored. Anyone cloning the repo needs to extract that archive, and it will add all the files/folders blocked by your .gitignore settings. (And given your current setup, you will have to untrack the files in those folders first.)
Put these in your .gitignore file. (Do not put in asterisk.)
cache/
w3tc-config/
Yes, create a local .gitignore file in the project directory.
in the file paste the following
cache/*
w3tc-config/*
Now, these files will be excluded from git, but they won't be removed from the repository.

Eclipse CDT - Build sub directory within a project

i would like to know if there is an option in Eclipse (CDT) to build only part of project.
my situation is i got a very large single project which consist of many sub directories, and my build system is a custom script. now if i run the custom script from the root folder of the project, it will build all the sub folders of the projects. this takes long time and i would like to have an option to instruct the CDT to execute custom build command depending in which folder is selected in the source tree. (my custom build script would build then only the content of that directory).
is there any option to perform such action in CDT? (i'm using Galileo).
You can create a custom make target. There is a specific view "Make Target", where you can view/add/edit them. We use them in our project to build a single components of our project.
The catch is that you will need to create a new target for each subdirectory. The bonus is that you easily copy each target across subdirectories.
It is also a time saver to know some short-cuts by heart: (in Indigo) F9 to re-launch the last target, and CTRL+SHIFT-Q, M to display the Make Target view. ;-)
Also, you should upgrade to Indigo - provided your plugins permit this. The cdt plugin is massively improved since then.
I don't think CDT provides this. However, do consider whether your project really is best suited to being a single project or if it might benefit from being split up into sub-projects. There might also be a performance boost to be found in your makefile; have you read the "Recursive Make Considered Harmful" essay?

How do I provide Team City with a file?

We are looking at modifying our build process so that our configuration files are all template based. We will then have a local.properties.xml file which will be used by NAnt to create configuration files that are specific to the person running the build.
My question is how can I safely provide TeamCity with a file considering we don't want to check in the local.properties.xml? I'm pretty sure that TeamCity nukes the build directory it has so I don't think I can just drop a file in their.
Any suggestions?
I see the hackish way only: post your file as an artifact of some build and retrieve it with help of artifact dependencies.

Resources