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

fix(revert): yaml parser switch #1195

Merged
merged 1 commit into from
Sep 26, 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
2 changes: 1 addition & 1 deletion api/types/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/native/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"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"
Expand Down Expand Up @@ -332,7 +332,7 @@

if c.ModificationService.Endpoint != "" {
// send config to external endpoint for modification
p, err = c.modifyConfig(p, c.build, c.repo)

Check failure on line 335 in compiler/native/compile.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] compiler/native/compile.go#L335

Function `modifyConfig` should pass the context parameter (contextcheck)
Raw output
compiler/native/compile.go:335:26: Function `modifyConfig` should pass the context parameter (contextcheck)
		p, err = c.modifyConfig(p, c.build, c.repo)
		                       ^
if err != nil {
return nil, _pipeline, err
}
Expand Down Expand Up @@ -427,7 +427,7 @@

if c.ModificationService.Endpoint != "" {
// send config to external endpoint for modification
p, err = c.modifyConfig(p, c.build, c.repo)

Check failure on line 430 in compiler/native/compile.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] compiler/native/compile.go#L430

Function `modifyConfig` should pass the context parameter (contextcheck)
Raw output
compiler/native/compile.go:430:26: Function `modifyConfig` should pass the context parameter (contextcheck)
		p, err = c.modifyConfig(p, c.build, c.repo)
		                       ^
if err != nil {
return nil, _pipeline, err
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/native/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
},
},
Expand Down Expand Up @@ -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",
},
},
Expand Down
4 changes: 2 additions & 2 deletions compiler/native/expand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
},
Expand All @@ -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"},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion compiler/native/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion compiler/native/substitute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion compiler/template/native/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package native
import (
"strings"

"gopkg.in/yaml.v3"
"github.com/buildkite/yaml"

"github.com/go-vela/types/raw"
)
Expand Down
2 changes: 1 addition & 1 deletion compiler/template/native/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion compiler/template/native/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion compiler/template/starlark/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"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"
Expand Down Expand Up @@ -41,7 +41,7 @@

predeclared := starlark.StringDict{"struct": starlark.NewBuiltin("struct", starlarkstruct.Make)}

globals, err := starlark.ExecFile(thread, tName, tmpl, predeclared)

Check failure on line 44 in compiler/template/starlark/render.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] compiler/template/starlark/render.go#L44

SA1019: starlark.ExecFile is deprecated: use [ExecFileOptions] with [syntax.FileOptions] instead, because this function relies on legacy global variables. (staticcheck)
Raw output
compiler/template/starlark/render.go:44:18: SA1019: starlark.ExecFile is deprecated: use [ExecFileOptions] with [syntax.FileOptions] instead, because this function relies on legacy global variables. (staticcheck)
	globals, err := starlark.ExecFile(thread, tName, tmpl, predeclared)
	                ^

if err != nil {
return nil, err
Expand Down Expand Up @@ -149,7 +149,7 @@

predeclared := starlark.StringDict{"struct": starlark.NewBuiltin("struct", starlarkstruct.Make)}

globals, err := starlark.ExecFile(thread, "templated-base", b, predeclared)

Check failure on line 152 in compiler/template/starlark/render.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] compiler/template/starlark/render.go#L152

SA1019: starlark.ExecFile is deprecated: use [ExecFileOptions] with [syntax.FileOptions] instead, because this function relies on legacy global variables. (staticcheck)
Raw output
compiler/template/starlark/render.go:152:18: SA1019: starlark.ExecFile is deprecated: use [ExecFileOptions] with [syntax.FileOptions] instead, because this function relies on legacy global variables. (staticcheck)
	globals, err := starlark.ExecFile(thread, "templated-base", b, predeclared)
	                ^
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/template/starlark/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
)
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion mock/server/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading