* fix(deps): update module github.com/petergtz/pegomock/v3 to v4 in go.mod
* remove pegomock generate m option, which is not support after v4
* make regen-mocks
* replace pegomock v4 primitive eq/matchers
* convert pegomock v4 Eq/Any matchers
* remove custom models.Repo matcher
* pegomock v4 cannot use result method args
ref https://github.com/petergtz/pegomock/issues/123
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* whitespace fixes
* Only re-clone on upstream updates just before planning
When using the merge checkout strategy, we would peviously
re-clone on upstream updates on any call to Clone(), for example
when running workflow hooks or runing import commands.
If we had already ran a plan, and master was updated, this
would delete the plan and apply would not have anything to
apply.
Modified to only re-clone on upstream updates in doPlan()
* Apply suggestions from code review
---------
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* Capture stats in plan changes regexp
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
* Add PlanSuccessStats model to hold plan stats
This will be useful to pass down to the templates to include
additional information when formatting the messages emitted by Atlantis.
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
* Return stats for a PlanSuccess
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
* Add plan success stats to template data
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
* Refactor plan success template data creation
DRY. Also highlights a bug where the stats should be a field in
planSuccessData in order to be accessible from the templates.
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
* Move plan stats to planSuccessData struct
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
---------
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* feat: when using order group, abort plan/apply if any fail
* feat: add 'abort_on_execution_order_fail' flag on repo level
* feat: use runProjectCmdsParallelGroups in version_command_runner
* chore: add plan tests
---------
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* fix: Previous implementation tried to do comment parsing inside github, and only worked for 'atlantis' command.
This commit improves on that to make it possible to implement reactions in other VCS providers and also reuse the existing comment parsing.
* test: Add negative test to confirm reactions are not added for invalid comments
* test: Add a negative test to confirm invalid commands do not get a reaction
* Basic case insensitive for pr comments.
* Add test for uppercase/lowercase case.
* Merge test functions that check similar behaviors.
---------
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
* feat: Basic implementation of github reactions on PRs
Adds eyes whenever it detects an `atlantis` command.
* feat: Make the emoji reaction configurable
* tests: Add a mocked test for EmojiReaction being called in github
* ci: Disable revive linter for stubs
Reverts "fix(github): branch protection not supported (#3276)"
Reverts "fix: allow Require Linear History when selecting merge method (#3211)"
Closes#3320
* Modify the automere commit message to include the PR number [DEVOPS-674]
* Update server/events/vcs/common/common.go
Co-authored-by: Ken Kaizu <k.kaizu38@gmail.com>
* added test for PR message func [DEVOPS-674]
---------
Co-authored-by: Ken Kaizu <k.kaizu38@gmail.com>
* merge again if base branch has been updated
The current "merge" checkout strategy is unsafe. It merges the PR and the base
branch without holding the directory lock(s), so there is a potentially
very long window where another PR can be applied and be unexpectedly reverted
later.
This happens occasionally if a PR causes plans in multiple directories, but
is almost _guaranteed_ to happen if the initial plan has to wait until a
lock is freed up and a manual "atlantis plan" command is given.
Instead of printing a warning when this happens, we now merge again
if necessary while holding the lock. Plans are then guaranteed to only
be made when merged with the base branch for each directory being planned,
and applying later should be safe even if the base branch sees further
updates.
This fixes/affects #804, #867, #979
* Remove diverged test that no longer applies
* Reinstate TestClone_MasterHasDiverged test and make it pass
* Extend TestClone_MasterHasDiverged to test new merging functionality
We now verify that the first Clone with CheckoutMerge=true with
a diverged base branch atually clones and merges again.
---------
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
The tests would mutate $HOME/.gitconfig and $HOME/.git-credentials.
Set the HOME environment variable to a suitable temporary
directory before running git commands that mutate the global config.
Fixes#2604