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: upgrade yaml library to go-yaml v3 over buildkite #1171

Merged
merged 4 commits into from
Aug 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/types/constants"
Expand Down Expand Up @@ -325,7 +325,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 328 in compiler/native/compile.go

View workflow job for this annotation

GitHub Actions / golangci

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

Function `modifyConfig` should pass the context parameter (contextcheck)
Raw output
compiler/native/compile.go:328: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 @@ -420,7 +420,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 423 in compiler/native/compile.go

View workflow job for this annotation

GitHub Actions / golangci

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

Function `modifyConfig` should pass the context parameter (contextcheck)
Raw output
compiler/native/compile.go:423: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
30 changes: 15 additions & 15 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/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"
Expand Down Expand Up @@ -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",
},
},
},
Expand Down Expand Up @@ -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",
},
},
},
Expand Down Expand Up @@ -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",
},
},
},
Expand Down Expand Up @@ -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",
},
},
},
Expand Down Expand Up @@ -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",
},
},
Expand Down Expand Up @@ -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",
},
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions compiler/native/expand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,15 @@ func TestNative_ExpandStepsMulti(t *testing.T) {
Secrets: yaml.StepSecretSlice{
{
Source: "vault_token",
Target: "vault_token",
Target: "VAULT_TOKEN",
},
},
Parameters: map[string]interface{}{
"addr": "vault.example.com",
"auth_method": "token",
"username": "octocat",
"items": []interface{}{
map[interface{}]interface{}{"path": "docker", "source": "secret/docker"},
map[string]interface{}{"path": "docker", "source": "secret/docker"},
},
},
},
Expand All @@ -602,15 +602,15 @@ func TestNative_ExpandStepsMulti(t *testing.T) {
Secrets: yaml.StepSecretSlice{
{
Source: "vault_token",
Target: "vault_token",
Target: "VAULT_TOKEN",
},
},
Parameters: map[string]interface{}{
"addr": "vault.example.com",
"auth_method": "token",
"username": "octocat",
"items": []interface{}{
map[interface{}]interface{}{"path": "docker", "source": "secret/docker"},
map[string]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"

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

"github.com/go-vela/server/compiler/template/native"
"github.com/go-vela/server/compiler/template/starlark"
Expand Down
12 changes: 6 additions & 6 deletions compiler/native/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
},
Expand Down Expand Up @@ -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",
},
},
},
Expand Down Expand Up @@ -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",
},
},
},
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"

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

"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"
"github.com/buildkite/yaml"
"gopkg.in/yaml.v3"

"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 @@ 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"
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
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
)
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
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