Skip to content

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

Open
@nitrocode

Description

@nitrocode

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaledocsDocumentationfeatureNew functionality/enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions