* Add initial Gitea client structure
* Add various missing config flags
* initial gitea support added
* Fix some post-merge issues
* Replace HidePrevCommandComments by version from @florianbeisel
* Update mocks
* feat: add Webhook Signature Verification
This changes adds support for Gitea Webhook Signatures by wrapping the
function from the Gitea SDK and calling it from `handleGiteaPost()`.
* fix: use release version in go.mod
1.22 as in the previous go.mod is a development version. When referencing
a minimum release version the correct format is 1.22.0
* Set default Gitea url to cloud.gitea.com
* Fix and Add tests for Gitea
* Fix missing copyright header
* Changed comment to reflect no max comment length
Apparently there's no max comment length in Gitea at this point in time.
* Implement GetCloneURL()
* Decode Base64 before passing on downloaded file content
* Enable Gitea client as API Client
* Remove unneded comments
* Remove old redundant file
* fix: invalid version number in go.mod
* fix: remove unnecessary type conversions
* fix: removed unused function
* fix: remove unnecessary type conversion of decodedData
* fix: fixes some tests
* Correct gitea.com URL
* Add Gitea to website docs
* fix: TestPost_UnsupportedGiteaEvent
* revert version downgrades
* docs: add Gitea documentation to Guide section
* docs: fix copy paste mistake
* Update cmd/server_test.go
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* Clarify usage msg for --gitea-base-url
* Apply suggestions from code review
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* Turn ebreak number into const with comments
* Add --gitea-page-size server argument
Defaults to 30 based on https://docs.gitea.com/1.18/advanced/config-cheat-sheet#api-api
* Fix broken test
* Fix event parser and comment parser
* Add missing app permission to docs
* Make Gitea client conform to updated interface
* Update server/events/vcs/gitea/client.go
Co-authored-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com>
* Remove no longer needed logger
* Add extra logging statements for Gitea client
* Add debug statements
---------
Co-authored-by: Florian Beisel <florian@pacey.me>
Co-authored-by: Florian Beisel <florian@beisel.it>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com>
* Adding new flag everywhere relevant, implementing policy result workaround
* Fixing unit test str matching, adding custom policy conditional to step_runner
* Adding documentation steps for custom policy tools
* Refactoring ConftestOutput attribute to PolicyOutput
* Safer handling of merging with an updated upstream.
We used to call forceClone() to update with upstream, but this deletes the
checked out directory. This is inefficient, can delete existing plan files,
and is very surprising if you are working manually in the working directory.
We now fetch an updated upstream, and re-do the merge operation. This
leaves any working files intact.
* Rename SafeToReClone -> CheckForUpstreamChanges
It's never safe to clone again. But sometimes we need to check
for upstream changes to avoid reverting changes.
The flag is now used to know when we need to merge
again non-destructively with new changes.
* Update fixtures.go
* Add test to make sure plans are not wiped out
As long as the branch itself has not been updated, plans
should be kept. Even if upstream has changed.
* renamed HasDiverged to MergedAgain in PlanResult and from Clone()
This flag was only set to true in case a call to Clone()
ended up merging with an updated upstream, so the
new name better represents what it means.
* Test that Clone on branch update wipes old plans
This complements the test that Clone with unmodified
branch but modified upstream does _not_ wipe plans.
* runGit now runs git instead of returning a function that runs git
* Updated template to merged again instead of diverged
This is no longer a warning, but expected behavior in merge chekout mode
* Rename git wrapper to wrappedGit, add a type for static config
Every call to wrappedGit for the same PR uses identical setup
for directory, head repo and PR, so passing the
---------
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
* mod: rename updateCommitStatus func
* feat: add PlannedNoChangesPlanStatus
* Add skipApplyNoChanges option to PlanCommandRunner
* Add skipApplyNoChanges option to ApplyCommandRunner
* Add --skip-apply-no-changes flag
* Fix typo
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* Rename --skip-apply-no-changes flag
* Refactor updateCommitStatus functions
* chore(docs): add detailed use case for the flag
* test: add plan_command_runner set apply status
* feat: set apply status to successful by default when result is 'No Changes'
---------
Co-authored-by: chroju <chroju@users.noreply.github.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* Include information about imports in PlanSuccessStats
Terraform 1.5 introduced a feature to import existing resources into
state via code.
https://developer.hashicorp.com/terraform/language/import
When you run `terraform plan` with imports, the output includes information
about the imported resources, which breaks the current regex for parsing
plan changes.
This PR updates the regex to include the, optional, import information.
* Use the ?
Co-authored-by: Benjamin Ullian <5695343+bnu0@users.noreply.github.com>
---------
Co-authored-by: Will Richard <wrichard@seatgeek.com>
Co-authored-by: Benjamin Ullian <5695343+bnu0@users.noreply.github.com>
Co-authored-by: Dylan Page <dylan.page@autodesk.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: state rm
* review feedback
* fix conflict for pegomock generation code
* adopt state command into allow-commands
* fix conflicts
* fix: state rm works on workspace
* notify import/state rm discard plan file
* fix lint
* use repeat instead warning for re-plan
* perl -pi -e 's!\* 🔁 plan file was discarded. to!🚮 A plan file was discarded. Re-plan would be required before applying.\n\n\* 🔁 To!g' server/**/*
* follow main branch
* add web_templates render tests
* add ansic strip tests
* move fixtures into testdata dir which is golang specific test dir name
* add server/metrics tests
* add recovery test
* add runtime stats test
* Add pre and post workflow hook status
* fix missing mocks
* fix pre/post workflow hooks tests
* add cmd output to file
* fix typo
* add cmd output to file on pre workflow hooks
* Add hooks output to web UI
* Remove unnecessary dependencies
* Clean the code and make tests work again
* Make lint happy
* Small fixes, create dedicated UUID generator and docs
* Add missing commentary
* Use matchers instead of mocking for tests and fix e2e tests
* Change 'OUTPUT_FILE' to 'OUTPUT_STATUS_FILE'
* Reduce SendWorkflowHook calls on hooks
* Apply suggestions from code review
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* new resource was added to test TestRenderProjectResultsWithEnableDiffMarkdownFormat
* Correct test case
* 1st regex change
* Adding one more pattern to regex
Co-authored-by: dyurovskykh-tivo <Dmytro.Yurovskykh@tivo.com>
* Moved CommandContext and CommandResult to models (#193)
* Moved CommandContext and CommandResult to models
* move from models to command
rename CommandContext -> Context
rename CommandResult -> Result
* moved command related helpers into command package
* move ProjectCommandContext and ProjectResult to command/project package
* move project command context and project result
* revert unrelated code
* move tests
* fix left over
* fix linting
* fix tests
* remove unused import
* fix project context dependencies
* fix depenedecies
* fix typo
* Add UUID for Log Streaming Job ID (#167)
* Update log handler to close buffered channels when an operation is complete (#170)
* Add preliminary check before registering new receivers in the log handler (#173)
* Using projectOutputBuffers to check for jobID instead of receiverBuffers (#181)
* Refactor log handler (#175)
* Reverting go.mod and go.sum
* Fix lint errors
* Fix linting
* Replacing . with _ when generating project identifier if project name is not set
* Adding test for GenerateProjectJobURL when working dir set to .
* Replacing . with _ when generating project identifier if project name is not set
* Fixing merge conflicts
This is two changes:
Replacing all usages of SimpleLogger with it's interface SimpleLogging which makes it easier to swap out loggers going forward
Nukes SimpleLogger in favor of StructuredLogger which allows us to better analyze logs in our log management system we choose.