• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

the default GitOps source repository for booting up Jenkins X


Commit MetaInfo

Revisionc5728786f1a9713440b0367df33468b21365021d (tree)
Time2019-07-24 13:50:59
AuthorJames Strachan <james.strachan@gmai...>
CommiterJames Strachan

Log Message

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

Change Summary

Incremental Difference

--- a/env/jenkins-x-platform/values.tmpl.yaml
+++ b/env/jenkins-x-platform/values.tmpl.yaml
@@ -19,8 +19,8 @@ nexus:
1919 defaultAdminPassword: "{{ .Parameters.adminUser.password }}"
2020
2121 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 }}"
2424 MavenSettingsXML: |-
2525 <settings>
2626 <localRepository>/home/jenkins/.mvnrepository</localRepository>
--- a/env/lighthouse/values.tmpl.yaml
+++ b/env/lighthouse/values.tmpl.yaml
@@ -7,9 +7,9 @@ enabled: false
77 hmacToken: "{{ .Parameters.prow.hmacToken }}"
88
99 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" }}
1313
1414 service:
1515 name: hook
--- a/env/parameters.schema.json
+++ b/env/parameters.schema.json
@@ -26,6 +26,30 @@
2626 }
2727 }
2828 },
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+ },
2953 "prow": {
3054 "type": "object",
3155 "properties": {
@@ -38,13 +62,6 @@
3862 }
3963 }
4064 },
41- "gitProvider": {
42- "type": "string",
43- "title": "Select the git provider to use",
44- "enum": [
45- "github"
46- ]
47- },
4865 "enableDocker": {
4966 "type": "boolean",
5067 "title": "Do you want to configure an external Docker Registry?",
--- a/env/prow/values.tmpl.yaml
+++ b/env/prow/values.tmpl.yaml
@@ -5,8 +5,8 @@ enabled: false
55 {{- end }}
66
77 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 }}"
1010
1111 buildnum:
1212 enabled: false
--- a/env/tekton/values.tmpl.yaml
+++ b/env/tekton/values.tmpl.yaml
@@ -3,8 +3,9 @@ webhook:
33
44 auth:
55 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" }}
89
910 {{- if hasKey .Parameters "docker" }}
1011 docker:
--- a/env/templates/gh-secret.yaml
+++ b/env/templates/gh-secret.yaml
@@ -5,18 +5,17 @@ data:
55 username: {{ .Values.JenkinsXGitHub.username | b64enc | quote }}
66 kind: Secret
77 metadata:
8- name: jx-pipeline-git-github-github
8+ name: jx-pipeline-git-{{ .Values.gitops.gitKind | default "github" }}-{{ .Values.gitops.gitName | default "github" }}
99 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" }}
1212 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" }}
1615 labels:
1716 jenkins.io/created-by: jx
1817 jenkins.io/credentials-type: usernamePassword
1918 jenkins.io/kind: git
20- jenkins.io/service-kind: github
19+ jenkins.io/service-kind: {{ .Values.gitops.gitKind | default "github" }}
2120 type: Opaque
2221 {{- end }}
\ No newline at end of file
--- a/env/values.tmpl.yaml
+++ b/env/values.tmpl.yaml
@@ -11,8 +11,9 @@ cluster:
1111 {{- end }}
1212
1313 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" }}
1617 owner: ""
1718 webhook: {{ .Requirements.webhook | default "prow" | title | quote }}
1819
@@ -123,8 +124,8 @@ tekton:
123124 enabled: false
124125
125126 JenkinsXGitHub:
126- username: "{{ .Parameters.pipelineUser.github.username }}"
127- password: "{{ .Parameters.pipelineUser.github.token }}"
127+ username: "{{ .Parameters.pipelineUser.username }}"
128+ password: "{{ .Parameters.pipelineUser.token }}"
128129
129130 {{- if .Requirements.ingress.tls }}
130131 certmanager: