* 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".
* Also delete locks along with plans when running
autoplan or generic plan command
* Fix Plan deletion tests after 0.19.8 rebase
* Fix Plan deletion tests after v0.19.9-pre.20220912 rebase
* Rename struct field to follow camelCase naming convention
Co-authored-by: giuli007 <giuglioz@gmail.com>
* Fix multienv command
Correctly handles environment variable values that themselves contain "=" (e.g. AWS session tokens)
Ensures that trailing "\n" does not get published as part of the last environment variables value.
* Correct check for empty result in multienv
Check the length of the result string instead of splitting it first and checking the length of envvars (since split always returns an array of length 1)
Co-authored-by: Marc Hildenbrand <mwhildenbrand@gmail.com>
* Initial build out of redis backend
* Regenerate locking mocks and matchers
* More test cleanup
* More test fixes
* Added tests for redis
* Test fix
* Linting fix
* Dcos update
* Update redis.go
* Update server.go
* Adding nolint to RedisDB struct
* Make required apply work with mergeable
* Fix lint hint
* Migrate mergeable approval check to graphql, update tests
* Adding support for check suites
* Adding feature flag protection for new functionality
* Fix linting falsepos
* Adjusted logic to handle required check runs, added doc
* Update multienv_step_runner Env Var Parsing Logic
* Update multienv_step_runner.go to split only on the first = character
* Add affirmative and failing test cases
* Run gofmt
* 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
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>
* 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>
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 `/`.
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 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))
```
* 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>