---
|
kind: Template
|
apiVersion: v1
|
metadata:
|
name: jenkins-s2i
|
annotations:
|
openshift.io/display-name: Jenkins S2I
|
description: Jenkins S2I build config to create a Jenkins image with your configuration
|
baked in.
|
iconClass: icon-jenkins
|
tags: instant-app,jenkins
|
objects:
|
- apiVersion: v1
|
data:
|
password: "${SOURCE_REPOSITORY_PASSWORD}"
|
username: "${SOURCE_REPOSITORY_USERNAME}"
|
kind: Secret
|
metadata:
|
name: gitlab-auth
|
type: kubernetes.io/basic-auth
|
- kind: ImageStream
|
apiVersion: v1
|
metadata:
|
name: "${NAME}"
|
annotations:
|
description: Keeps track of changes in the application image
|
- kind: ImageStream
|
apiVersion: v1
|
metadata:
|
name: ${BUILDER_IMAGE_STREAM_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: registry.access.redhat.com/openshift3/jenkins-2-rhel7:${BUILDER_IMAGE_STREAM_TAG_NAME}
|
importPolicy: {}
|
name: ${BUILDER_IMAGE_STREAM_TAG_NAME}
|
referencePolicy:
|
type: Source
|
- kind: BuildConfig
|
apiVersion: v1
|
metadata:
|
name: "${NAME}"
|
labels:
|
build: "${NAME}"
|
type: image
|
spec:
|
triggers:
|
- type: GitHub
|
github:
|
secret: "${BUILD_SECRET}"
|
- type: GitLab
|
gitlab:
|
secret: "${BUILD_SECRET}"
|
- type: Generic
|
generic:
|
secret: "${BUILD_SECRET}"
|
allowEnv: true
|
- type: ConfigChange
|
runPolicy: Serial
|
source:
|
type: Git
|
sourceSecret:
|
name: "gitlab-auth"
|
git:
|
uri: "${SOURCE_REPOSITORY_URL}"
|
ref: "${SOURCE_REPOSITORY_REF}"
|
contextDir: "${SOURCE_REPOSITORY_CONTEXT_DIR}"
|
strategy:
|
type: Source
|
sourceStrategy:
|
env:
|
- name: "GIT_SSL_NO_VERIFY"
|
value: "true"
|
from:
|
kind: ImageStreamTag
|
name: "${BUILDER_IMAGE_STREAM_NAME}:${BUILDER_IMAGE_STREAM_TAG_NAME}"
|
namespace: "${IMAGE_STREAM_NAMESPACE}"
|
output:
|
to:
|
kind: ImageStreamTag
|
name: "${NAME}:latest"
|
parameters:
|
- name: NAME
|
displayName: Name
|
description: The name assigned to all objects and the resulting imagestream.
|
required: true
|
value: jenkins
|
- name: BUILD_SECRET
|
displayName: Webhook Secret for builds
|
description: A secret string used to configure the build webhooks.
|
generate: expression
|
from: "[a-zA-Z0-9]{40}"
|
- name: SOURCE_REPOSITORY_URL
|
displayName: Git Repository URL
|
description: The URL of the repository with your application source code.
|
required: true
|
- name: SOURCE_REPOSITORY_REF
|
displayName: Git Reference
|
description: Set this to a branch name, tag or other ref of your repository if you are not using the default (master) branch.
|
default: master
|
- name: SOURCE_REPOSITORY_CONTEXT_DIR
|
displayName: Git Reference
|
description: The directory in the source repository where the SonarQube docker build is.
|
- name: BUILDER_IMAGE_STREAM_NAME
|
displayName: Builder Image Stream Name
|
description: The Jenkins builder Image Stream Tag (e.g. jenkins)
|
required: true
|
value: jenkins
|
- name: BUILDER_IMAGE_STREAM_TAG_NAME
|
displayName: Builder Image Stream Tag Name
|
description: The Jenkins builder Image Stream Tag Name (e.g. v3.9)
|
required: true
|
value: v3.9
|
- name: IMAGE_STREAM_NAMESPACE
|
displayName: Builder ImageSteam Tag
|
description: The namespace where the Jenkins builder Image Stream lives
|
required: true
|
value: openshift
|
- name: SOURCE_REPOSITORY_USERNAME
|
displayName: Git Repo Username
|
description: Username to have the builder pod auth against git
|
required: true
|
value: jenkins
|
- name: SOURCE_REPOSITORY_PASSWORD
|
displayName: Git Repo Password
|
description: Password to have the builder pod auth against git
|
required: true
|
value: password
|