jonnyzzz / TeamCity.GitHub

Integration of TeamCity and GitHub
216 stars 63 forks source link

Possible to mark a pull request as "pending" immediately on changes detected? #21

Open petemounce opened 11 years ago

petemounce commented 11 years ago

I think at the moment, the plugin will mark a pull request as "pending build" when a build starts.

Would it be possible instead to mark the PR as pending as soon as changes are detected against it, since otherwise there's a window between changes committed and build-started that the commit status will be green, when actually there are untested changes?

jonnyzzz commented 11 years ago

Good point! I will consider this change. Thanks!

BTW. If you like, you may consider to come up with a pull request

petemounce commented 11 years ago

@jonnyzzz I'd like to say I'll come up with the PR, but I've never written a line of java in my life. I could probably hack something together, but would be foundering around figuring out how to build and run tests; is there a set of guidelines to go look at? I guess IntelliJ would be a starting point...?

jonnyzzz commented 11 years ago

Let me try to describe how to start with plugin development. Initially I used Plugin Template to start with. You may take a look to the docs there as well.

I totally use IntelliJ project setup to compile, tests and generate plugin. Here is the list on how to open the plugin for development. Unfortunately, this is quite a big number of tasks. To start with, try the following steps:

jonnyzzz commented 10 years ago

I checked the code. It uses the event from TeamCity that is fired exactly when changes were associated with a build. There are two possibilities

I pushed this change in commit f406dd2c

jonnyzzz commented 10 years ago

Current implementation notices the build only one build is started. I'll reopen it to make it fixed properly

oschwald commented 10 years ago

It would be great if TeamCity notified GitHub as soon as the job was queued.

WillAbides commented 10 years ago

I think the premise of this issue is no longer valid. When a branch commit is pushed to github, the api returns [] for status and the ui doesn't show a status message.

For comparison, this is what a pull request's merge prompt looks like when there is no status and you can fast-forward merge:

And this is what it looks like when there is a success status on the commit:

petemounce commented 10 years ago

I disagree - I want a potential merger to know explicitly that a build is pending. That merger (I'm in a corporate setting, not public!) might not know that CI exists, to not click that inviting green button.

On 7 April 2014 14:44, willroden notifications@github.com wrote:

I think the premise of this issue is no longer valid. When a branch commit is pushed to github, the api returns [] for status and the ui doesn't show a status message.

For comparison, this is what a pull request's merge prompt looks like when there is no status and you can fast-forward merge:

https://camo.githubusercontent.com/2eabeb355d883adbb0e6c7b7a402d0606d915c29/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f35736b7372396b306e79386f7671382f323031342d30342d3036253230617425323031302e3537253230414d25323032782e706e67

And this is what it looks like when there is a success status on the commit:

https://camo.githubusercontent.com/382f67ce9f6ed4db039453fc1e0cda7df7b30f12/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f6e79386e67327635366e7368386e692f323031342d30342d3036253230617425323031302e3531253230414d25323032782e706e67

Reply to this email directly or view it on GitHubhttps://github.com/jonnyzzz/TeamCity.GitHub/issues/21#issuecomment-39730778 .

oschwald commented 10 years ago

I agree with @petemounce. We have had several accidental merged because the reviewer did not realize that there was a pending TeamCity run.

j0tunn commented 10 years ago

@jonnyzzz What the status of this issue now?

jonnyzzz commented 10 years ago

There are no specific plans for the issue now. The requested feature is nice to have. So here I collect votes now. If you like you may submit a pull request for it. On Aug 22, 2014 1:43 PM, "j0tunn" notifications@github.com wrote:

@jonnyzzz https://github.com/jonnyzzz What the status of this issue now?

— Reply to this email directly or view it on GitHub https://github.com/jonnyzzz/TeamCity.GitHub/issues/21#issuecomment-53050884 .

j0tunn commented 10 years ago

ok, I understand. Are your advices in https://github.com/jonnyzzz/TeamCity.GitHub/issues/21#issuecomment-18900141 still ok?

jonnyzzz commented 10 years ago

Yes. You may use newer version of IntelliJ IDEA of course.

You need to register a listener on changesCollected event and check there if updated buildTypes have the build fearure enabled. On Aug 22, 2014 1:54 PM, "j0tunn" notifications@github.com wrote:

ok, I understand. Are your advices in #21 (comment) https://github.com/jonnyzzz/TeamCity.GitHub/issues/21#issuecomment-18900141 still ok?

— Reply to this email directly or view it on GitHub https://github.com/jonnyzzz/TeamCity.GitHub/issues/21#issuecomment-53051852 .

j0tunn commented 10 years ago

How about listener to buildTypeAddedToQueue

jonnyzzz commented 10 years ago

It is first added. Changes are collected later on. There is a difference between chained builds and single. For chained changes are collected ehile it is in the queue. But for single only ehen build is started on agent On Aug 22, 2014 2:02 PM, "j0tunn" notifications@github.com wrote:

How about listener to buildTypeAddedToQueue: http://javadoc.jetbrains.net/teamcity/openapi/6.0/jetbrains/buildServer/serverSide/BuildServerListener.html#buildTypeAddedToQueue(jetbrains.buildServer.serverSide.SQueuedBuild

— Reply to this email directly or view it on GitHub https://github.com/jonnyzzz/TeamCity.GitHub/issues/21#issuecomment-53052465 .

j0tunn commented 10 years ago

@jonnyzzz

Under Ultimate edition you'll see run configuration to start plugin under TeamCity under debug strait from IntelliJ (this trick requires Tomcat support. Use TeamCity installation directory as tomcat path)

How can I start plugin under TeamCity under debug with Community edition?

jonnyzzz commented 10 years ago

The only manual way would work since Tomcat support was used to start the server. But you may have the 'deploy' artifact to deploy plugin binaries into the started server's data directory

Best regards, Eugene Petrenko

On Tue, Aug 26, 2014 at 2:32 PM, j0tunn notifications@github.com wrote:

@jonnyzzz https://github.com/jonnyzzz

Under Ultimate edition you'll see run configuration to start plugin under TeamCity under debug strait from IntelliJ (this trick requires Tomcat support. Use TeamCity installation directory as tomcat path)

How can I start plugin under TeamCity under debug with Community edition?

— Reply to this email directly or view it on GitHub https://github.com/jonnyzzz/TeamCity.GitHub/issues/21#issuecomment-53401937 .

jonnyzzz commented 10 years ago

You may also try IntelliJ IDEA Ultimate 14 EAP which does not require license

Best regards, Eugene Petrenko

On Tue, Aug 26, 2014 at 2:43 PM, Eugene Petrenko eugene.petrenko@gmail.com wrote:

The only manual way would work since Tomcat support was used to start the server. But you may have the 'deploy' artifact to deploy plugin binaries into the started server's data directory

Best regards, Eugene Petrenko

On Tue, Aug 26, 2014 at 2:32 PM, j0tunn notifications@github.com wrote:

@jonnyzzz https://github.com/jonnyzzz

Under Ultimate edition you'll see run configuration to start plugin under TeamCity under debug strait from IntelliJ (this trick requires Tomcat support. Use TeamCity installation directory as tomcat path)

How can I start plugin under TeamCity under debug with Community edition?

— Reply to this email directly or view it on GitHub https://github.com/jonnyzzz/TeamCity.GitHub/issues/21#issuecomment-53401937 .

j0tunn commented 10 years ago

@jonnyzzz There are errors during run under IntelliJ IDEA (14 EAP or 13):

[2014-08-26 04:07:25,013] Artifact ROOT: Artifact is being deployed, please wait...
[2014-08-26 04:07:25,028] Artifact ROOT: Error during artifact deployment. See server log for details.
[2014-08-26 04:07:25,029] Artifact ROOT: com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: /Applications/IntelliJ IDEA 13.app/bin/Users/j0tunn/work/j0tunn/TeamCity/webapps/ROOT not found for the web module.
Aug 26, 2014 4:07:34 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /Users/j0tunn/work/j0tunn/TeamCity/webapps/ROOT
log4j:ERROR Could not parse url [file:%IDEA_RUN:TOMCAT_HOME%/conf/teamcity-server-log4j.xml].
...

Am I missing something?

j0tunn commented 10 years ago

nevermind. Looks like some conflicts of different IDEA versions: after reset to clean repository state errors dissapeared

potmo commented 10 years ago

:+1:

jonnyzzz commented 10 years ago

Related to #30

ferventcoder commented 9 years ago

:+1: vote. :)

withinboredom commented 9 years ago

My work around:

And viola!

jsoklevski commented 7 years ago

Do You see a problem if i change the event for marking a build as pending for the one currently used :

to the following one :

And all needed data i get form this object : buildType.getLastChangesStartedBuild()

If not what do you suggest is there another way to get all needed values ?