Commit 728c9d90 authored by zauberstuhl's avatar zauberstuhl

Merge branch 'subgroup_support' into 'master'

Add subgroup support to getOrgaFromSlug func

See merge request !4
parents ddc6abc1 0966580f
Pipeline #875 passed with stage
in 1 minute and 11 seconds
image: golang:1.9
before_script:
- go get -u honnef.co/go/tools/...
- go get -d ./...
run go checks:
stage: test
before_script:
- go get -u honnef.co/go/tools/...
- go get -d ./...
script:
- megacheck .
build docker image:
stage: build
before_script:
- apt-get update && apt-get install -y curl
- curl -L https://get.docker.com | bash -
script:
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- docker build -t feneas/testsuite_server:$CI_COMMIT_TAG .
- docker tag feneas/testsuite_server:$CI_COMMIT_TAG feneas/testsuite_server:latest
- docker push feneas/testsuite_server:$CI_COMMIT_TAG
- docker push feneas/testsuite_server:latest
only:
- tags
......@@ -291,7 +291,8 @@ func (build *Build) Update(status BuildStatus) error {
TargetURL: &pipelineHref,
}
slug := strings.Split(build.Project.Slug, "/")
if len(slug) <= 1 {
if len(slug) != 2 {
// github doesn't support subgroups
fmt.Printf("#%d: Invalid repo slug: %s\n", build.ID, build.Project.Slug)
return errors.New("Invalid repo slug")
}
......
......@@ -47,7 +47,7 @@ func render(w http.ResponseWriter, name string, s interface{}) {
"getOrgaFromSlug": func(s string) string {
sArr := strings.Split(s, "/")
if len(sArr) > 0 {
return sArr[0]
return strings.Join(sArr[:len(sArr)-1], "/")
}
return ""
},
......
......@@ -36,7 +36,8 @@ func createGithubHook(project Project) error {
&oauth2.Token{AccessToken: project.Token})))
slug := strings.Split(project.Slug, "/")
if len(slug) < 2 {
if len(slug) != 2 {
// github doesn't support subgroups
return errors.New("Invalid repository slug")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment