-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.go
More file actions
27 lines (22 loc) · 773 Bytes
/
utils.go
File metadata and controls
27 lines (22 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package github
import "fmt"
// Maps repositories to namespace templates
var repoToNamespaceTemplateMap map[string]string
func DeriveK8sNamespace(repo string, pr int) (string, error) {
tpl, found := repoToNamespaceTemplateMap[repo]
if found {
return fmt.Sprintf(tpl, pr), nil
}
return "", fmt.Errorf("could not derive namespace from repository: %s", repo)
}
func init() {
initRepoToNamespaceTemplateMap()
}
func initRepoToNamespaceTemplateMap() {
repoToNamespaceTemplateMap = map[string]string{
"SwissDataScienceCenter/amalthea": "renku-ci-am-%d",
"SwissDataScienceCenter/renku": "ci-renku-%d",
"SwissDataScienceCenter/renku-data-services": "renku-ci-ds-%d",
"SwissDataScienceCenter/renku-ui": "renku-ci-ui-%d",
}
}