From 30c46303822276f68a5f9b7a39d60e5541903ee6 Mon Sep 17 00:00:00 2001 From: Simon Heather <32168619+X-Guardian@users.noreply.github.com> Date: Tue, 5 Nov 2024 17:13:33 +0000 Subject: [PATCH 1/4] chore(docs): Fix formatting on provider-credentials.md (#5068) Signed-off-by: X-Guardian --- runatlantis.io/docs/provider-credentials.md | 1 + 1 file changed, 1 insertion(+) diff --git a/runatlantis.io/docs/provider-credentials.md b/runatlantis.io/docs/provider-credentials.md index 09dd289759..8dcddb7463 100644 --- a/runatlantis.io/docs/provider-credentials.md +++ b/runatlantis.io/docs/provider-credentials.md @@ -58,6 +58,7 @@ provider "aws" { ``` Atlantis runs `terraform` with the following variables: + | `-var` Argument | Description | |--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------| | `atlantis_user=lkysow` | The VCS username of who is running the plan command. | From ae972ad72a9032de33ea2a95d6c28def66e87756 Mon Sep 17 00:00:00 2001 From: Simon Heather <32168619+X-Guardian@users.noreply.github.com> Date: Tue, 5 Nov 2024 17:56:23 +0000 Subject: [PATCH 2/4] chore: Add User Agent to Website Link GitHub Check Muffet Step (#5069) Signed-off-by: X-Guardian --- .github/workflows/website.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 822384b82c..3ae90767a9 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -96,6 +96,7 @@ jobs: -e 'https://github.com/runatlantis/helm-charts#customization' \ -e 'https://github.com/sethvargo/atlantis-on-gke/blob/master/terraform/tls.tf#L64-L84' \ -e 'https://confluence.atlassian.com/*' \ + --header 'User-Agent: Muffet' \ --header 'Accept-Encoding:deflate, gzip' \ --buffer-size 8192 \ http://localhost:8080/ From c721f936f33b9174ff7ca642950420c5df4eefc6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:00:27 +0000 Subject: [PATCH 3/4] chore(deps): update davidanson/markdownlint-cli2-action action to v17 in .github/workflows/website.yml (main) (#4959) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 3ae90767a9..90bfea84ec 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -49,7 +49,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: markdown-lint - uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16 + uses: DavidAnson/markdownlint-cli2-action@db43aef879112c3119a410d69f66701e0d530809 # v17 with: config: .markdownlint.yaml globs: 'runatlantis.io/**/*.md' From 240b6b1a0b8f3b8dc7e3d6ef4b10bd0ced318b57 Mon Sep 17 00:00:00 2001 From: Henry Muru Paenga Date: Wed, 6 Nov 2024 11:17:01 +1300 Subject: [PATCH 4/4] fix: GitHub - Support Token File for Git Commands (#5067) Signed-off-by: Henry Muru Paenga --- server/events/event_parser.go | 23 +++++++++++++++++++++-- server/events/event_parser_test.go | 1 + server/server.go | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/server/events/event_parser.go b/server/events/event_parser.go index a6b4b363ac..5cbc029f48 100644 --- a/server/events/event_parser.go +++ b/server/events/event_parser.go @@ -17,6 +17,7 @@ import ( "encoding/json" "fmt" "net/url" + "os" "path" "strings" @@ -357,6 +358,7 @@ type EventParsing interface { type EventParser struct { GithubUser string GithubToken string + GithubTokenFile string GitlabUser string GitlabToken string GiteaUser string @@ -372,7 +374,15 @@ type EventParser struct { func (e *EventParser) ParseAPIPlanRequest(vcsHostType models.VCSHostType, repoFullName string, cloneURL string) (models.Repo, error) { switch vcsHostType { case models.Github: - return models.NewRepo(vcsHostType, repoFullName, cloneURL, e.GithubUser, e.GithubToken) + token := e.GithubToken + if e.GithubTokenFile != "" { + content, err := os.ReadFile(e.GithubTokenFile) + if err != nil { + return models.Repo{}, fmt.Errorf("failed reading github token file: %w", err) + } + token = string(content) + } + return models.NewRepo(vcsHostType, repoFullName, cloneURL, e.GithubUser, token) case models.Gitea: return models.NewRepo(vcsHostType, repoFullName, cloneURL, e.GiteaUser, e.GiteaToken) case models.Gitlab: @@ -626,7 +636,16 @@ func (e *EventParser) ParseGithubPull(logger logging.SimpleLogging, pull *github // returns a repo into the Atlantis model. // See EventParsing for return value docs. func (e *EventParser) ParseGithubRepo(ghRepo *github.Repository) (models.Repo, error) { - return models.NewRepo(models.Github, ghRepo.GetFullName(), ghRepo.GetCloneURL(), e.GithubUser, e.GithubToken) + token := e.GithubToken + if e.GithubTokenFile != "" { + content, err := os.ReadFile(e.GithubTokenFile) + if err != nil { + return models.Repo{}, fmt.Errorf("failed reading github token file: %w", err) + } + token = string(content) + } + + return models.NewRepo(models.Github, ghRepo.GetFullName(), ghRepo.GetCloneURL(), e.GithubUser, token) } // ParseGiteaRepo parses the response from the Gitea API endpoint that diff --git a/server/events/event_parser_test.go b/server/events/event_parser_test.go index fffe30e3eb..6350ea76ca 100644 --- a/server/events/event_parser_test.go +++ b/server/events/event_parser_test.go @@ -36,6 +36,7 @@ import ( var parser = events.EventParser{ GithubUser: "github-user", GithubToken: "github-token", + GithubTokenFile: "", GitlabUser: "gitlab-user", GitlabToken: "gitlab-token", AllowDraftPRs: false, diff --git a/server/server.go b/server/server.go index 39c5ae1bc7..056550a355 100644 --- a/server/server.go +++ b/server/server.go @@ -560,6 +560,7 @@ func NewServer(userConfig UserConfig, config Config) (*Server, error) { eventParser := &events.EventParser{ GithubUser: userConfig.GithubUser, GithubToken: userConfig.GithubToken, + GithubTokenFile: userConfig.GithubTokenFile, GitlabUser: userConfig.GitlabUser, GitlabToken: userConfig.GitlabToken, GiteaUser: userConfig.GiteaUser,