Skip to content

Warn user when pull request events are not enabled #9176

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

Closed
agjohnson opened this issue May 9, 2022 · 4 comments · Fixed by #9291
Closed

Warn user when pull request events are not enabled #9176

agjohnson opened this issue May 9, 2022 · 4 comments · Fixed by #9291
Assignees
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required

Comments

@agjohnson
Copy link
Contributor

The most common support issues I've found with pull request builds are projects that enable the pull request feature and still doesn't get pull request builds. The most common reason for this is that the project web hook does not have Pull requests event enabled on the webhook (for GitHub repositories at least). We store the webhook events enabled, so it seems we have everything to determine:

  • Project has a working webhook to GitHub -- pick the first working integration?
  • Project webhook has GitHub pull_request event -- stored in JSON blob return from VCS provider

Is this enough to reliably detect when the webhook is not configuring correctly? This would make things much more obvious to users when these builds aren't working correctly.

This could be a warning notification, or could even block the UI from enabling the pull request build feature. Which pattern makes the most sense?

@agjohnson agjohnson added Improvement Minor improvement to code Needed: design decision A core team decision is required labels May 9, 2022
agjohnson added a commit that referenced this issue May 9, 2022
I keep helping users with the support request around webhooks missing
the pull request event, so wanted to clarify a bit here. I also took the
opportunity to add some clearer language to the rest of the page, and
resturcture a few things to improve the information flow.

I also opened #9176 to deal with this in a programmatic way, but figured
we could at least communicate the issue better for now.
@humitos
Copy link
Member

humitos commented May 10, 2022

Is this enough to reliably detect when the webhook is not configuring correctly?

I think it's enough, yes. We have that information in integrations.models.Integration.provider_data:

provider_data = models.JSONField(
_('Provider data'),
null=True,
blank=True,
)

This could be a warning notification, or could even block the UI from enabling the pull request build feature. Which pattern makes the most sense?

I think graying out the UI with clear instructions about how to fix the problem makes more sense to me.

@agjohnson
Copy link
Contributor Author

Disabling the field would definitely be preferable UX, but I'm happy to start small here too, and perhaps firm up the UX in the application template rework.

I suppose we can conditionally alter the form before passing it off to the templates -- if so, disabling the field would be a good option. If we have to do this in templates, that's less than ideal.

@humitos
Copy link
Member

humitos commented May 11, 2022

This is the query we need to validate the form before presenting it to the user.

In [13]: Integration.objects.filter(
    ...:     project__slug="test-builds",
    ...:     integration_type__in=["github_webhook"],
    ...:     provider_data__events__contains="pull_request",
    ...: ).exists()
Out[13]: True

We need a similar query for GitLab where the provider_data structure is different

It seems a simple change in logic that we can tackle soon. The most important part to me is to make the message clear to the user so they can solve the problem by themselves. I'm adding it to the roadmap so we can prioritize it soon.

@humitos humitos moved this to Planned in 📍Roadmap May 11, 2022
@agjohnson
Copy link
Contributor Author

I'll bump this up to our Q2 list, pull request builds are a good place to focus our energy.

agjohnson added a commit that referenced this issue May 11, 2022
* Spruce up docs on pull request builds

I keep helping users with the support request around webhooks missing
the pull request event, so wanted to clarify a bit here. I also took the
opportunity to add some clearer language to the rest of the page, and
resturcture a few things to improve the information flow.

I also opened #9176 to deal with this in a programmatic way, but figured
we could at least communicate the issue better for now.

* Update docs/user/pull-requests.rst

Co-authored-by: Santos Gallegos <[email protected]>

* Consolidate seealso blocks

Co-authored-by: Santos Gallegos <[email protected]>
@stsewd stsewd moved this from Planned to Needs review in 📍Roadmap Jun 2, 2022
Repository owner moved this from Needs review to Done in 📍Roadmap Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required
Projects
Archived in project
3 participants