1
0
Fork 0

Fix secret syntax

This commit is contained in:
Lauris BH 2022-07-30 01:32:35 +03:00
parent ea96eed417
commit ac85763829
No known key found for this signature in database
GPG Key ID: DFDE60A0093EB926
4 changed files with 4 additions and 4 deletions

2
.vscode/launch.json vendored
View File

@ -8,7 +8,7 @@
"mode": "debug",
"buildFlags": "-tags 'netgo osusergo'",
"program": "${workspaceRoot}/cmd/pipeline-convert/",
"args": ["-s", "drone/testdata/simple.yml", "-d", "output/"],
"args": ["-s", "drone/testdata/.drone.yml", "-d", "output/"],
"cwd": "${workspaceFolder}",
}
]

View File

@ -25,7 +25,7 @@ func getPipelineByName(pipelines []*transform.Pipeline, name string) *transform.
}
func TestTransformSimple(t *testing.T) {
buf, err := os.ReadFile("testdata/simple.yml")
buf, err := os.ReadFile("testdata/.drone.yml")
require.NoError(t, err)
d := drone.New()

View File

@ -16,13 +16,13 @@ type Secrets []Secret
func (s Secrets) MarshalYAML() (interface{}, error) {
arr := make([]interface{}, 0, len(s))
for _, secret := range s {
if secret.Target == "" || strings.EqualFold(secret.Source, secret.Target) {
if secret.Target != "" && !strings.EqualFold(secret.Source, secret.Target) {
arr = append(arr, Secret{
Source: secret.Source,
Target: strings.ToLower(secret.Target),
})
} else {
arr = append(arr, secret)
arr = append(arr, secret.Source)
}
}
return arr, nil