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

Support pre-workflow hooks on all comment/auto triggered commands. #43

Merged
merged 7 commits into from
Feb 4, 2021

Conversation

nishkrishnan
Copy link
Contributor

@nishkrishnan nishkrishnan commented Feb 3, 2021

For our usecase, having this on PR open/update is not good enough since atlantis unlock for example cleans up the directory and each comment command attempts to clone the directory. Since we are dynamically generating the atlantis.yaml this breaks integrations until a PR event occurs again.

TODO:

  • Still need to write some e2e tests for this

msarvar
msarvar previously approved these changes Feb 4, 2021
Copy link

@msarvar msarvar left a comment

Choose a reason for hiding this comment

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

lgtm couple minor comments.

autoPlanRunner := buildCommentCommandRunner(c, models.PlanCommand)
if autoPlanRunner == nil {
ctx.Log.Err("invalid autoplan command")
return
Copy link

Choose a reason for hiding this comment

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

Don't you want this? Otherwise go will panic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh i think this can be removed since we panic if we can't get it from the map in the function itself:

https://github.com/lyft/atlantis/blob/nish/0rca-665/server/events/command_runner.go#L84:L85

Copy link

Choose a reason for hiding this comment

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

Do we even need this check then?

WorkingDirLocker: workingDirLocker,
WorkingDir: workingDir,
Drainer: drainer,
PreWorkflowHookRunner: &runtime.PreWorkflowHookRunner{},
PreWorkflowHookRunner: runtime.DefaultPreWorkflowHookRunner{},
Copy link

Choose a reason for hiding this comment

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

Should this be a pointer object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My assumption was that you only need pointers if you have a need to reference the underlying data without copying it but this struct is stateless.

@nishkrishnan nishkrishnan merged commit 90c8af7 into release-v0.15.0-lyft.1 Feb 4, 2021
@nishkrishnan nishkrishnan deleted the nish/0rca-665 branch March 2, 2021 21:02
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.

2 participants