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

Run Atlantis plan in directories modified by pre workflow run #2693

Open
nitrocode opened this issue Nov 18, 2022 Discussed in #2690 · 0 comments
Open

Run Atlantis plan in directories modified by pre workflow run #2693

nitrocode opened this issue Nov 18, 2022 Discussed in #2690 · 0 comments
Labels
docs Documentation feature New functionality/enhancement Stale

Comments

@nitrocode
Copy link
Member

nitrocode commented Nov 18, 2022

Discussed in #2690

Related to #2538

Currently Atlantis finds changes in files that were committed to the PR.

Here is an example in the github vcs client.

func (g *GithubClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error) {
var files []string
nextPage := 0
listloop:
for {
opts := github.ListOptions{
PerPage: 300,
}
if nextPage != 0 {
opts.Page = nextPage
}
// GitHub has started to return 404's sometimes. They've got some
// eventual consistency issues going on so we're just going to attempt
// up to 5 times for each page with exponential backoff.
maxAttempts := 5
attemptDelay := 0 * time.Second

func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context, commentFlags []string, verbose bool) ([]command.ProjectContext, error) {
// We'll need the list of modified files.
modifiedFiles, err := p.VCSClient.GetModifiedFiles(ctx.Pull.BaseRepo, ctx.Pull)

It would be nice to use a pre_workflow_run to modify terraform in other directories and have Atlantis pick it up automatically.

We could do this by using the native git client. We already have context of the prs base repo and base branch and pr branch. Once we run the pre workflow run, we should not hit the vcs api and instead just run the following.

git diff --name-only SHA1 SHA2
@nitrocode nitrocode added the feature New functionality/enhancement label Nov 20, 2022
@nitrocode nitrocode added the docs Documentation label Nov 24, 2022
@dosubot dosubot bot added the Stale label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation feature New functionality/enhancement Stale
Projects
None yet
Development

No branches or pull requests

1 participant