Human interaction plugin
Hi,
I have no experience with TC plugin development, and the docs don't explicitly talk about such a kind of plugin.
I would like to know whether TeamCity would support a plugin which adds synchronous user interaction during a build run, that is, blocking and prompting for user intervention before going on with a build run.
Please sign in to leave a comment.
Do you want to block before build starts on the agent? If so, I think it is possible to write a build precondition which will require a user to go to some page and somehow approve build before it starts. This way build will not block an agent while user decides to go and approve it.
If you need to block build on the agent, this can be tricky, because it is not clear how to approve build in this case. If you need to do it from TC web UI, probably some kind of callback should be done from the agent to the server when build starts. Then agent must wait till build is approved, and continue after that. This kind of plugin is more complex, but I think it is still doable.
Hi Pavel, thanks for your reply. It's not really important _when_ to block, but let me clarify it a bit.
I'm trying to automate part of our deployment process and I was considering to move a step which requires user intervention on TeamCity as well.
As per our actual deployment process user intervention in required to confirm closing issue tracker points upon releasing a software. At the moment whoever is doing the release is prompted by a desktop application GUI where he can close tickets. Moving that step on TeamCity would mean integrating the API used to interact with the issue tracker with a TeamCity plugin which shows either a page or a user interface widget where the user can perform the same task. Once the user completes the blocking task the build can proceed.
I'm evaluating the feasibility of such a plugin and looking for advice.
With TeamCity API you can: register your own controller which will serve custom pages: http://confluence.jetbrains.net/display/TCD5/Web+UI+Extensions. It is also possible to write start build precondition, which will block build till a user performs an action on the page: http://confluence.jetbrains.net/display/TCD5/Extensions
So it seems feasible.
Thanks a lot, I will look at the docs then. Since I'm a noob in Java is there any special environment requirements to build a TC plugin or an IDE like IntelliJ IDEA, Eclipse or NetBeans goes?
No there is not. You can use any IDE. Most of our open sourced plugins are configured to be used in IntelliJ IDEA, so if you plan to use them as reference you will need an IDEA to open project.
Hi Pavel, I have started playing with the TC API to try creating a plugin, and I'm wondering if there's way to replace entirely how TC reponds to the RUN button for build configurations, since that's what I'm trying to achieve.
Simone,
There is no "valid" way AFAIK.
However you can probably try to change the Run buttons on client from JavaScript that you can add via your controller to all pages. Please note that this is not a good way of doing things and this approach can spoil the page logic in non-obvious way.
I understand. Do you think there is any way then I can show a page to the user to which he has to respond to by filling-in some data before letting the build continue?
Simone,
Do you want to display a page on the build starting or somehow in the process of the build?
Frankly, I do not quite understand how you would like it to look for the "inside the build" case.
If you want to change the way builds are started you can probably try the following: remove the current Run button at all (e.g. by removing permission to run builds from the users, but this can be not the best way) and add your own control (e.g. in JavaScript) to start a build.
Hi Yegor, let me explain briefly.
I am trying to integrate TC into our current release system. At the moment we use some client applications to do that, and they require user intervention at the beginning of the process. This is needed to select issue tracker items to close, choosing which version to release, and quite some other stuff which integrates with some databases and services. I am evaluating whether it is doable to move this stuff on TC by extending the user interface in the first place.
In this scenario I would need to present a custom UI when a build is started which prompts for some information from the user, backed by a web service which interacts with our current system and then continues the build.
Simone,
Is it possible to collect all the necesary in formation from the user and the backing systems and then start the build supplying it to the build?
If this can be moved from "inside the build" to "start the build supplying additional data", this can be much more easier to implement.
Actually, the first step I'd recomed to try is to support supplying the information to the build via build parameters that you can enter in the custom run build dialog. If that is working, you can create a separate UI (within or even outside TeamCity) that will get all the informatino in a custom UI and some internal logic and then just trigger a build in TeamCity supplying all the inforamtion via build properties.
Thanks Yegor, that makes sense and sounds like a good compromise, I will go in that direction.
Hi Yegor,
I tried following you advice and considered supplying the additional data via custom run, but I need a UI to display the user to collect those data. Discarding the option to override the Run button with my custom button, which sounds more like a hack, I wanted to provide, say, a link to my custom UI, but I cannot find a PlaceId which fits the need. Ideally this link would go next to the run button, or even in the build configuration overview page, but as I understand it there's no such extension point.
Sorry for delay with replying. Indeed there aren't many ways to change behavior of the run button. Some hacks are possible, for example, using JavaScript code it is possible to modify behavior of the run button, i.e. to re-route requests to some custom controller.
Probably we could add some extension points here. I think it is worth to submit a feature request to our tracker.
Here it is: http://youtrack.jetbrains.net/issue/TW-12745