forked from jenkins-x/jx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quickstarts.go
40 lines (35 loc) · 1017 Bytes
/
quickstarts.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
package kube
import (
"fmt"
"github.com/jenkins-x/jx/pkg/apis/jenkins.io/v1"
"github.com/jenkins-x/jx/pkg/client/clientset/versioned"
"github.com/jenkins-x/jx/pkg/gits"
)
var (
DefaultQuickstartLocations = []v1.QuickStartLocation{
{
GitURL: gits.GitHubURL,
GitKind: gits.KindGitHub,
Owner: "jenkins-x-quickstarts",
Includes: []string{"*"},
Excludes: []string{"WIP-*"},
},
}
)
// GetQuickstartLocations returns the current quickstart locations. If no locations are defined
// yet lets return the defaults
func GetQuickstartLocations(jxClient versioned.Interface, ns string) ([]v1.QuickStartLocation, error) {
var answer []v1.QuickStartLocation
env, err := EnsureDevEnvironmentSetup(jxClient, ns)
if err != nil {
return answer, err
}
if env == nil {
return answer, fmt.Errorf("No Development environment found for namespace %s", ns)
}
answer = env.Spec.TeamSettings.QuickstartLocations
if len(answer) == 0 {
answer = DefaultQuickstartLocations
}
return answer, nil
}