-
Notifications
You must be signed in to change notification settings - Fork 4
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
Is it possible to support more events for workspace hooks ? #83
Comments
It will allow you to create more web hooks but it only works for push events |
Do you think it would be technically feasible to add a handler for PR and open PR for instance ? |
It will require some work and research for that type of event maye in the future that feature can be added |
I'd like to help as our company really need this but I uncomfortable to test on Terrakube repo. Building images using maven is a bit complicated :/ |
Or maybe a workaround is to use the workspace webhook with PUSH on any branch ? So that when a PR is updated AKA a push is made on the branch of the PR, it triggers a run ? |
Not sure why you are saying building images is complicated it only require one command |
Do you know if the branch parameter of the workspace_webhook of the terrakube provider is working with regex ? For instance setting the branch as * would trigger for any branch ? |
You can use it like this, and it will check if the name of the branch starts with those values Here is the method that validates the branch name |
Thanks I'll try to mix up a solution with that ! |
hmm, interesting, I am also thinking of enhancing the PR-based runs and happened to see this. I did some reading previously, and we will need to register pull-request events, I think |
Hey @stanleyz ! Adding new type of events seemed to be a bit tricky to implement to me, so instead I think I can achieve what I need by enhancing the branch matching to support wildcards * and be able to exclude some branches. For instance ["*", "!master"] would trigger the work for all branches except master. This can be useful as we want to run speculative plans on branch that are not the default branch and run apply when we merge. Btw this brings me to two questions that I've got. I've been trying to add webhooks to a workspace and I got an issue while trying to create it with the resource.
Also, I'm wondering if it is possible to attach several Thanks ! |
Update on the issue ! Actually I had this error because I was trying to have the webhook to a CLI workspace ! Secondly, It is possible to have several webhooks for a single workspace however, the UI will only display one of them ! Maybe there is something to do about this ? |
Yes, it has to be VCS workspace and the VCS app need
Currently only PUSH events are listened in Terrakube, if you are not actively working on PR event, I'll take a look in the next one or two weeks depending on my workload :) |
You can achieve this with the new 2.24.0-beta version by setting PLAN template for webhook and PLAN/APPLY template on the workspace default branch, related code below: |
Yep I figured it out yesterday while testing ahah, thanks ! |
@stanleyz Do you know if there could be a way to retrieve on PRs the run that has been triggered on Terrakube and display a link to the job on the current PR ? |
Yes, I have added some information to your PR, you need to update the |
thanks @stanleyz I updated the PR in consequence ! :) |
There is one thing that you need to keep in mind, there is a limit restriction in github you can have up to 20 webhooks inside a repository and Terrakube creates one webhook for every workspace so in theory you can have up to 20 workspaces inside a git repo By the way I never tested adding multiple webhooks for a single workspace so I have no idea if that should work There is an open issue about that to have only 1 webhook:
|
Hi @alfespa17 ! Thanks for you return ! I tried to create severals webhooks and it did actually works but in a weird way ! The UI was only displaying one webhook but on github there was 2 webhooks created ! |
It is a really good refactor and it will require a lot of time to change the logic in several places while keeping the code compatible with previous releases it is not a simple change.
|
Yep i didn't mean we simply need tochange the workspace_id to workspace_ids ahah 😂 It was just an idea to start the implementation. I do agree that without that feature it is difficult to use the VCS feature in production environment as we're very limited in workspace number :/ |
Is it planned to be changed in future release ? |
In the future it will change but there is no target date for that |
Hi !
I've been looking to the possibility to implement the trigger of speculative plans when a PR is opened. I've been checking at the provider code and I see an interesting resource here. The issue is that it triggers only when a PUSH is performed on the branch. My idea is that we could add a new trigger event, for instance Open PR and trigger the webhook following that event.
I wonder if this seem doable to you or if there are any blocking points ? If you say it's possible with the current state of the API i could take a look at it.
Regards !
The text was updated successfully, but these errors were encountered: