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

refactor: use hc-install for TF downloads + constraints #4494

Merged
merged 34 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
051535b
WIP: Use `hc-install` for default downloading - still currently old m…
james0209 Apr 30, 2024
5bc8d18
Lowercase logs
james0209 Apr 30, 2024
c32ccae
Little `golines` fix
james0209 Apr 30, 2024
06a0c5c
Merge branch 'main' into use-hc-install
jamengual Apr 30, 2024
1ae96b6
Use `*version.Version` instead of string as arg to `Install` so we do…
james0209 Apr 30, 2024
cf7e829
Update comment based on local testing of hc-install
james0209 Apr 30, 2024
3ee7692
Add some testing of separate functions
james0209 Apr 30, 2024
e8faad4
Expand regex test
james0209 Apr 30, 2024
871d79c
Move custom download URL logic to it's own func
james0209 May 1, 2024
2982a03
Merge branch 'main' into use-hc-install
james0209 May 1, 2024
eb56d06
Add extra log message for extracted version
james0209 May 1, 2024
c16562d
Merge branch 'main' into use-hc-install
james0209 May 1, 2024
f669220
Small refactor so "dest" and "execPath" usage is a bit more combined
james0209 May 1, 2024
03fe193
Merge branch 'main' into use-hc-install
james0209 May 3, 2024
39443b3
Use my fork branch of hc-install which allows use of a custom URL for…
james0209 May 4, 2024
6b780df
Merge branch 'main' into use-hc-install
james0209 May 4, 2024
fe55d29
Simplify testing
james0209 May 4, 2024
37dc3c4
GetFile no longer used
james0209 May 4, 2024
e3e54ee
Remove unused test func
james0209 May 4, 2024
981d3ec
Move off of my fork now PR has been merged
james0209 May 8, 2024
0134d66
Merge branch 'main' into use-hc-install
james0209 May 8, 2024
2f858e0
Merge branch 'main' into use-hc-install
james0209 May 9, 2024
36fe1ab
Merge branch 'main' into use-hc-install
james0209 May 9, 2024
7c56bd7
Merge branch 'main' into use-hc-install
james0209 May 9, 2024
f43838d
Merge branch 'main' into use-hc-install
james0209 May 10, 2024
2e9b044
Merge branch 'main' into use-hc-install
james0209 May 11, 2024
287f859
Merge branch 'main' into use-hc-install
james0209 May 23, 2024
db66816
Merge branch 'main' into use-hc-install
james0209 May 25, 2024
af091b6
Test main branch to make sure new upstream changes work okay
james0209 May 29, 2024
e42d4a4
Merge branch 'main' into use-hc-install
james0209 Jun 12, 2024
49ce10a
Merge branch 'main' into use-hc-install
jamengual Jun 12, 2024
1753090
Merge branch 'main' into use-hc-install
james0209 Jun 13, 2024
0ce27d6
Merge branch 'main' into use-hc-install
james0209 Jun 15, 2024
9841851
Merge branch 'main' into use-hc-install
james0209 Jun 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ require (
github.com/gorilla/websocket v1.5.2
github.com/hashicorp/go-getter/v2 v2.2.2
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/hashicorp/hc-install v0.7.1-0.20240529171616-e08210622997
github.com/hashicorp/terraform-config-inspect v0.0.0-20240607080351-271db412dbcb
github.com/jpillora/backoff v1.0.0
github.com/kr/pretty v0.3.1
Expand All @@ -43,7 +44,6 @@ require (
github.com/stretchr/testify v1.9.0
github.com/uber-go/tally/v4 v4.1.10
github.com/urfave/negroni/v3 v3.1.0
github.com/warrensbox/terraform-switcher v0.1.1-0.20240413181427-4d66b260d90c
github.com/xanzy/go-gitlab v0.102.0
go.etcd.io/bbolt v1.3.10
go.uber.org/zap v1.27.0
Expand All @@ -65,16 +65,18 @@ require github.com/twmb/murmur3 v1.1.8 // indirect
require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/go-fed/httpsig v1.1.0 // indirect
Expand All @@ -85,14 +87,10 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-github/v60 v60.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/gookit/goutil v0.6.15 // indirect
github.com/gookit/gsr v0.1.0 // indirect
github.com/gookit/slog v0.5.5 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/hashicorp/go-retryablehttp v0.7.6 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
Expand Down Expand Up @@ -126,8 +124,6 @@ require (
github.com/spf13/cast v1.6.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
Expand Down
67 changes: 44 additions & 23 deletions go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions server/controllers/events/events_controller_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ var mockPreWorkflowHookRunner *runtimemocks.MockPreWorkflowHookRunner

var mockPostWorkflowHookRunner *runtimemocks.MockPostWorkflowHookRunner

func (m *NoopTFDownloader) GetFile(_, _ string) error {
func (m *NoopTFDownloader) GetAny(_, _ string) error {
return nil
}

func (m *NoopTFDownloader) GetAny(_, _ string) error {
return nil
func (m *NoopTFDownloader) Install(_ string, _ string, _ *version.Version) (string, error) {
return "", nil
}

type LocalConftestCache struct {
Expand Down
1 change: 0 additions & 1 deletion server/core/runtime/policy/conftest_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func TestConfTestVersionDownloader(t *testing.T) {

t.Run("success", func(t *testing.T) {

When(mockDownloader.GetFile(Eq(destPath), Eq(fullURL))).ThenReturn(nil)
binPath, err := subject.downloadConfTestVersion(version, destPath)

mockDownloader.VerifyWasCalledOnce().GetAny(Eq(destPath), Eq(fullURL))
Expand Down
39 changes: 24 additions & 15 deletions server/core/terraform/mocks/mock_downloader.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 0 additions & 46 deletions server/core/terraform/mocks/mock_terraform_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading