Run build on change but don't checkout in Hudson - hudson

I have kind of an interesting problem...
So I'm trying to run a build every time I see a change on a directory in my SCM in Hudson. However, I don't need to pull the directory to run my script. Is there any way to check if there's a change in a directory, but don't pull it?
In addition, there is another directory which I do need to pull from Hudson at the same time. So basically I want something like:
On change of directory A or B:
pull directory B only
run script
I was told there was functionality like this in Hudson, but I can't find it. Any suggestions? Thanks for the help!

In case anyone is interested, I was able to accomplish this with just Hudson and Perforce.
When using Perforce as the SCM (don't know about the others) there is a 'Use View Mask' checkbox. Checking that give you the ability to choose which directories/files in Perforce to poll without actually pulling those files. For example, I had in my view:
//depot/my_script
I didn't want my script to run automatically when I had a new version, so I put it int o the "Poll Exclude File(s) text box:
//depot/my_script
Which pulls the latest version of my script. Then I checked the Use View Mask checkbox and put:
//depot/my_code_to_compile/
into the View Mask box.
To make Perforce poll for changes, I just checked the "Poll SCM" in build triggers and then made it check every minute. (by inserting "* * * * *" into the Scheduler box)
So to sum up, with the variables set as above, my Hudson job had the following behavior:
check for changes every minute
On changes to //depot/my_code_to_compile/, the Hudson job will run
On changes to //depot/my_script, nothing will happen
The job will pull changes to my_script, but will download nothing from //depot/my_code_to_compile/.

I think you need to install the FSTrigger Plugin for this functionality. To what the wiki pages show this is supported in Jenkins, I am not sure about Hudson compatibility.

Related

Zabbix - track config files

I would like to track changes to one config file. The reason for this is that multiple users access it to solve different issues, but every now and then those fixes break something else. diff function in Zabbix shows that a file was changed, but I would like Zabbix to also track what changed. Is there a combination of triggers that would let me do that? Any help is greatly appreciated.
Do you store file checksum or contents in the item? In any case, there is no built-in way to do that, but you can implement it with a script.
If checksum, you will need a way to store the previous version, new version and run the diff command. The easiest would be a userparameter that would do a diff between a temporary copy of the file and the current copy, then copy the current file over the temporary copy. In this case, you would store diff results directly in an item and your trigger would check that the last value is not an empty string. See https://www.zabbix.com/documentation/3.0/manual/config/items/userparameters for more information on userparameters.
If you are storing file contents already, presumably you want to reuse them. This would be a bit more complicated, as you would have to kick off the script whenever a new value arrives - maybe a special trigger could kick off an action that would compare the last two values (probably using the API), then push the result in another item that has another trigger. Unless you have a good reason to do it this way, I'd opt for the first approach.
Make a copy off your file
file.txt.copy or something like that. Make this file only writable by zabbix.
Create an item and trigger on zabbix to check when the file was changed (using diff or checksum)
Create a action on zabbix to execute a script that will
1 - diff between file.txt and file.txt.copy and send this diference to your email
2 - Copy file.txt to file.txt.copy so you can do the diff next time the file change.
To reate a action with script.
Create a action on zabbix. Go to "operations" tab. Select "Remote Command" from option.
Choose custom script.
Put the script with the whole path and arg's.
Sample
/opt/script/my_script.sh
The user zabbix must have permission to ruin the script.
Zabbix docs

How to stop mercurial from syncing an EXISTING project file

So the problem is that all developers need different settings for their local testing, but the settings file is part of the project (unlike the nbproject folder for example that we all ignore). I know about .htignore, but the filter only applies to files that are not part of the project.
If I forget the file, then this removes it from the "global" repository, where we have a "holder" version of the settings file.
Right now we just don't commit that file, but every now and then somebody forgets and pushes his own settings, which then are synced back to other developers and it's a constant pain. We just want to "automatically" not push that file. Is there a solution to this? Are we doing something wrong?
You could add a precommit hook that gives an error every time you try to commit this particular file.
To handle the case of developers that forget to setup such a hook, you can also add a serverside hook that will reject their push.

Integrate clearcase with Hudson

I am trying to integrate clearcase with Hudson, but auto build is not triggering while merge or checkout.
Created dynamic view "sundaa4_Hudson_Test" and gave the config spec which I used in clearcase
When I gave manual build its showing error
Workspace is not creating in path .hudson\jobs\Hudson_Testing_Sijith\workspace
PLease give some input on this
Make sure your config spec ends with a selection rule like:
element * /main/LATEST
Or it won't select much, which would explain why Hudson doesn't create anything (it doesn't detect any change).
A cleartool lsview which returns a line starting with '*' means the dynamic view is already started: no need to repeat multiple cleartool startview.
Make sure your View root does exists: usually, the MVFS drive for dynamic view is M:\, not K:\.

How do I get a file off google-api-java-client?

OK i want download the the following open source code: http://code.google.com/p/google-api-java-client/source/browse/calendar-v2-atom-android-sample/?repo=samples
I am lead to believe you need to use mercurial for this but have yet to find a tutorial on how. Why is there not a download zip file type thing for this?
I am using eclipse.
How do I get this example?
You can get each file individually by clicking it then right-click "View raw file" in the right column and choose "Save" (which may say something slightly different depending on your browser.)
I don't know about this project, but usually you can download the samples in the zips on the downloads tab
If you want to do it faster than that, you can find a Mercurial client for most operating systems at https://www.mercurial-scm.org/downloads.
Once you have Mercurial installed, running the command
hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
will give you a full copy of the current version in the current directory.

how to get changed files from TFS using nant

It is really painfull to get all code form TFS whenever you make a build using NANT.
Is there any settings in ccnet.config which will only take the files which are changed form last time which can speed up the process.
The "get" process will only actually download files that are different than the version in the workspace, unless you are specifying a /force which will force it to get the specified version even if TFS thinks it has that version in the workspace.