From b6d71a8d52b9739cf4d1fa1a5a405946d64e0efe Mon Sep 17 00:00:00 2001 From: David May <49894298+wass3rw3rk@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:59:32 -0500 Subject: [PATCH] revert: yaml parser switch (#1195) --- api/types/string.go | 2 +- compiler/native/compile.go | 2 +- compiler/native/compile_test.go | 6 +++--- compiler/native/expand_test.go | 4 ++-- compiler/native/parse.go | 2 +- 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 | 7 ++++--- go.sum | 10 ++++++---- mock/server/pipeline.go | 2 +- 14 files changed, 25 insertions(+), 22 deletions(-) diff --git a/api/types/string.go b/api/types/string.go index a7637d714..33ddacb59 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 1b630c2e0..a1f259400 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/server/internal" diff --git a/compiler/native/compile_test.go b/compiler/native/compile_test.go index 29a37c8d3..3670cae07 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/v65/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" @@ -2056,7 +2056,7 @@ func Test_client_modifyConfig(t *testing.T) { Name: "docker", Pull: "always", Parameters: map[string]interface{}{ - "init_options": map[string]interface{}{ + "init_options": map[interface{}]interface{}{ "get_plugins": "true", }, }, @@ -2089,7 +2089,7 @@ func Test_client_modifyConfig(t *testing.T) { Name: "docker", Pull: "always", Parameters: map[string]interface{}{ - "init_options": map[string]interface{}{ + "init_options": map[interface{}]interface{}{ "get_plugins": "true", }, }, diff --git a/compiler/native/expand_test.go b/compiler/native/expand_test.go index 6e4c877d4..08ae0a165 100644 --- a/compiler/native/expand_test.go +++ b/compiler/native/expand_test.go @@ -589,7 +589,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { "auth_method": "token", "username": "octocat", "items": []interface{}{ - map[string]interface{}{"path": "docker", "source": "secret/docker"}, + map[interface{}]interface{}{"path": "docker", "source": "secret/docker"}, }, }, }, @@ -610,7 +610,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { "auth_method": "token", "username": "octocat", "items": []interface{}{ - map[string]interface{}{"path": "docker", "source": "secret/docker"}, + map[interface{}]interface{}{"path": "docker", "source": "secret/docker"}, }, }, }, diff --git a/compiler/native/parse.go b/compiler/native/parse.go index 6da637188..fb96b5428 100644 --- a/compiler/native/parse.go +++ b/compiler/native/parse.go @@ -7,7 +7,7 @@ import ( "io" "os" - "gopkg.in/yaml.v3" + "github.com/buildkite/yaml" "github.com/go-vela/server/compiler/template/native" "github.com/go-vela/server/compiler/template/starlark" diff --git a/compiler/native/substitute.go b/compiler/native/substitute.go index 53e9973e9..9bbc717cd 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 d59aa100e..ee45ef809 100644 --- a/compiler/template/native/convert.go +++ b/compiler/template/native/convert.go @@ -5,7 +5,7 @@ package native import ( "strings" - "gopkg.in/yaml.v3" + "github.com/buildkite/yaml" "github.com/go-vela/types/raw" ) diff --git a/compiler/template/native/render.go b/compiler/template/native/render.go index 3de50bc4b..a31f642b6 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" - "gopkg.in/yaml.v3" + "github.com/buildkite/yaml" "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 70653fde5..f4c92160d 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 b3e69f12f..93b37cd78 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 fa30377d0..a730f1088 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 53fc2e4b1..f6a58457d 100644 --- a/go.mod +++ b/go.mod @@ -7,15 +7,16 @@ require ( github.com/DATA-DOG/go-sqlmock v1.5.2 github.com/Masterminds/semver/v3 v3.3.0 github.com/Masterminds/sprig/v3 v3.3.0 - github.com/adhocore/gronx v1.19.0 + github.com/adhocore/gronx v1.19.1 github.com/alicebob/miniredis/v2 v2.33.0 github.com/aws/aws-sdk-go v1.55.5 + 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.25.0-rc1 + github.com/go-vela/types v0.25.0-rc2 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v65 v65.0.0 @@ -49,7 +50,6 @@ require ( golang.org/x/oauth2 v0.23.0 golang.org/x/sync v0.8.0 golang.org/x/time v0.6.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.12 @@ -149,6 +149,7 @@ require ( google.golang.org/grpc v1.66.1 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect ) diff --git a/go.sum b/go.sum index 4f741e0d4..03fa5e454 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tN github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/adhocore/gronx v1.19.0 h1:GrEvNMPDwXND+YFadCyFVQPC+/xxoGJaQzu+duNf6aU= -github.com/adhocore/gronx v1.19.0/go.mod h1:7oUY1WAU8rEJWmAxXR2DN0JaO4gi9khSgKjiRypqteg= +github.com/adhocore/gronx v1.19.1 h1:S4c3uVp5jPjnk00De0lslyTenGJ4nA3Ydbkj1SbdPVc= +github.com/adhocore/gronx v1.19.1/go.mod h1:7oUY1WAU8rEJWmAxXR2DN0JaO4gi9khSgKjiRypqteg= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= @@ -36,6 +36,8 @@ 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.12.2 h1:oaMFuRTpMHYLpCntGca65YWt5ny+wAceDERTkT2L9lg= github.com/bytedance/sonic v1.12.2/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= @@ -100,8 +102,8 @@ github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27 github.com/go-playground/validator/v10 v10.22.1/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.25.0-rc1 h1:5pCV4pVt1bm6YYUdkNglRDa3PcFX3qGtf5rrmkUvdOc= -github.com/go-vela/types v0.25.0-rc1/go.mod h1:fLv2pbzIy6puAV6Cgh5ixUcchTUHT4D3xX05zIhkA9I= +github.com/go-vela/types v0.25.0-rc2 h1:FFj9DgwmTWzU72PsJC41BUJOdi0UHOO2pCvoyIlLlmQ= +github.com/go-vela/types v0.25.0-rc2/go.mod h1:gyKVRQjNosAJy4AJ164CnEF6jIkwd1y6Cm5pZ6M20ZM= 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 aaa06daf7..0d90cf45d 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"