mirror of
https://github.com/thegeeklab/drone-yaml.git
synced 2024-11-22 01:50:40 +00:00
fixes issue #28
This commit is contained in:
parent
b6add0c2d9
commit
91d034c5fe
@ -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
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ steps:
|
||||
- bundle exec rake spec
|
||||
|
||||
services:
|
||||
- name: postgres-9-3
|
||||
- name: postgres
|
||||
image: postgres:9.3
|
||||
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user