From 0894432bab40b5b6981007233aca0f7d093194b1 Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Mon, 26 Aug 2024 18:40:49 -0400 Subject: [PATCH] fix: upgrade yaml library to go-yaml v3 over buildkite (#1171) * init commit * fix: upgrade yaml library to go-yaml v3 over buildkite --- api/types/string.go | 2 +- compiler/native/compile.go | 2 +- compiler/native/compile_test.go | 30 +++++++++++------------ compiler/native/expand_test.go | 8 +++--- compiler/native/parse.go | 2 +- compiler/native/parse_test.go | 12 ++++----- compiler/native/substitute.go | 2 +- compiler/template/native/convert.go | 2 +- compiler/template/native/render.go | 2 +- compiler/template/native/render_test.go | 2 +- compiler/template/starlark/render.go | 2 +- compiler/template/starlark/render_test.go | 2 +- go.mod | 5 ++-- go.sum | 6 ++--- mock/server/pipeline.go | 2 +- 15 files changed, 39 insertions(+), 42 deletions(-) diff --git a/api/types/string.go b/api/types/string.go index 33ddacb59..a7637d714 100644 --- a/api/types/string.go +++ b/api/types/string.go @@ -7,8 +7,8 @@ import ( "strconv" "strings" - "github.com/buildkite/yaml" json "github.com/ghodss/yaml" + "gopkg.in/yaml.v3" ) // ToString is a helper function to convert diff --git a/compiler/native/compile.go b/compiler/native/compile.go index d55207634..6b246f0fe 100644 --- a/compiler/native/compile.go +++ b/compiler/native/compile.go @@ -12,9 +12,9 @@ import ( "strings" "time" - yml "github.com/buildkite/yaml" "github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/go-retryablehttp" + yml "gopkg.in/yaml.v3" api "github.com/go-vela/server/api/types" "github.com/go-vela/types/constants" diff --git a/compiler/native/compile_test.go b/compiler/native/compile_test.go index d400d3ce4..9d1de65e1 100644 --- a/compiler/native/compile_test.go +++ b/compiler/native/compile_test.go @@ -13,11 +13,11 @@ import ( "testing" "time" - yml "github.com/buildkite/yaml" "github.com/gin-gonic/gin" "github.com/google/go-cmp/cmp" "github.com/google/go-github/v63/github" "github.com/urfave/cli/v2" + yml "gopkg.in/yaml.v3" api "github.com/go-vela/server/api/types" "github.com/go-vela/server/internal" @@ -208,11 +208,11 @@ func TestNative_Compile_StagesPipeline(t *testing.T) { Secrets: pipeline.StepSecretSlice{ &pipeline.StepSecret{ Source: "docker_username", - Target: "registry_username", + Target: "REGISTRY_USERNAME", }, &pipeline.StepSecret{ Source: "docker_password", - Target: "registry_password", + Target: "REGISTRY_PASSWORD", }, }, }, @@ -548,11 +548,11 @@ func TestNative_Compile_StepsPipeline(t *testing.T) { Secrets: pipeline.StepSecretSlice{ &pipeline.StepSecret{ Source: "docker_username", - Target: "registry_username", + Target: "REGISTRY_USERNAME", }, &pipeline.StepSecret{ Source: "docker_password", - Target: "registry_password", + Target: "REGISTRY_PASSWORD", }, }, }, @@ -786,11 +786,11 @@ func TestNative_Compile_StagesPipelineTemplate(t *testing.T) { Secrets: pipeline.StepSecretSlice{ &pipeline.StepSecret{ Source: "docker_username", - Target: "registry_username", + Target: "REGISTRY_USERNAME", }, &pipeline.StepSecret{ Source: "docker_password", - Target: "registry_password", + Target: "REGISTRY_PASSWORD", }, }, }, @@ -1033,11 +1033,11 @@ func TestNative_Compile_StepsPipelineTemplate(t *testing.T) { Secrets: pipeline.StepSecretSlice{ &pipeline.StepSecret{ Source: "docker_username", - Target: "registry_username", + Target: "REGISTRY_USERNAME", }, &pipeline.StepSecret{ Source: "docker_password", - Target: "registry_password", + Target: "REGISTRY_PASSWORD", }, }, }, @@ -1972,7 +1972,7 @@ func Test_client_modifyConfig(t *testing.T) { Name: "docker", Pull: "always", Parameters: map[string]interface{}{ - "init_options": map[interface{}]interface{}{ + "init_options": map[string]interface{}{ "get_plugins": "true", }, }, @@ -2005,7 +2005,7 @@ func Test_client_modifyConfig(t *testing.T) { Name: "docker", Pull: "always", Parameters: map[string]interface{}{ - "init_options": map[interface{}]interface{}{ + "init_options": map[string]interface{}{ "get_plugins": "true", }, }, @@ -3583,11 +3583,11 @@ func Test_CompileLite(t *testing.T) { Secrets: yaml.StepSecretSlice{ { Source: "docker_username", - Target: "registry_username", + Target: "REGISTRY_USERNAME", }, { Source: "docker_password", - Target: "registry_password", + Target: "REGISTRY_PASSWORD", }, }, Image: "plugins/docker:18.09", @@ -3699,11 +3699,11 @@ func Test_CompileLite(t *testing.T) { Secrets: yaml.StepSecretSlice{ { Source: "docker_username", - Target: "registry_username", + Target: "REGISTRY_USERNAME", }, { Source: "docker_password", - Target: "registry_password", + Target: "REGISTRY_PASSWORD", }, }, Image: "plugins/docker:18.09", diff --git a/compiler/native/expand_test.go b/compiler/native/expand_test.go index 56a9889c3..6e4c877d4 100644 --- a/compiler/native/expand_test.go +++ b/compiler/native/expand_test.go @@ -581,7 +581,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Secrets: yaml.StepSecretSlice{ { Source: "vault_token", - Target: "vault_token", + Target: "VAULT_TOKEN", }, }, Parameters: map[string]interface{}{ @@ -589,7 +589,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { "auth_method": "token", "username": "octocat", "items": []interface{}{ - map[interface{}]interface{}{"path": "docker", "source": "secret/docker"}, + map[string]interface{}{"path": "docker", "source": "secret/docker"}, }, }, }, @@ -602,7 +602,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Secrets: yaml.StepSecretSlice{ { Source: "vault_token", - Target: "vault_token", + Target: "VAULT_TOKEN", }, }, Parameters: map[string]interface{}{ @@ -610,7 +610,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { "auth_method": "token", "username": "octocat", "items": []interface{}{ - map[interface{}]interface{}{"path": "docker", "source": "secret/docker"}, + map[string]interface{}{"path": "docker", "source": "secret/docker"}, }, }, }, diff --git a/compiler/native/parse.go b/compiler/native/parse.go index 0cd7a5819..a09f6964e 100644 --- a/compiler/native/parse.go +++ b/compiler/native/parse.go @@ -7,7 +7,7 @@ import ( "io" "os" - "github.com/buildkite/yaml" + "gopkg.in/yaml.v3" "github.com/go-vela/server/compiler/template/native" "github.com/go-vela/server/compiler/template/starlark" diff --git a/compiler/native/parse_test.go b/compiler/native/parse_test.go index e0aa9c512..74da7baa9 100644 --- a/compiler/native/parse_test.go +++ b/compiler/native/parse_test.go @@ -192,11 +192,11 @@ func TestNative_Parse_Parameters(t *testing.T) { Secrets: yaml.StepSecretSlice{ &yaml.StepSecret{ Source: "docker_username", - Target: "docker_username", + Target: "DOCKER_USERNAME", }, &yaml.StepSecret{ Source: "docker_password", - Target: "docker_password", + Target: "DOCKER_PASSWORD", }, }, }, @@ -302,11 +302,11 @@ func TestNative_Parse_StagesPipeline(t *testing.T) { Secrets: yaml.StepSecretSlice{ &yaml.StepSecret{ Source: "docker_username", - Target: "registry_username", + Target: "REGISTRY_USERNAME", }, &yaml.StepSecret{ Source: "docker_password", - Target: "registry_password", + Target: "REGISTRY_PASSWORD", }, }, }, @@ -407,11 +407,11 @@ func TestNative_Parse_StepsPipeline(t *testing.T) { Secrets: yaml.StepSecretSlice{ &yaml.StepSecret{ Source: "docker_username", - Target: "registry_username", + Target: "REGISTRY_USERNAME", }, &yaml.StepSecret{ Source: "docker_password", - Target: "registry_password", + Target: "REGISTRY_PASSWORD", }, }, }, diff --git a/compiler/native/substitute.go b/compiler/native/substitute.go index 9bbc717cd..53e9973e9 100644 --- a/compiler/native/substitute.go +++ b/compiler/native/substitute.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - "github.com/buildkite/yaml" "github.com/drone/envsubst" + "gopkg.in/yaml.v3" types "github.com/go-vela/types/yaml" ) diff --git a/compiler/template/native/convert.go b/compiler/template/native/convert.go index ee45ef809..d59aa100e 100644 --- a/compiler/template/native/convert.go +++ b/compiler/template/native/convert.go @@ -5,7 +5,7 @@ package native import ( "strings" - "github.com/buildkite/yaml" + "gopkg.in/yaml.v3" "github.com/go-vela/types/raw" ) diff --git a/compiler/template/native/render.go b/compiler/template/native/render.go index a31f642b6..3de50bc4b 100644 --- a/compiler/template/native/render.go +++ b/compiler/template/native/render.go @@ -8,7 +8,7 @@ import ( "text/template" "github.com/Masterminds/sprig/v3" - "github.com/buildkite/yaml" + "gopkg.in/yaml.v3" "github.com/go-vela/types/raw" types "github.com/go-vela/types/yaml" diff --git a/compiler/template/native/render_test.go b/compiler/template/native/render_test.go index f4c92160d..70653fde5 100644 --- a/compiler/template/native/render_test.go +++ b/compiler/template/native/render_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - goyaml "github.com/buildkite/yaml" "github.com/google/go-cmp/cmp" + goyaml "gopkg.in/yaml.v3" "github.com/go-vela/types/raw" "github.com/go-vela/types/yaml" diff --git a/compiler/template/starlark/render.go b/compiler/template/starlark/render.go index 93b37cd78..b3e69f12f 100644 --- a/compiler/template/starlark/render.go +++ b/compiler/template/starlark/render.go @@ -7,9 +7,9 @@ import ( "errors" "fmt" - yaml "github.com/buildkite/yaml" "go.starlark.net/starlark" "go.starlark.net/starlarkstruct" + yaml "gopkg.in/yaml.v3" "github.com/go-vela/types/raw" types "github.com/go-vela/types/yaml" diff --git a/compiler/template/starlark/render_test.go b/compiler/template/starlark/render_test.go index a730f1088..fa30377d0 100644 --- a/compiler/template/starlark/render_test.go +++ b/compiler/template/starlark/render_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - goyaml "github.com/buildkite/yaml" "github.com/google/go-cmp/cmp" + goyaml "gopkg.in/yaml.v3" "github.com/go-vela/types/raw" "github.com/go-vela/types/yaml" diff --git a/go.mod b/go.mod index 86ba5e32d..8dd81bf8e 100644 --- a/go.mod +++ b/go.mod @@ -12,13 +12,12 @@ require ( github.com/adhocore/gronx v1.8.1 github.com/alicebob/miniredis/v2 v2.33.0 github.com/aws/aws-sdk-go v1.54.20 - github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3 github.com/distribution/reference v0.6.0 github.com/drone/envsubst v1.0.3 github.com/ghodss/yaml v1.0.0 github.com/gin-gonic/gin v1.10.0 github.com/go-playground/assert/v2 v2.2.0 - github.com/go-vela/types v0.24.0 + github.com/go-vela/types v0.24.1-0.20240826141537-76a66e72d5dc github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v63 v63.0.0 @@ -42,6 +41,7 @@ require ( golang.org/x/crypto v0.25.0 golang.org/x/oauth2 v0.21.0 golang.org/x/sync v0.7.0 + gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/postgres v1.5.9 gorm.io/driver/sqlite v1.5.6 gorm.io/gorm v1.25.11 @@ -130,7 +130,6 @@ require ( golang.org/x/time v0.5.0 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.120.1 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect ) diff --git a/go.sum b/go.sum index f0ab32dd2..1f2a95401 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,6 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= -github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3 h1:q+sMKdA6L8LyGVudTkpGoC73h6ak2iWSPFiFo/pFOU8= -github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3/go.mod h1:5hCug3EZaHXU3FdCA3gJm0YTNi+V+ooA2qNTiVpky4A= github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= @@ -91,8 +89,8 @@ github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBEx github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-vela/types v0.24.0 h1:KkkiXxw3uHckh/foyadmLY1YnLw6vhZbz9XwqONCj6o= -github.com/go-vela/types v0.24.0/go.mod h1:YWj6BIapl9Kbj4yHq/fp8jltXdGiwD/gTy1ez32Rzag= +github.com/go-vela/types v0.24.1-0.20240826141537-76a66e72d5dc h1:VyT2tBwPVO9fMmn+22TC4rY4dp+d71To/Qo5Vk4cOSo= +github.com/go-vela/types v0.24.1-0.20240826141537-76a66e72d5dc/go.mod h1:WcSiFm8cWuErRw4aI08NrfM+SZzidnbUs2fmO5klFKo= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= diff --git a/mock/server/pipeline.go b/mock/server/pipeline.go index 0d90cf45d..aaa06daf7 100644 --- a/mock/server/pipeline.go +++ b/mock/server/pipeline.go @@ -8,8 +8,8 @@ import ( "net/http" "strings" - yml "github.com/buildkite/yaml" "github.com/gin-gonic/gin" + yml "gopkg.in/yaml.v3" "github.com/go-vela/types" "github.com/go-vela/types/library"