github-integration-plugin icon indicating copy to clipboard operation
github-integration-plugin copied to clipboard

processing the DELETE BRANCH message from GH after the GH Branch is deleted

Open ghost opened this issue 8 years ago • 8 comments

ok so the idea here is ... I'm in Github and I press "Delete Branch" and the message makes it to Jenkins BUT because the Github branch is already gone nothing interesting happens (rightly so the branch is gone ... it was just deleted) ---> BUT !!!! there's nothing saying I can't invoke a pipeline on a DIFFERENT BRANCH that contains clean up code.

Where I'm going with all this is I have a branch (call it INFRASTRUCTURE_CLEANUP) and that branch NEVER goes away (well it better not) as it contains pipeline code to cleanup infrastructure. When I delete ANY OTHER BRANCH of the same project I want my INFRASTRUCTURE_CLEANUP branch called.

As a side note ... I'm on the fence about "synchronizing" the doRun(String branch) method (cause synchronizing an entire method IS BAD !). Anyways I put a big comment in front of the method ... and I apologize if my coding is less than par. Trust me I'm trying my best so guidance is appreciated !


This change is Reviewable

ghost avatar Nov 29 '17 04:11 ghost

Codecov Report

Merging #245 into master will decrease coverage by 0.46%. The diff coverage is 17.64%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #245      +/-   ##
============================================
- Coverage     56.24%   55.77%   -0.47%     
+ Complexity      639      635       -4     
============================================
  Files           117      117              
  Lines          3060     3071      +11     
  Branches        253      255       +2     
============================================
- Hits           1721     1713       -8     
- Misses         1244     1263      +19     
  Partials         95       95
Impacted Files Coverage Δ Complexity Δ
...hub/integration/branch/GitHubBranchRepository.java 7.69% <0%> (-0.21%) 6 <0> (ø)
...github/integration/branch/GitHubBranchTrigger.java 61.19% <21.42%> (-7.86%) 21 <0> (-1)
...tyasha/github/integration/branch/GitHubBranch.java 33.33% <0%> (-6.67%) 1% <0%> (-1%)
...integration/branch/webhook/GHBranchSubscriber.java 27.9% <0%> (-4.66%) 3% <0%> (-2%)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ba07740...1a29813. Read the comment docs.

codecov-io avatar Nov 29 '17 05:11 codecov-io

Found related issue https://issues.jenkins-ci.org/browse/JENKINS-40606

KostyaSha avatar Nov 30 '17 18:11 KostyaSha

i changed locally...

KostyaSha avatar Nov 30 '17 21:11 KostyaSha

#248 I think event arguments can't handle verification... they need know branchName...

KostyaSha avatar Nov 30 '17 21:11 KostyaSha

Im stuck I don't understand the build failure ...

https://travis-ci.org/KostyaSha/github-integration-plugin/builds/309844133?utm_source=github_status&utm_medium=notification ->>>

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project github-pullrequest: Compilation failure [ERROR] /home/travis/build/KostyaSha/github-integration-plugin/github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/GitHubBranchTrigger.java:[236,60] cannot find symbol [ERROR] symbol: variable branch [ERROR] location: class com.github.kostyasha.github.integration.branch.GitHubBranchTrigger

but when I look at the code I don't see how it's undefined ... :( Line 236 is within a method that clearly identifies the variable "branch" on the method signature :

private List<GitHubBranchCause> readyToBuildCauses(GitHubBranchRepository localRepository,
                                                   LoggingTaskListenerWrapper listener,
                                                   @Nullable String branch) {

ghost avatar Dec 01 '17 04:12 ghost

oops ... i synce with the fork ... and now I see it ...

ghost avatar Dec 01 '17 05:12 ghost

master has bit refactored code, it should help to handle delete case. Master contains skeleton of multibranch implementation. Unfortuantely multibranch (scm-api & branch-api) can't support delete events, has conflict on FS when branch name matches to pr-xxx name. New multibranch API is broken by design....

KostyaSha avatar Jun 07 '18 15:06 KostyaSha

Arriving late to the party... This plugin works well when branches are created (I'm using cron polling not webhook), but not detecting deleted branches is a hindrance for my use case, automated creation and destruction of staging server instances. For this reason, I need to manually stop and remove containers. As soon as you have a preliminary fix let me know to give it a try. Thanks.

andreldm avatar Jul 12 '18 13:07 andreldm