diff --git a/charts/jenkins/Chart.yaml b/charts/jenkins/Chart.yaml index 248b2fa0..8ca7687f 100644 --- a/charts/jenkins/Chart.yaml +++ b/charts/jenkins/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "v0.0.1" description: A Helm chart for deploying Jenkins on OpenShift name: jenkins -version: 0.0.2 +version: 0.0.3 home: https://github.com/rht-labs/charts maintainers: - name: springdo diff --git a/charts/jenkins/templates/buildconfig.yaml b/charts/jenkins/templates/buildconfig.yaml deleted file mode 100644 index 47cbe135..00000000 --- a/charts/jenkins/templates/buildconfig.yaml +++ /dev/null @@ -1,52 +0,0 @@ -{{- if .Values.buildconfig }} ---- -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: {{ .Values.buildconfig.name }} - labels: - build: {{ .Values.buildconfig.name }} - type: image -spec: - triggers: - - type: GitHub - github: - secret: {{ .Values.buildconfig.build_secret | quote }} - - type: GitLab - gitlab: - secret: {{ .Values.buildconfig.build_secret | quote }} - - type: BitBucket - bitbucket: - secret: {{ .Values.buildconfig.build_secret | quote }} - - type: Generic - generic: - secret: {{ .Values.buildconfig.build_secret | quote }} - allowEnv: true - - type: ConfigChange - runPolicy: Serial - source: - type: Git - {{- if .Values.buildconfig.source_secret }} - sourceSecret: - name: {{ .Values.buildconfig.source_secret }} - {{- end }} - git: - uri: {{ .Values.buildconfig.source_repo_url | quote }} - ref: {{ .Values.buildconfig.source_repo_ref | default "master" | quote }} - contextDir: {{ .Values.buildconfig.source_repo_context | quote }} - strategy: - type: Source - sourceStrategy: - from: - kind: ImageStreamTag - name: "{{ .Values.imagestream.name }}:{{ .Values.imagestream.builder_imagetag }}" - namespace: {{ .Values.imagestream.builder_repo }} - {{- if .Values.buildconfig.pull_secret }} - pullSecret: - name: {{ .Values.buildconfig.pull_secret | quote}} - {{- end }} - output: - to: - kind: ImageStreamTag - name: "{{ .Values.imagestream.name }}:latest" -{{- end}} \ No newline at end of file diff --git a/charts/jenkins/templates/buildconfigs.yaml b/charts/jenkins/templates/buildconfigs.yaml new file mode 100644 index 00000000..eab2c0ba --- /dev/null +++ b/charts/jenkins/templates/buildconfigs.yaml @@ -0,0 +1,66 @@ +{{- if .Values.buildconfigs }} +{{- range $key := .Values.buildconfigs }} +--- +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: {{ .name }} + labels: + build: {{ .name }} + type: image +spec: + triggers: + - type: "ConfigChange" +{{- if .build_trigger_secret }} + - type: GitHub + github: + secret: {{ .build_trigger_secret | quote }} + - type: GitLab + gitlab: + secret: {{ .build_trigger_secret | quote }} + - type: BitBucket + bitbucket: + secret: {{ .build_trigger_secret | quote }} + - type: Generic + generic: + secret: {{ .build_trigger_secret | quote }} + allowEnv: true + {{- end}} + runPolicy: Serial + source: + type: Git + {{- if .source_secret }} + sourceSecret: + name: {{ .source_secret }} + {{- end }} + git: + uri: {{ .source_repo | quote }} + ref: {{ .source_repo_ref | default "master" | quote }} + contextDir: {{ .source_context_dir | quote }} + strategy: + type: {{ .strategy_type }} +{{- if eq .strategy_type "Docker" }} + dockerStrategy: + dockerfilePath: {{ .dockerfilePath | default "Dockerfile" | quote }} + from: + kind: DockerImage + name: "{{ .builder_image_name }}:{{ .builder_image_tag }}" + imagePullPolicy: Always +{{- end }} +{{- if eq .strategy_type "Source" }} + sourceStrategy: + from: + kind: "ImageStreamTag" + name: "{{ .builder_image_name }}:{{ .builder_image_tag }}" + namespace: {{ .builder_image_namespace | default "openshift" | quote }} +{{- end }} + {{- if .pull_secret }} + pullSecret: + name: {{ .pull_secret | quote}} + {{- end }} + output: + to: + kind: ImageStreamTag + name: "{{ .name }}:latest" +{{- end}} +{{- end}} \ No newline at end of file diff --git a/charts/jenkins/templates/external-jenkins-imagestream.yaml b/charts/jenkins/templates/external-jenkins-imagestream.yaml deleted file mode 100644 index 354b6a8e..00000000 --- a/charts/jenkins/templates/external-jenkins-imagestream.yaml +++ /dev/null @@ -1,19 +0,0 @@ -{{- if .Values.imagestream.external }} ---- -kind: ImageStream -apiVersion: image.openshift.io/v1 -metadata: - name: {{ .Values.imagestream.name }} - annotations: - description: Tracks the Red Hat Jenkins base image, since openshift may not ship with the tag we need. Importing the image allows normal users to run the playbook. -spec: - tags: - - annotations: null - from: - kind: DockerImage - name: {{ .Values.imagestream.external.builder_registry }}/{{ .Values.imagestream.external.builder_repo }}/{{ .Values.imagestream.external.builder_image }}:{{ .Values.imagestream.external.builder_imagetag }} - importPolicy: {} - name: {{ .Values.imagestream.builder_imagetag | quote }} - referencePolicy: - type: Source -{{- end}} \ No newline at end of file diff --git a/charts/jenkins/templates/imagestream.yaml b/charts/jenkins/templates/imagestream.yaml deleted file mode 100644 index 0963e294..00000000 --- a/charts/jenkins/templates/imagestream.yaml +++ /dev/null @@ -1,9 +0,0 @@ -{{- if not .Values.imagestream.external }} ---- -kind: ImageStream -apiVersion: image.openshift.io/v1 -metadata: - name: {{ .Values.imagestream.name }} - annotations: - description: Keeps track of changes in the application image -{{ end }} \ No newline at end of file diff --git a/charts/jenkins/templates/imagestreams.yaml b/charts/jenkins/templates/imagestreams.yaml new file mode 100644 index 00000000..e93a25bd --- /dev/null +++ b/charts/jenkins/templates/imagestreams.yaml @@ -0,0 +1,26 @@ +{{- range $key := .Values.imagestreams }} +--- +kind: ImageStream +apiVersion: image.openshift.io/v1 +{{- if .name | regexFind ".*slave" }} +labels: + build: {{ .name }} + role: jenkins-slave +{{- end }} +metadata: + name: {{ .name }} + annotations: + description: Keeps track of changes in the application image +{{- if .external }} +spec: + tags: + - name: {{ .external.builder_imagetag | quote }} + annotations: null + from: + kind: DockerImage + name: {{ .external.builder_registry }}/{{ .external.builder_repo }}/{{ .external.builder_image }}:{{ .external.builder_imagetag }} + importPolicy: {} + referencePolicy: + type: Source +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/jenkins/values.yaml b/charts/jenkins/values.yaml index 55869507..20bbf14d 100644 --- a/charts/jenkins/values.yaml +++ b/charts/jenkins/values.yaml @@ -69,22 +69,48 @@ services: target_port: 5000 selector: *name -imagestream: - name: *name - external: - builder_registry: quay.io - builder_repo: openshift - builder_image: origin-jenkins - builder_imagetag: latest - builder_repo: openshift - builder_image: jenkins - builder_imagetag: '2' +imagestreams: + # Jenkins Imagestream for custom build or external + - name: *name + external: + builder_registry: quay.io + builder_repo: openshift + builder_image: origin-jenkins + builder_imagetag: latest + # Jenkins agents image streams + - name: jenkins-slave-mvn + - name: jenkins-slave-argocd + - name: jenkins-slave-helm -buildconfig: - name: *name - build_secret: 'shhhhh-this-is-my-super-duper-secret123-shhhhh' - source_secret: 'git-auth' - pull_secret: '' - source_repo_url: https://github.com/rht-labs/s2i-config-jenkins.git - source_repo_ref: v1.6 - source_repo_context: '/' +buildconfigs: + - name: *name + build_trigger_secret: 'shhhhh-this-is-my-super-duper-secret123-shhhhh' + strategy_type: "Source" + source_secret: 'git-auth' + pull_secret: '' + source_repo: https://github.com/rht-labs/s2i-config-jenkins.git + source_repo_ref: v1.6 + source_context_dir: '/' + builder_image_name: jenkins + builder_image_tag: '2' + - name: "jenkins-slave-mvn" + strategy_type: "Docker" + source_context_dir: "jenkins-slaves/jenkins-slave-mvn" + source_repo: "https://github.com/redhat-cop/containers-quickstarts" + source_repo_ref: "v1.20" + builder_image_name: "quay.io/openshift/origin-jenkins-agent-maven" + builder_image_tag: "4.2" + - name: "jenkins-slave-helm" + strategy_type: "Docker" + source_context_dir: "jenkins-slaves/jenkins-slave-helm" + source_repo: "https://github.com/redhat-cop/containers-quickstarts" + source_repo_ref: "v1.20" + builder_image_name: "registry.access.redhat.com/openshift3/jenkins-slave-base-rhel7" + builder_image_tag: "latest" + - name: "jenkins-slave-argocd" + strategy_type: "Docker" + source_context_dir: "jenkins-slaves/jenkins-slave-argocd" + source_repo: "https://github.com/redhat-cop/containers-quickstarts" + source_repo_ref: "v1.20" + builder_image_name: "registry.access.redhat.com/openshift3/jenkins-slave-base-rhel7" + builder_image_tag: "latest"