the default GitOps source repository for booting up Jenkins X
Révision | c5728786f1a9713440b0367df33468b21365021d (tree) |
---|---|
l'heure | 2019-07-24 13:50:59 |
Auteur | James Strachan <james.strachan@gmai...> |
Commiter | James Strachan |
fix: support different git servers + kinds
* let make it easier to support different kinds of git provider kinds; by moving the git server, name and kind into the requirements and removing the 'github' complexity and hard coding in the parameters schema + yaml.
* populate the values.cluster.* values for helm charts from the requirements
@@ -19,8 +19,8 @@ nexus: | ||
19 | 19 | defaultAdminPassword: "{{ .Parameters.adminUser.password }}" |
20 | 20 | |
21 | 21 | PipelineSecrets: |
22 | - GitCreds: "https://{{ .Parameters.pipelineUser.github.username }}:{{ .Parameters.pipelineUser.github.token }}@{{ .Parameters.pipelineUser.github.host }}" | |
23 | - GithubToken: "{{ .Parameters.pipelineUser.github.token }}" | |
22 | + GitCreds: https://{{ .Parameters.pipelineUser.username }}:{{ .Parameters.pipelineUser.token }}@{{ trimPrefix "https://" .Requirements.cluster.gitServer | default "https://github.com" | }} | |
23 | + GithubToken: "{{ .Parameters.pipelineUser.token }}" | |
24 | 24 | MavenSettingsXML: |- |
25 | 25 | <settings> |
26 | 26 | <localRepository>/home/jenkins/.mvnrepository</localRepository> |
@@ -7,9 +7,9 @@ enabled: false | ||
7 | 7 | hmacToken: "{{ .Parameters.prow.hmacToken }}" |
8 | 8 | |
9 | 9 | git: |
10 | - kind: github | |
11 | - name: github | |
12 | - server: "" | |
10 | + kind: {{ .Requirements.cluster.gitKind | default "github" }} | |
11 | + name: {{ .Requirements.cluster.gitName | default "github" }} | |
12 | + server: {{ .Requirements.cluster.gitServer | default "https://github.com" }} | |
13 | 13 | |
14 | 14 | service: |
15 | 15 | name: hook |
@@ -26,6 +26,30 @@ | ||
26 | 26 | } |
27 | 27 | } |
28 | 28 | }, |
29 | + "pipelineUser": { | |
30 | + "type": "object", | |
31 | + "required": [ | |
32 | + "host", | |
33 | + "username", | |
34 | + "token" | |
35 | + ], | |
36 | + "properties": { | |
37 | + "username": { | |
38 | + "type": "string", | |
39 | + "title": "Pipeline bot Git username", | |
40 | + "description": "The Git user that will perform git operations inside a pipeline. It should be a user within the Git organisation/owner where environment repositories will live. This is normally a bot." | |
41 | + }, | |
42 | + "token": { | |
43 | + "type": "string", | |
44 | + "format": "token", | |
45 | + "title": "Pipeline bot Git token", | |
46 | + "description": "A token for the Git user that will perform git operations inside a pipeline. This includes environment repository creation, and so this token should have full repository permissions. To create a token go to https://github.com/settings/tokens/new?scopes=repo,read:user,read:org,user:email,write:repo_hook,delete_repo then enter a name, click Generate token, and copy and paste the token into this prompt.", | |
47 | + "minLength": 40, | |
48 | + "maxLength": 40, | |
49 | + "pattern": "^[0-9a-f]{40}$" | |
50 | + } | |
51 | + } | |
52 | + }, | |
29 | 53 | "prow": { |
30 | 54 | "type": "object", |
31 | 55 | "properties": { |
@@ -38,13 +62,6 @@ | ||
38 | 62 | } |
39 | 63 | } |
40 | 64 | }, |
41 | - "gitProvider": { | |
42 | - "type": "string", | |
43 | - "title": "Select the git provider to use", | |
44 | - "enum": [ | |
45 | - "github" | |
46 | - ] | |
47 | - }, | |
48 | 65 | "enableDocker": { |
49 | 66 | "type": "boolean", |
50 | 67 | "title": "Do you want to configure an external Docker Registry?", |
@@ -5,8 +5,8 @@ enabled: false | ||
5 | 5 | {{- end }} |
6 | 6 | |
7 | 7 | hmacToken: "{{ .Parameters.prow.hmacToken }}" |
8 | -oauthToken: "{{ .Parameters.pipelineUser.github.token }}" | |
9 | -user: "{{ .Parameters.pipelineUser.github.username }}" | |
8 | +oauthToken: "{{ .Parameters.pipelineUser.token }}" | |
9 | +user: "{{ .Parameters.pipelineUser.username }}" | |
10 | 10 | |
11 | 11 | buildnum: |
12 | 12 | enabled: false |
@@ -3,8 +3,9 @@ webhook: | ||
3 | 3 | |
4 | 4 | auth: |
5 | 5 | git: |
6 | - username: "{{ .Parameters.pipelineUser.github.username }}" | |
7 | - password: "{{ .Parameters.pipelineUser.github.token }}" | |
6 | + username: "{{ .Parameters.pipelineUser.username }}" | |
7 | + password: "{{ .Parameters.pipelineUser.token }}" | |
8 | + url: {{ .Requirements.cluster.gitServer | default "https://github.com" }} | |
8 | 9 | |
9 | 10 | {{- if hasKey .Parameters "docker" }} |
10 | 11 | docker: |
@@ -5,18 +5,17 @@ data: | ||
5 | 5 | username: {{ .Values.JenkinsXGitHub.username | b64enc | quote }} |
6 | 6 | kind: Secret |
7 | 7 | metadata: |
8 | - name: jx-pipeline-git-github-github | |
8 | + name: jx-pipeline-git-{{ .Values.gitops.gitKind | default "github" }}-{{ .Values.gitops.gitName | default "github" }} | |
9 | 9 | annotations: |
10 | - build.knative.dev/git-0: https://github.com | |
11 | - jenkins.io/credentials-description: API Token for acccessing https://github.com | |
10 | + build.knative.dev/git-0: {{ .Values.gitops.server | default "https://github.com" }} | |
11 | + jenkins.io/credentials-description: API Token for acccessing {{ .Values.gitops.server | default "https://github.com" }} | |
12 | 12 | Git service inside pipelines |
13 | - jenkins.io/foo: bar | |
14 | - jenkins.io/name: GitHub | |
15 | - jenkins.io/url: https://github.com | |
13 | + jenkins.io/name: {{ .Values.gitops.gitName | default "github" }} | |
14 | + jenkins.io/url: {{ .Values.gitops.server | default "https://github.com" }} | |
16 | 15 | labels: |
17 | 16 | jenkins.io/created-by: jx |
18 | 17 | jenkins.io/credentials-type: usernamePassword |
19 | 18 | jenkins.io/kind: git |
20 | - jenkins.io/service-kind: github | |
19 | + jenkins.io/service-kind: {{ .Values.gitops.gitKind | default "github" }} | |
21 | 20 | type: Opaque |
22 | 21 | {{- end }} |
\ No newline at end of file |
@@ -11,8 +11,9 @@ cluster: | ||
11 | 11 | {{- end }} |
12 | 12 | |
13 | 13 | gitops: |
14 | - gitKind: github | |
15 | - server: https://github.com | |
14 | + gitKind: {{ .Requirements.cluster.gitKind | default "github" }} | |
15 | + gitName: {{ .Requirements.cluster.gitName | default "github" }} | |
16 | + server: {{ .Requirements.cluster.gitServer | default "https://github.com" }} | |
16 | 17 | owner: "" |
17 | 18 | webhook: {{ .Requirements.webhook | default "prow" | title | quote }} |
18 | 19 |
@@ -123,8 +124,8 @@ tekton: | ||
123 | 124 | enabled: false |
124 | 125 | |
125 | 126 | JenkinsXGitHub: |
126 | - username: "{{ .Parameters.pipelineUser.github.username }}" | |
127 | - password: "{{ .Parameters.pipelineUser.github.token }}" | |
127 | + username: "{{ .Parameters.pipelineUser.username }}" | |
128 | + password: "{{ .Parameters.pipelineUser.token }}" | |
128 | 129 | |
129 | 130 | {{- if .Requirements.ingress.tls }} |
130 | 131 | certmanager: |