-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Jobs should allow to set branch #1622
Comments
There is one filed to override the branch in a Job but it is only used internally (to be honest I don't remember why we exclude it from the API), we use that field a lot when using the CLI driven workflow, we also use it with the VCS webhooks because you can have like multiple branches
The API docs need to be update if you want to get the latest spec you can do a GET to |
For speculative plan at least when using github and using the workspace webhook you can define the branch name using a regex expression like The above will trigger a plan for any with feat or fix and when using the main branch you could put "Plan and Apply" like And you could see the checks in github when creating a PR There was a discussion about that here https://terrakubeworkspace.slack.com/archives/C06JW2A4MH9/p1733411772269669 |
Regarding webhooks:
Regarding the discussion: I don't have access to that Slack workspace. Where could I get an invitation? Regarding the API docs, thank you for the advice. I was able to check it this time following what you said. However, I was expecting to find there an unauthenticated Swagger endpoint already displaying it, which I believe could be very useful. |
The invitation link is inside the README @juan-vg |
Regarding the override branch, it was introduced at #644 and it was already excluded. terrakube/api/src/main/java/org/terrakube/api/plugin/state/RemoteTfeService.java Lines 697 to 701 in fe028bf
(which, again, I honestly don't really understand the logic behind) |
To add it to the API we just need to remove the following line
|
@alfespa17 PR opened (#1635) |
Hi @juan-vg ! If you would like a tip we ran into the same issue at our company where one webhook is created for each workspace. Knowing that a single repo has a limitation of 20 webhooks it is not scalable. To work around this issue we made a homemade lambda that triggers and run speculative plans on correct project when their terraform is modified. We manage the different steps like terraform plan running, terraform plan finished or terraform plan failed etc.. through Github check runs that we update depending on where we are in the execution. But yeah ! Agreed if terrakube could propose that feature natively it would be awesome ! |
Feature description 💡
When creating a new Job for a workspace, apart from
templateReference
and theworkspace ID
, it would be so useful to be able to set also the VCS branch to run the job on. This will allow PR speculative plans (and many other possibilities, I believe) to ensure the code that will ―eventually― end up in master branch, is working properly.This branch provided to the Job must only be used for that job. I mean, the default branch configured for the workspace must not be changed. This will allow several runs (plans) on different branches in parallel, while still allowing the default branch to be planned and applied. This implies that applies must only run on the default branch, and also that if a different branch is provided, apply should not be an option (or the other way round: branch can only be provided if plan only).
This must be implemented for both UI and API
Anything else?
I believe the API docs for the jobs endpoint is not properly documented (at least the POST method) regarding the body attributes. As an example,
templateReference
is only mentioned at the top-level example.The text was updated successfully, but these errors were encountered: