Commit Graph

131 Commits

Author SHA1 Message Date
Alexey Kosenko
1f9b90e715 feat(post-workflow-hook): pass the result status of executed command to the post hook envs (#5308)
Signed-off-by: a1k0u <alko7enko@gmail.com>
2025-02-10 21:27:30 +00:00
Rui Chen
591931a81c chore: fix typos (#5202)
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-12-28 17:50:53 -05:00
Alexey Kosenko
13fa635523 feat(automerge): implement GitHub --auto-merge-method flag for apply command (#4895)
Signed-off-by: a1k0u <alko7enko@gmail.com>
Signed-off-by: X-Guardian <simonheather99@gmail.com>
2024-11-02 20:09:17 +00:00
Nick King
9a0c648748 feat: add ability to delegate authorization to external sources (#4864) 2024-09-03 15:39:04 -07:00
Xing Yahao
267b2f133b feat: make api plan apply support workflow hooks (#4482)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2024-05-01 09:06:35 -07:00
Martijn van der Kleijn
722c4a9372 feat: Add Gitea support (#4229)
* 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>
2024-03-18 14:21:45 +00:00
Luke Massa
783c011d02 feat: Add logic for project name into lock (#4192)
* feat: Add logic for project name into lock

* More logic

* Fix tests

* Add tests
2024-02-12 14:02:04 -05:00
Thomas Lorreyte
9fa4cd3c34 fix: unnamed jobs in ui (#4137) 2024-02-02 05:21:17 -08:00
Brett Galkowski
22060fe5d2 feat: Add option allowing usage of custom policy check tools (#3765)
* 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
2023-10-06 10:57:29 -04:00
Finn Arne Gangstad
078af70376 fix: safer re-merging with updated upstream (#3499)
* 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>
2023-09-25 15:17:27 -04:00
chroju
fbb12fe3b9 feat: set atlantis/apply check to successful if all plans are No Changes (#3378)
* 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>
2023-08-03 11:15:13 -04:00
William Richard
3ca5d82ebf fix: Include information about imports in PlanSuccessStats (#3621)
* 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>
2023-07-30 20:04:29 +00:00
Simon Heather
847cab74c4 feat: Add Command Name Environment Variable to Pre/Post Workflow Executions (#3571)
* Add Workflow Command Name env var

* Update tests

* Update command runner

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-07-07 16:21:32 -04:00
Ross Strickland
7545296741 fix: parse custom run step output in policy_check (#3502)
* parse custom run output in policy_check

* error if no conftest output

* e2e test

* Adding other policy template.

* update markdown renderer test
2023-06-20 14:55:37 -04:00
Leandro López
339c0fe474 feat(stats): pass plan stats to markdown templates (#3478)
* 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>
2023-06-03 14:01:17 -05:00
Ross Strickland
684f2fa7e0 feat(policies): Add granular policy_sets (#3086)
* Initial work.

* Periodic push.

* Fmt and start adding args to approve_policies cmd.

* keep funcs for now.

* Periodic push.

* Periodic push.

* fmt.

* Move approve policies logic to project_command_runner.

* update some tests

* More test fixes.

* update more tests. fix som logic.

* more tests. add additional info to common data for custom templates.

* fix apply with policies bug. update more tests/fmt

* file perms

* fix error parsing for conftest results.

* Update more tests and linting.

* update documentation.

* Address no-fail case. Address comments.

* Forgot changes.

* fix markdown renderer

* Fix policy fail logic. remove uneeded tmpl var

* targeted policy approvals fix

* Address PR comments.

* empty commit to trigger build

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: rkstrickland <ross.strickland@instacart.com>
Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2023-04-20 21:53:46 -04:00
Andrei Vydrin
f7f35ceb29 feat: add hide-unchanged-plan-comments option (#3158)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-02-25 15:50:33 -06:00
Ken Kaizu
cb0aadf571 feat: state rm (#2880)
* 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
2023-01-18 22:02:18 -06:00
Ken Kaizu
9e3d8879ec fix: PR status summary should remove Note: Objects have changed outside of Terraform (#3010)
* extract PlanSuccess.DiffSummary

* commit status updater use DiffSummary instead Summary to show only diff result
2023-01-18 20:14:58 -06:00
Ken Kaizu
da48fb515d chore(test): add no test dir tests, rename testdata dir (#2986)
* 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
2023-01-15 23:14:23 -06:00
Ken Kaizu
6f28b6a8e4 fix: trim space markdown renderer (#2947)
* chore: trim space rendered templates

* regen e2e results

* revert parallel output substring check test case

* follow master branch

* follow main branch

* Update approve_policies_command_runner_test.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-01-10 23:48:20 -06:00
Leandro López
04f1d062d6 Improve plan summary performance (#2907)
* Add benchmark for *PlanSuccess.Summary

This is for taking a baseline and comparing with future
improvements. I just did a test run and got the following results:

$ go test -bench=. ./server/events/command
goos: darwin
goarch: arm64
pkg: github.com/runatlantis/atlantis/server/events/command
BenchmarkPlanSuccess_Summary/empty_summary,_no_matches-10                  82564             12415 ns/op           27352 B/op        114 allocs/op
BenchmarkPlanSuccess_Summary/changes-10                                   167904              7148 ns/op           14309 B/op         69 allocs/op
BenchmarkPlanSuccess_Summary/no_changes-10                                 92410             12984 ns/op           27705 B/op        114 allocs/op
BenchmarkPlanSuccess_Summary/changes_outside_Terraform-10                  89256             13505 ns/op           27882 B/op        117 allocs/op
BenchmarkPlanSuccess_Summary/changes_and_changes_outside-10               159199              7527 ns/op           14493 B/op         72 allocs/op
PASS
ok      github.com/runatlantis/atlantis/server/events/command   7.536s

To have a better comparison I've ran all the benchmarks with 200,000
iterations, and got this:

$ go test -bench=. ./server/events/command -benchtime=200000x
goos: darwin
goarch: arm64
pkg: github.com/runatlantis/atlantis/server/events/command
BenchmarkPlanSuccess_Summary/changes_and_changes_outside-10               200000              7637 ns/op           14487 B/op         72 allocs/op
BenchmarkPlanSuccess_Summary/empty_summary,_no_matches-10                 200000             12379 ns/op           27352 B/op        114 allocs/op
BenchmarkPlanSuccess_Summary/changes-10                                   200000              7134 ns/op           14312 B/op         69 allocs/op
BenchmarkPlanSuccess_Summary/no_changes-10                                200000             12960 ns/op           27692 B/op        114 allocs/op
BenchmarkPlanSuccess_Summary/changes_outside_Terraform-10                 200000             13731 ns/op           27862 B/op        117 allocs/op
PASS
ok      github.com/runatlantis/atlantis/server/events/command   11.837s

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Compile summary regexps only once

By initializing these regexes at program first run instead of every
time the function is called we gain better resource usage and much
faster results, as shown in this results with 200,000 iterations as in
the previous commit:

$ go test -bench=. ./server/events/command -benchtime=200000x
goos: darwin
goarch: arm64
pkg: github.com/runatlantis/atlantis/server/events/command
BenchmarkPlanSuccess_Summary/empty_summary,_no_matches-10                 200000                29.49 ns/op            0 B/op          0 allocs/op
BenchmarkPlanSuccess_Summary/changes-10                                   200000               450.4 ns/op             0 B/op          0 allocs/op
BenchmarkPlanSuccess_Summary/no_changes-10                                200000               357.9 ns/op             0 B/op          0 allocs/op
BenchmarkPlanSuccess_Summary/changes_outside_Terraform-10                 200000               824.1 ns/op           193 B/op          3 allocs/op
BenchmarkPlanSuccess_Summary/changes_and_changes_outside-10               200000               754.8 ns/op           177 B/op          3 allocs/op
PASS
ok      github.com/runatlantis/atlantis/server/events/command   0.943s

With 200,000 iterations the results were almost immediately and I
couldn't observe the real performance, so I've removed the limitation
and got the following:

$ go test -bench=. ./server/events/command -benchtime=200000x
goos: darwin
goarch: arm64
pkg: github.com/runatlantis/atlantis/server/events/command
BenchmarkPlanSuccess_Summary/empty_summary,_no_matches-10                 200000                29.49 ns/op            0 B/op          0 allocs/op
BenchmarkPlanSuccess_Summary/changes-10                                   200000               450.4 ns/op             0 B/op          0 allocs/op
BenchmarkPlanSuccess_Summary/no_changes-10                                200000               357.9 ns/op             0 B/op          0 allocs/op
BenchmarkPlanSuccess_Summary/changes_outside_Terraform-10                 200000               824.1 ns/op           193 B/op          3 allocs/op
BenchmarkPlanSuccess_Summary/changes_and_changes_outside-10               200000               754.8 ns/op           177 B/op          3 allocs/op
PASS
ok      github.com/runatlantis/atlantis/server/events/command   0.943s

I've also compared the results of running the benchamrks with 200,000
iterations, 10 times each, and these are the results:

$ benchstat orig.txt improv.txt
name                                                old time/op    new time/op    delta
PlanSuccess_Summary/empty_summary,_no_matches-10      12.6µs ± 2%     0.0µs ± 1%   -99.90%  (p=0.000 n=10+9)
PlanSuccess_Summary/changes-10                        7.19µs ± 0%    0.36µs ± 2%   -94.96%  (p=0.000 n=8+9)
PlanSuccess_Summary/no_changes-10                     13.2µs ± 2%     0.4µs ± 0%   -97.27%  (p=0.000 n=10+9)
PlanSuccess_Summary/changes_outside_Terraform-10      13.7µs ± 1%     0.8µs ± 0%   -94.02%  (p=0.000 n=9+9)
PlanSuccess_Summary/changes_and_changes_outside-10    7.71µs ± 5%    0.75µs ± 0%   -90.21%  (p=0.000 n=10+8)

name                                                old alloc/op   new alloc/op   delta
PlanSuccess_Summary/empty_summary,_no_matches-10      27.4kB ± 0%     0.0kB       -100.00%  (p=0.000 n=10+10)
PlanSuccess_Summary/changes-10                        14.3kB ± 0%     0.0kB       -100.00%  (p=0.000 n=9+10)
PlanSuccess_Summary/no_changes-10                     27.7kB ± 0%     0.0kB       -100.00%  (p=0.000 n=10+10)
PlanSuccess_Summary/changes_outside_Terraform-10      27.9kB ± 0%     0.2kB ± 0%   -99.31%  (p=0.000 n=10+7)
PlanSuccess_Summary/changes_and_changes_outside-10    14.5kB ± 0%     0.2kB ± 0%   -98.78%  (p=0.000 n=10+8)

name                                                old allocs/op  new allocs/op  delta
PlanSuccess_Summary/empty_summary,_no_matches-10         114 ± 0%         0       -100.00%  (p=0.000 n=10+10)
PlanSuccess_Summary/changes-10                          69.0 ± 0%       0.0       -100.00%  (p=0.000 n=10+10)
PlanSuccess_Summary/no_changes-10                        114 ± 0%         0       -100.00%  (p=0.000 n=10+10)
PlanSuccess_Summary/changes_outside_Terraform-10         117 ± 0%         3 ± 0%   -97.44%  (p=0.000 n=10+10)
PlanSuccess_Summary/changes_and_changes_outside-10      72.0 ± 0%       3.0 ± 0%   -95.83%  (p=0.000 n=10+10)

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Remove extra allocation

There's no need for fmt.Sprintf for such a simple use.

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Add MarkdownRenderer benchmark for diff markdown format

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Compile markdown diff regexes once

This change doesn't improve performance as dramatically as the summary
regexes do, however, it does reduce the amount of resources used:

$ benchstat markdowndiff.orig.txt markdowndiff.inkel.txt
name                                                                                                                   old time/op    new time/op    delta
RenderProjectResultsWithEnableDiffMarkdownFormat/single_successful_plan_with_diff_markdown_formatted/verbose_true-10      727µs ± 0%     717µs ± 2%   -1.31%  (p=0.002 n=10+10)
RenderProjectResultsWithEnableDiffMarkdownFormat/single_successful_plan_with_diff_markdown_formatted/verbose_false-10     725µs ± 0%     715µs ± 1%   -1.33%  (p=0.000 n=9+10)

name                                                                                                                   old alloc/op   new alloc/op   delta
RenderProjectResultsWithEnableDiffMarkdownFormat/single_successful_plan_with_diff_markdown_formatted/verbose_true-10      171kB ± 0%     153kB ± 0%  -10.60%  (p=0.000 n=10+10)
RenderProjectResultsWithEnableDiffMarkdownFormat/single_successful_plan_with_diff_markdown_formatted/verbose_false-10     171kB ± 0%     153kB ± 0%  -10.60%  (p=0.000 n=10+10)

name                                                                                                                   old allocs/op  new allocs/op  delta
RenderProjectResultsWithEnableDiffMarkdownFormat/single_successful_plan_with_diff_markdown_formatted/verbose_true-10        364 ± 0%       214 ± 0%  -41.29%  (p=0.000 n=10+9)
RenderProjectResultsWithEnableDiffMarkdownFormat/single_successful_plan_with_diff_markdown_formatted/verbose_false-10       358 ± 0%       207 ± 0%  -42.05%  (p=0.000 n=10+10)

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
2023-01-04 12:28:51 -08:00
Ken Kaizu
4e0d4ecc40 feat: atlantis import (#2783)
* feat: atlantis import

* feat: atlantis import

* regenerate mock comment builder

* remove duplicate err check

* instrumented import command runner/builder

* atlantis import subcommand accept args before hyphen

* fix link checker

* docs: review feedback

* fix atlantis import options order

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update server/events/comment_parser.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update server/events/comment_parser.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/server-side-repo-config.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update server/events/command_requirement_handler.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update server/events/command_requirement_handler_test.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* fix test import usage

* fix e2e expected txt

* fix doc link

* docs: workflow import stage/step

* docs fixup

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-12-22 18:37:29 -06:00
Ken Kaizu
2d29db6893 fix: Policy check summary not shown outside of "Show Output" details (#2837) 2022-12-20 07:28:12 -06:00
Fabiano Soares Honorato
cb485f11ee feat: Add pre and post workflow hook status (#2441)
* 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>
2022-12-19 14:20:34 -06:00
Thomas Lorreyte
7f75002b6b feat: add policy check summary in wrapped messages (#2452)
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-11-12 22:45:19 -06:00
Adam Verigin
c3462f9073 Add COMMENT_ARGS to pre/post-workflow hook execution environment (#2621) 2022-11-07 14:50:49 -06:00
Volodymyr Stupnytskyi
4cc5cf6848 Updating diffKeywordRegex to properly handle new test case (#2551)
* 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>
2022-11-04 09:19:39 -07:00
Rui Chen
6fd8130fe1 lint: gofmt -w -s . (#2504)
Signed-off-by: Rui Chen <rui@chenrui.dev>

Signed-off-by: Rui Chen <rui@chenrui.dev>
2022-09-12 18:08:46 -07:00
Paul O'Connor
4143c87559 bug: Fix GitHub Markdown for added and deleted resources (#2418)
* bug: Fix GitHub Markdown for added and deleted resources

* Fix spacing in test
2022-09-07 17:48:10 -07:00
Rémi Lapeyre
b409cb8470 Add the /plan and /apply endpoints (#997)
* Add the /plan and /apply endpoints

* Resolve conflicts

* Fix wrong merge

* Add missing methods for mocks

* Fix linting error

* Fix linting error

* Move api plan/apply into APIController

* Extract commond code into helper functions

* Implement GetCloneURL for GitHub

Co-authored-by: Li Lin <li.lin@hashicorp.com>
2022-07-27 11:36:49 -07:00
Paul O'Connor
7a6b5b85bb Only highlight Terraform changes on GitHub (#2337) 2022-07-12 08:58:39 -07:00
Sarvar Muminov
90e92e3a13 chore: move CommandContext and CommandResult to models (#193) (#2093)
* 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
2022-03-21 10:36:13 -07:00
Nish Krishnan
d1d1539ced feat: Add stats support for basic operations (#2147) 2022-03-18 15:18:13 -07:00
Aayush Gupta
58e9b42bbc feat: Use UUIDs to identify log streaming jobs (#2051)
* 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
2022-02-09 13:15:49 -08:00
Sarvar Muminov
7a927c050b Moving config files to core/config (#2036)
* Moving config files to core/config

* fix package names

* fix package dependencies

* linting fixes

* more linting fixes

* ran golangci-lint run --fix
2022-02-03 11:06:04 -08:00
Roman Pertsev
576f8fbf4b Fix URL generation (#2021)
* fix org generation

* fix key generation

* fix variable name

* add normalization vars

* encapsulate vars

Co-authored-by: Roman Pertsev <roman.pertsev@nordigy.ru>
2022-01-31 12:15:16 -07:00
Aayush Gupta
7d3f3fb490 fix: broken Log Streaming URL when working directory is set to "./" (#2015)
* 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
2022-01-24 12:18:50 -08:00
Tim McFadden
b859f72561 feat: post workflow hooks (#1990)
* Add post-workflow hooks

* docs: Add cost estimation as post workflow use case

Co-authored-by: Gerald Barker <geraldbarker@gmail.com>
2022-01-12 19:57:45 -05:00
Aayush Gupta
004074a29f feat: streaming terraform logs in real-time (#1937) 2021-12-30 09:52:52 -05:00
Nish Krishnan
33b4d6325a refactor: Add PullStatusFetcher interface (#1904) 2021-11-18 11:42:36 -08:00
Aayush Gupta
bb2c239dd9 Updating client interface and adding ApprovalStatus model (#1827) 2021-09-22 12:41:05 -07:00
Enoch Lo
89236d8e54 Add flag to enable markdown diff formatting (#1751) 2021-08-30 14:01:52 -07:00
Pat Sier
d358857e80 feat: add version command (#1691) 2021-07-12 11:10:15 -04:00
chroju
e0f5b83aa7 Fix plan summary when changes outside of terraform is detected (#1593) (#1594)
Co-authored-by: chroju <chroju@users.noreply.github.com>
2021-06-24 08:30:31 -07:00
Nish Krishnan
79309ed39c [ORCA-559] Fix hide previous command logic (#37) (#1549) 2021-05-03 12:47:23 -07:00
Istvan Tapaszto
632460b20b Delete source branch on merge (#1357)
Co-authored-by: Tapaszto, Istvan <istvan.tapaszto@msciintegration.onmicrosoft.com>
2021-04-22 09:54:18 -07:00
Wojciech Krysmann
0886b280f9 Add plan summary to unfolded part of comment (#1518) 2021-04-22 09:14:44 -07:00
Nish Krishnan
df106ded11 Make policy checks its own apply requirement. (#61) (#1499)
* Make policy checks its own apply requirement. (#61)

* Remove warning from docs.
2021-04-13 12:46:47 -07:00
Nish Krishnan
7ac8106f8a Add structured logger (#54) (#1467)
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.
2021-04-06 12:02:25 -07:00