-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: add plan_requirements
capability
#2979
feat: add plan_requirements
capability
#2979
Conversation
@lyoung-confluent FYI plan_command_runner may need this impl too https://github.com/krrrr38/atlantis/blob/c6f59309ec5f635f942e519f698397e328cbdde1/server/events/import_command_runner.go#L31-L43 (ctx.PullRequestStatus is mutable value and it requires to be set by command runner now.) |
plan_requirements
capability
@@ -168,6 +171,15 @@ func (p *PlanCommandRunner) run(ctx *command.Context, cmd *CommentCommand) { | |||
baseRepo := ctx.Pull.BaseRepo | |||
pull := ctx.Pull | |||
|
|||
ctx.PullRequestStatus, err = p.pullReqStatusFetcher.FetchPullStatus(pull) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is addressing @krrrr38's comment. For this change we are checking approved and mergeability states during plan and those checks require ctx.PullRequestStatus to be populated. What I saw when testing this without these lines is that the plan was correctly blocked by the approval check, but it would never succeed as the approval status was not updated during a plan run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field is useful and we forget to fill-in. So ctx.PullRequestStatus
might be better to fill-in at the instance creation timing
atlantis/server/events/command_runner.go
Lines 150 to 158 in cb0aadf
ctx := &command.Context{ | |
User: user, | |
Log: log, | |
Scope: scope, | |
Pull: pull, | |
HeadRepo: headRepo, | |
PullStatus: status, | |
Trigger: command.AutoTrigger, | |
} |
But it requires apply_command_runer/import_command_runner change too, so I think it doesn't need it in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krrrr38 did your suggestion get implemented? can this comment be resolved? I assume it can since you posted "LGTM" 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above impl is optional in this PR and not need to do it in this PR, so resolved 👍
…nt/atlantis into plan_requirements
…nt/atlantis into plan_requirements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you @lyoung-confluent ! Your feature will be available in the Feel free to propose more changes! Thank you again |
what
plan_requirements
mirroring the existingapply_requirements
andimport_requirements
keys, but foratlantis plan
.why
tests
references