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

Add gitea push hook #1227

Merged
merged 2 commits into from
Jul 9, 2024
Merged

Conversation

SuperSandro2000
Copy link
Member

The gitea webhook payload is slightly different and not compatible with the github endpoint. This PR adds a new api endpoint /api/push-gitea which understands the gitea webhook to trigger jobsets evaluation.

Copy link
Contributor

@DarkKirb DarkKirb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR works for me, but it would be nice if push_gitea removed the .git suffix from the repo URL, because I haven’t included them in my gitea flake inputs

src/lib/Hydra/Controller/API.pm Show resolved Hide resolved
@ratsclub
Copy link
Member

Hello, is this a work in progress? I wanted to use this feature on my Gitea instance and if needed, test it.

@SuperSandro2000
Copy link
Member Author

This PR is done and deployed in production.

@DarkKirb
Copy link
Contributor

DarkKirb commented Oct 11, 2022 via email

@CyborgPotato
Copy link

Can confirm that this PR works in my deployment as well 👍

@RTUnreal
Copy link

RTUnreal commented Apr 4, 2023

is there a update when this will be upstreamed? Or will this PR be a patch user need to always apply?

@icewind1991
Copy link

I had to modify it to strip the https:// prefix from the url to make it work with git+ssh job sources but works fine otherwise

@SuperSandro2000
Copy link
Member Author

@icewind1991 can you make a suggestion with that change? Then i'll add it.

@Ericson2314 could you review/merge this?


my $in = $c->request->{data};
my $url = $in->{repository}->{clone_url} or die;
$url =~ s/.git$//;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$url =~ s/.git$//;
$url =~ s/.git$//;
$url =~ s/^https?:\/\///;

Disclaimer: this is probably the 10th or so line of perl I've ever written 🙈

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can follow-up for this part.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icewind1991 how did you apply your change? Do you use a custom fork of hydra?

@Ericson2314 Ericson2314 closed this Jul 9, 2024
@Ericson2314 Ericson2314 reopened this Jul 9, 2024
@Ericson2314 Ericson2314 enabled auto-merge July 9, 2024 18:25
@Ericson2314 Ericson2314 merged commit d798622 into NixOS:master Jul 9, 2024
1 check passed
@SuperSandro2000 SuperSandro2000 deleted the gitea-push-hook branch July 10, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants