Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stash): first push not triggering postsubmits in lighthouse #385

Conversation

helmlover
Copy link

@helmlover helmlover commented May 3, 2023

Problem

You configure a postsubmit for a given branch and expect lighthouse to execute a pipeline for you.

However, for bitbucket (stash implementations) this does not work for the first push event of a branch.

That is because the first push event (unless subsequent ones, which get classified as push event) got classified as branch event.

However, branch events are not implemented by lighthouse, and therefore get ignored:

func (s *Server) handleBranchEvent(entry *logrus.Entry, hook *scm.BranchHook) {
	// TODO
}

Solution

The problem, gets fixed by this PR, which classifies the first branch push event also as push event, which can be well processed by ligththouse.

@jenkins-x-bot
Copy link

Hi @helmlover. Thanks for your PR.

I'm waiting for a jenkins-x member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the jenkins-x/lighthouse repository.

@helmlover
Copy link
Author

/assign @babadofar

@akselfilipovic
Copy link

Since Atlassian decided to not support the Server Version of BitBucket Server (https://www.atlassian.com/migration/assess/journey-to-cloud ), I believe that this is the last chance for this fix. Since Server will not change any more in my opinion this is the only way to make this working safely.
Thanks @helmlover for this PR.

@garethjevans
Copy link
Member

@helmlover would you be able to rebase this one to avoid the merge conflicts?

@gerrnot gerrnot force-pushed the fix/stash/first-branch-push-event-triggers-no-build branch from 19adce0 to 9af00ef Compare June 12, 2023 12:55
@helmlover
Copy link
Author

@garethjevans updated

@garethjevans
Copy link
Member

/ok-to-test

@helmlover
Copy link
Author

/test lint

@helmlover
Copy link
Author

@garethjevans Thx for the ok-to-test label!

However, linting seems to fail and I get a basic auth screen when opening the url.

Could you just tell if there is anything I can do about it?

@helmlover helmlover changed the title Fix/stash/first branch push event triggers no build fix(stash): first push not triggering postsubmits in lighthouse Jun 13, 2023
@gerrnot
Copy link

gerrnot commented Aug 7, 2023

/test lint

@helmlover
Copy link
Author

/assign @garethjevans

@gerrnot gerrnot force-pushed the fix/stash/first-branch-push-event-triggers-no-build branch 3 times, most recently from 10271d1 to 3315f95 Compare December 20, 2023 09:15
@gerrnot
Copy link

gerrnot commented Dec 20, 2023

Just rebased this PR, but still cannot access (see) the lint job failures. Would be glad if somebody with permissions could help out here.

@msvticket
Copy link
Member

/retest

@msvticket
Copy link
Member

The pr pipeline is failing with:

 		go: updates to go.mod needed; to update it:
			go mod tidy

Do rebase the PR on main, run go mod tidy and push. I think the the lint pipeline fails for the same reason. The error message is not very helpful...

@msvticket msvticket self-assigned this Jan 22, 2024
@gerrnot gerrnot force-pushed the fix/stash/first-branch-push-event-triggers-no-build branch 2 times, most recently from 3f5ca6c to 474efbe Compare January 22, 2024 12:31
@msvticket
Copy link
Member

The default pipelines doesn't support go 1.21. So the easiest route for you is to let the go version stay at 1.19 for now.

@gerrnot gerrnot force-pushed the fix/stash/first-branch-push-event-triggers-no-build branch 2 times, most recently from 5bbfc6a to 405c2b3 Compare January 22, 2024 12:52
@gerrnot gerrnot force-pushed the fix/stash/first-branch-push-event-triggers-no-build branch 2 times, most recently from e74d59a to 4dab220 Compare January 22, 2024 13:03
… on bitbucket server)

* treats branch ADD event as push event
  -> the ADD event is almost identical to the UPDATE event which already get classified as push event
* lighthouse currently does not handle branch events (only push events) - for any provider:
  ```
  func (s *Server) handleBranchEvent(entry *logrus.Entry, hook *scm.BranchHook) {
  	// TODO
  }
  ```
@gerrnot gerrnot force-pushed the fix/stash/first-branch-push-event-triggers-no-build branch from 4dab220 to cba2298 Compare January 22, 2024 13:31
@gerrnot
Copy link

gerrnot commented Jan 22, 2024

@msvticket

Figured out that the linting could be triggered locally as well (make lint), so I could read the output, the output of which got me to the solution:
https://stackoverflow.com/questions/59960394/file-is-not-goimports-ed-with-local-somepath

@jenkins-x-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: msvticket

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jenkins-x-bot jenkins-x-bot merged commit 2999198 into jenkins-x:main Jan 22, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants