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

Runatlantis master #9

Merged
merged 57 commits into from
Jun 22, 2022
Merged

Runatlantis master #9

merged 57 commits into from
Jun 22, 2022

Conversation

yoonsio
Copy link
Owner

@yoonsio yoonsio commented Jun 22, 2022

Runatlantis master

chenrui333 and others added 30 commits April 8, 2022 13:03
* release: add pre-release flow

* update image creation flow

Signed-off-by: Rui Chen <rui@chenrui.dev>
…ntis#2044)

fix: only fetch "pull/$PR_NUMBER/head" when githubAppEnabled
* fix: add path to WorkingDir methods

`WorkingDirLocker` and `WorkingDir` are closely related -- the former acquires a lock, which ensures that the latter can safely operate on a given file path.

In runatlantis#2131 we added `path` to the `WorkingDirLocker` lock key, but neglected to add the same to `WorkingDir`.

This commit adds `path` as an argument to certain `WorkingDir` methods, and includes `path` in the directory that we use to clone the repository for a given project.

Since `path` can include certain special characters such as `/`, we encode `path` as base32 when using it as part of a file path. This should ensure no special characters are used in the filesystem, and that the value can be decoded if desired (unlike hashes such as md5).

Additional changes:

- All calls to changed methods have been updated, including unit tests
- Mocks have been regenerated for `WorkingDir` and `WorkingDirLocker`
- `working_dir_test.go`
  - Commands that operate on filesystem paths have been updated to include the base32 encoded `path` value
  - When running `git init`, we include `-b master` as additional arguments, to ensure that `master` is our default branch (expected by the unit tests)

* Try fixing E2E tests

* Fix DefaultPendingPlanFinder

In addition to iterating over `workspaceDirs`, also iterate over `pathDirs`, and use both `workspace` and `path` to build `repoDir`.

* Fix DefaultPendingPlanFinder unit tests

* Fix DefaultProjectCommandBuilder unit tests

Co-authored-by: Kevin Snyder <kevinsnyder@KevinSnydersMBP.lan>
Co-authored-by: Kevin Snyder <kevinsnyder@ip-192-168-1-188.ec2.internal>
Bumps [actions/stale](https://github.com/actions/stale) from 4 to 5.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](actions/stale@v4...v5)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…lantis#2206)

Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.10.1 to 1.11.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](spf13/viper@v1.10.1...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…natlantis#2227)

* links(github): replace help.github.com with docs.github.com links

* fix another link

Signed-off-by: Rui Chen <rui@chenrui.dev>
* Update main.go

* updating helm release
)

Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](docker/setup-qemu-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 2.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 3.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](docker/build-push-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…antis#2247)

Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.22.5 to 1.22.9.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](urfave/cli@v1.22.5...v1.22.9)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Report an error during `docker build` if `TARGETPLATFORM` has an unexpected
value.
Bumps runatlantis/atlantis-base from 2022.03.04 to 2022.04.19.

---
updated-dependencies:
- dependency-name: runatlantis/atlantis-base
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* deps: tf 1.1.9

Signed-off-by: Rui Chen <rui@chenrui.dev>

* deps: conftest 0.31.0

Signed-off-by: Rui Chen <rui@chenrui.dev>

* update applications link ref
…#2175)

Co-authored-by: Jörg Herzinger <joerg.herzinger@bytesource.net>
…#2249)

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* MultiEnv step added

* Values removed from the output

* Fixing tests

* multienv_step_runner_test added

* Documentation of new feature added

* Documentatation of new feature  modified

* multienv_step test file extension changed

* Fixed multinev_step_runner test

* Enhanced debug logging in multienv_step_runner

* Enhanced errorhandling

* Test command modified

* Test command modified

* Test command modified

* Test command modified

* Errorhandling modified

* Test command modified

* Test command modified

* Create empty map in test

* Fixing test ExpOut

* Testing, refactoring, eliminating extra debug log

* MultiEnv result modified from json to plain string

* MultiEnv step Run parameter updated

* Import added

* project_command_runner updated

* project_command_runner updated

* multienv_step_runner_test updated

* multienv doc modified

* Update runatlantis.io/docs/custom-workflows.md

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>

Co-authored-by: Istvan Tapaszto <istvan.tapaszto@msci.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Bumps runatlantis/atlantis-base from 2022.04.19 to 2022.05.13.

---
updated-dependencies:
- dependency-name: runatlantis/atlantis-base
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ntis#2137)

* fix: update commit status check logic to match the commit status name

* Update server/events/vcs/gitlab_client.go

chore: simplify ignored statuses logic

Co-authored-by: Emil 'Skeen' Madsen <sovende@gmail.com>

* feat(gitlab_client_test): add PullIsMergeable test case

Co-authored-by: Emil 'Skeen' Madsen <sovende@gmail.com>
Currently this is failing on PRs

```
server/events/vcs/gitlab_client_test.go:301:14: Error return value of `w.Write` is not checked (errcheck)
                                                w.Write([]byte(response))
```
ascandella and others added 27 commits May 17, 2022 10:55
)

This fixes the tests to not rely in the implicit value of the
"defaultBranch" git configuration value, since they later assume that
it's "master".

For example, if you run:

```sh
git config --global init.defaultBranch main
```

And then run these tests, you get:

```sh
--- FAIL: TestClone_CheckoutMergeNoneExisting (0.68s)
    working_dir_test.go:71: err running "git checkout master": error:
    pathspec 'master' did not match any file(s) known to git

    --- FAIL: TestClone_CheckoutMergeNoReclone (0.68s)
        working_dir_test.go:127: err running "git checkout master":
        error: pathspec 'master' did not match any file(s) known to git

        --- FAIL: TestClone_CheckoutMergeNoRecloneFastForward (0.68s)
            logger.go:130: 2022-05-17T10:05:33.665-0700 INFO    creating
            dir "/tmp/3762936464/repos/0/default"
                working_dir_test.go:198: unexpected error: running git
                clone --branch master --single-branch
                file:///tmp/3657236513 /tmp/3762936464/repos/0/default:
                Cloning into '/tmp/3762936464/repos/0/default'...
                        warning: Could not find remote branch master to
                        clone.
                                fatal: Remote branch master not found in
                                upstream origin
                                        : exit status 128
                                        --- FAIL:
                                        TestClone_CheckoutMergeConflict
                                        (0.68s)
      working_dir_test.go:232: err running "git checkout master": error:
      pathspec 'master' did not match any file(s) known to git

      --- FAIL: TestClone_MasterHasDiverged (0.68s)
          working_dir_test.go:344: err running "git clone --branch
          master --single-branch /tmp/1931262087 .": Cloning into '.'...
                  warning: Could not find remote branch master to clone.
                          fatal: Remote branch master not found in
                          upstream origin

                          --- FAIL: TestHasDiverged_MasterHasDiverged
(0.68s)
      working_dir_test.go:415: err running "git clone --branch master
      --single-branch /tmp/2356723317 .": Cloning into '.'...
              warning: Could not find remote branch master to clone.
                      fatal: Remote branch master not found in upstream
                      origin

                      FAIL
                      FAIL
                      github.com/runatlantis/atlantis/server/events
                      7.269s
                      FAIL
```
Currently the link goes to "" on my install, which browsers interpret as
the current page. Looking at the other templates in this file, it was
missing a trailing `/`.
* deps: terraform 1.2.0

* support tf 1.1.9
…is#2276)

Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 2 to 3.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](goreleaser/goreleaser-action@v2...v3)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This allows forks of atlantis to push images to their own ghcr.
* Replace golang-ci install path

Noticed builds failing to download this script. Docs are updated with a new install path direct from GitHub - https://golangci-lint.run/usage/install/#other-ci

* Workaround bot protection on docs.github.com

There seems to be bot protection on docs.github.com which can be bypassed by requesting compressed content - github/docs#17358 (comment)
* Add version to /status endpoint

* Add version to test

* Fix linting errors
…lantis#2283)

Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](spf13/viper@v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…which fixes 1624 (runatlantis#1704)

* Delete previous plans on autoplan or atlantis plan

When using non-default workspaces, plans are stored
in pr-and-workspace-specific directories.
If a PR is subsequently updated it might happen that
some of the plans are no longer relevant with regards
to the latest changes.
This change ensures that plans are always deleted
when a generic plan is triggered either by autoplan
or by a "atlantis plan" command.
NB Plans are not cleaned up when specific projects are
planned explicitly with "atlantis plan -p/-d/-w".

* Use DeleteLockCommand to delete locks and workdirs
containing previous plans

Co-authored-by: giuli007 <giuglioz@gmail.com>
…2311)

* [fix] Ignore commit checks for atlantis apply on Github

* Fix typo

* Fmt

* lint
…runatlantis#2275)

Bumps [github.com/hashicorp/go-version](https://github.com/hashicorp/go-version) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/hashicorp/go-version/releases)
- [Changelog](https://github.com/hashicorp/go-version/blob/main/CHANGELOG.md)
- [Commits](hashicorp/go-version@v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-version
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…runatlantis#2321)

Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.5.11 to 1.6.2.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](hashicorp/go-getter@v1.5.11...v1.6.2)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Hello, I was reading through these docs and this section seemed incorrect. I assume the 2 commands it supports are atlantis plan/apply and not the underlying 3 terraform commands. Let me know if I'm misinterpreting this. Thanks!

Co-authored-by: Rui Chen <rui@chenrui.dev>
…unatlantis#2319)

Bumps [github.com/xanzy/go-gitlab](https://github.com/xanzy/go-gitlab) from 0.59.0 to 0.68.0.
- [Release notes](https://github.com/xanzy/go-gitlab/releases)
- [Changelog](https://github.com/xanzy/go-gitlab/blob/master/releases_test.go)
- [Commits](xanzy/go-gitlab@v0.59.0...v0.68.0)

---
updated-dependencies:
- dependency-name: github.com/xanzy/go-gitlab
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
…is#2312)

* feat: add userConfig.VCSStatusName to applyCommandRunner context

* fix: use vcsstatusname from context

* chore: normalize tests

* chore: update interface mock
…natlantis#2320)

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.1 to 1.7.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.7.1...v1.7.2)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
…ntis#2318)

error message:
```
- Finding hashicorp/null versions matching "3.0.0"...
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/null v3.0.0 does not have a package
│ available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers
│ are available for all platforms. Other versions of this provider may have
│ different platforms supported.
```

Signed-off-by: Rui Chen <rui@chenrui.dev>
* deps: terraform 1.2.3

Signed-off-by: Rui Chen <rui@chenrui.dev>

* deps: conftest 0.32.1

Signed-off-by: Rui Chen <rui@chenrui.dev>
Fixes runatlantis#2322 
See another PR (in helm-charts repo) that enables use of fsGroupChangePolicy instead.
* Start threading job output to RunStepRunner

* Strip ANSI

* Fix lint

* Use waitgroup to avoid test flakiness

* Move waitgroup higher

* Add ANSI test and use strings.Builder

* Fix lint

* Use errors.Wrap per style guide

* Create ShellCommandRunner to encapsulate streaming

* WIP: shell command runner

* Update signatures to propagate error finding version

* Fix log output

* Fix error checking

* Fix accidental whitespace stripping

* Remove unused struct field

* Fix error checking in terraform client

* Add unit tests to verify command output handler was called

* Remove err from async interface

* Remove duplicative log now that shell command runner does it

* Hide output in stream for env/multienv

* Add comment explaining goroutines

* Use printf for better macOS compatibility
@yoonsio yoonsio merged commit 6c0c60a into master Jun 22, 2022
@yoonsio yoonsio deleted the runatlantis-master branch June 22, 2022 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet