Build Forge: Start build on changed directory
HI. . . Does anyone know a good approach for starting a build if files are added to a directory? We have some business users that do not know (and do not want to know) anything about source code, etc. So we put a little web page up that they can upload their files which we then want Build Forge to notice and start a build upon.
I couldn't find anything jumping out at me on the web.
The approaches that come to mind (keep in mind I'm a BF newb!) are:
That's about all I can think of. What I'm hoping is that there is some sort of event-adapter that I don't know about that can initiate a build when a configured directory on the build agent changes.
Anyone have any ideas?
- Andy
|
Accepted answer
You could do a collector/selector combination to count the files in a directory, but that will not be very responsive. The manifest refresh on the servers is on a 24 hour cycle by default. I would lean toward writing an adaptor to do what you want.
Adaptor help:
Assuming that you move the files out of upload directory on the build, then you could set it up to do a 'ls | wc' or something along those line to find if the count is above zero. If the count is zero, then the adaptor should fail. Otherwise it would succeed, move the files to another staging area, and move onto the real build.
~Spencer
Andy Jewell selected this answer as the correct answer
Comments
Andy Jewell
commented Aug 02 '13, 2:11 p.m.
Wow, that's quite an adapter language. Ugh, guess I'd better roll my sleeves up. Thanks, Spencer, appreciate the pointer! |
One other answer
If you know what one of the files will be named, you should look at the .monitor command
you could also write a looping conditional step (might be easier to understand than the adaptor language) that called a library that checked the number of files in a directory, set an environment variable, then a conditional step that if the env var was set a certain way, chained the project you want to start.
Given your use case, I'd write a project that checked a directory and chained as above, and I would call it from a schedule every once in a while depending on your situation.
Comments
Andy Jewell
commented Aug 08 '13, 12:04 p.m.
Thanks, that does sound like a viable alternative. I'm actually looking at this from another angle, now, since the process that gets the file to the directory is also under my control. It would be the cleanest approach to kick off the build at the same time as the file was dropped. Do you know if Build Forge has a REST or other web service interface that would facilitate that? |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.