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

Bump go to 1.21.5 and update deps #178

Merged
merged 5 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
types:
- published

env:
go-version: 1.18

jobs:
releases-matrix:
name: Release Go Binaries
Expand All @@ -26,6 +23,8 @@ jobs:
exclude:
- goarch: "386"
goos: darwin
env:
go-version: 1.21
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- ubuntu-latest
- macos-latest
go:
- 1.18
- 1.21
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ versions.tf.save

## Generated by script (downloaded or created)
/.kubitect/
/kubitect
/ansible/collections/
/ansible/kubespray/
/venv/
Expand Down
52 changes: 26 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
module github.com/MusicDin/kubitect

go 1.18
go 1.21.5

require (
github.com/apenella/go-ansible v1.1.7
github.com/apenella/go-ansible v1.3.0
github.com/creasty/defaults v1.7.0
github.com/go-git/go-git/v5 v5.7.0
github.com/go-playground/validator/v10 v10.14.1
github.com/hashicorp/hc-install v0.5.2
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
golang.org/x/term v0.8.0
github.com/go-git/go-git/v5 v5.11.0
github.com/go-playground/validator/v10 v10.19.0
github.com/hashicorp/hc-install v0.6.3
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
golang.org/x/term v0.18.0
gopkg.in/yaml.v3 v3.0.1
)

require gopkg.in/yaml.v2 v2.4.0 // indirect

require (
github.com/cloudflare/circl v1.3.3 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/skeema/knownhosts v1.1.1 // indirect
github.com/stretchr/objx v0.5.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.9.3 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.19.0 // indirect
)

require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230528122434-6f98819771a1 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.1-proton // indirect
github.com/apenella/go-common-utils/data v0.0.0-20221227202648-5452d804e940 // indirect
github.com/apenella/go-common-utils/error v0.0.0-20221227202648-5452d804e940 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.15.0
github.com/fatih/color v1.16.0
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.4.1 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/hashicorp/go-version v1.6.0
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.9.0
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/crypto v0.21.0
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
533 changes: 70 additions & 463 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/cluster/provisioner/terraform/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (t MainTemplate) Write() error {

// defaultHost returns default host from a given list of hosts.
func defaultHost(hosts []config.Host) (config.Host, error) {
if hosts == nil || len(hosts) == 0 {
if len(hosts) == 0 {
return config.Host{}, fmt.Errorf("defaultHost: hosts list is empty")
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/cluster/provisioner/terraform/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ func installTerraform(ver, binDir string) (string, error) {
return "", err
}

fmt.Printf("==> Installing Terraform %v\n", ver)
fmt.Printf("==> Installing Terraform %v\n", version.Must(version.NewVersion(ver)))

installer := &releases.ExactVersion{
Product: product.Terraform,
Version: version.Must(version.NewVersion(ver)),
Expand Down
19 changes: 9 additions & 10 deletions pkg/cluster/provisioner/terraform/terraform_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package terraform

import (
"io/ioutil"
"os"
"path"
"reflect"
Expand Down Expand Up @@ -29,7 +28,7 @@ func MockTerraform(t *testing.T) *terraform {
// Create sample terraform main.tf file
maintf := "output \"test\" { value = \"test\" }"
maintfPath := path.Join(projDir, "main.tf")
err := ioutil.WriteFile(maintfPath, []byte(maintf), 0777)
err := os.WriteFile(maintfPath, []byte(maintf), 0777)
require.NoError(t, err)

return &terraform{
Expand All @@ -41,7 +40,7 @@ func MockTerraform(t *testing.T) *terraform {

func MockMissingTerraform(t *testing.T) *terraform {
tf := MockTerraform(t)
tf.version = "1.0.0"
tf.version = env.ConstTerraformVersion
return tf
}

Expand Down Expand Up @@ -92,19 +91,19 @@ func TestTerraform_init(t *testing.T) {
tf := MockMissingTerraform(t)
tfPath := path.Join(tf.binDir, "terraform")

assert.NoError(t, tf.init())
assert.Equal(t, tfPath, tf.binPath)
assert.Equal(t, true, tf.initialized)
require.NoError(t, tf.init())
require.Equal(t, tfPath, tf.binPath)
require.Equal(t, true, tf.initialized)

// tf.init() should quit immediately if initialized == true
assert.NoError(t, tf.init())
require.NoError(t, tf.init())

// Set initialized to false to call findAndInstall again.
// Since tf is already installed, tf must be found locally
tf.initialized = false
assert.NoError(t, tf.init())
assert.Equal(t, tfPath, tf.binPath)
assert.Equal(t, true, tf.initialized)
require.NoError(t, tf.init())
require.Equal(t, tfPath, tf.binPath)
require.Equal(t, true, tf.initialized)
}

func TestTerraform_init_InvalidBinDir(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/utils/validation/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func initialize() {
validate.RegisterValidation("extra_vsemver", extra_VSemVer)
validate.RegisterValidation("extra_semverinrange", extra_SemVersionInRange)
validate.RegisterValidation("extra_ipinrange", extra_IPInRange)
validate.RegisterValidation("extra_cidrv4", extra_CIDRv4)
validate.RegisterValidation("extra_uniquefield", extra_UniqueField)
validate.RegisterValidation("extra_regexany", extra_RegexAny)
validate.RegisterValidation("extra_regexall", extra_RegexAll)
Expand Down Expand Up @@ -276,7 +277,7 @@ func CIDR() Validator {
// CIDRv4 checks whether the field value is a valid v4 CIDR address.
func CIDRv4() Validator {
return Validator{
Tags: "cidrv4",
Tags: "extra_cidrv4",
Err: "Field '{.Field}' must be a valid CIDRv4 address (actual: {.Value}).",
}
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/utils/validation/validators_extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ func extra_IPInRange(fl validator.FieldLevel) bool {
return subnet.Contains(ip)
}

// extra_CIDRv4 returns true if struct filed is a valid v4 CIDR address.
// Note: Required since breaking change in go-playground/validation@10.15.5
func extra_CIDRv4(fl validator.FieldLevel) bool {
ip, _, err := net.ParseCIDR(fl.Field().String())
return err == nil && ip.To4() != nil
}

// extra_UniqueField returns true if struct field with a given name is unique for
// all slice elements.
func extra_UniqueField(fl validator.FieldLevel) bool {
Expand Down