fixes issue #28

This commit is contained in:
Brad Rydzewski 2019-02-01 13:17:46 -08:00
parent b6add0c2d9
commit 91d034c5fe
2 changed files with 10 additions and 3 deletions

View File

@ -2,11 +2,12 @@ package gitlab
import (
"bytes"
"strings"
droneyaml "github.com/drone/drone-yaml/yaml"
"github.com/drone/drone-yaml/yaml/compiler/image"
"github.com/drone/drone-yaml/yaml/pretty"
"github.com/gosimple/slug"
"gopkg.in/yaml.v2"
)
@ -78,7 +79,7 @@ func Convert(b []byte) ([]byte, error) {
Entrypoint: step.Entrypoint,
}
if step.Name == "" {
step.Name = slug.Make(step.Image)
step.Name = serviceSlug(step.Image)
}
pipeline.Services = append(pipeline.Services, step)
}
@ -93,3 +94,9 @@ func Convert(b []byte) ([]byte, error) {
pretty.Print(buf, manifest)
return buf.Bytes(), nil
}
func serviceSlug(s string) string {
s = image.Trim(s)
s = strings.Replace(s, "/", "__", -1)
return s
}

View File

@ -14,7 +14,7 @@ steps:
- bundle exec rake spec
services:
- name: postgres-9-3
- name: postgres
image: postgres:9.3
...