OpenShift Build Configuration Definition
External
Internal
Source Strategy Example
apiVersion: v1 kind: BuildConfig metadata: labels: app: eap70-basic-s2i application: session-servlet template: eap70-basic-s2i xpaas: 1.4.0 name: session-servlet spec: strategy: type: Source sourceStrategy: env: - name: MAVEN_MIRROR_URL value: "..." - name: ARTIFACT_DIR value: "..." from: kind: ImageStreamTag name: jboss-eap70-openshift:1.5 namespace: openshift scripts: "http://novaordis.io/openshift/scripts_directory" forcePull: true source: contextDir: / git: ref: master uri: https://github.com/NovaOrdis/novaordis-session-servlet.git type: Git output: to: kind: ImageStreamTag name: session-servlet:latest failedBuildsHistoryLimit: 5 nodeSelector: null postCommit: {} resources: {} runPolicy: Serial successfulBuildsHistoryLimit: 5 triggers: - github: secret: v2h6dtKw7Gw3 type: GitHub - generic: secret: Euf3bjjw type: Generic - imageChange: type: ImageChange - type: ConfigChange status:
Elements
spec
strategy
sourceStrategy
env
Represents the environment that will be injected into the build container.
scripts
Represents the location to download the S2I scripts from. If specified in the build configuration, the scripts downloaded from that location take precedence over those embedded with the source code and those bundled with the builder image. This path will have "run", "assemble", and "save-artifacts" appended to it. If any or all scripts are found they will be used in place of the same named script(s) provided in the image or in the source code. The value is optional, in which case the scripts must exist in one of the previously mentioned location.
The location can be expressed in one of the following formats:
- image:///<path-to-script-directory> - the absolute path inside the image.
- file:///<path-to-script-directory> - relative or absolute path to a directory on the host where the scripts are located.
- http(s)://<path-to-script-directory> - URL to a directory where the scripts are located.
Configuration
Turn Off SSL Certificate Verification for Git
Add GIT_SSL_NO_VERIFY=true to the environment that will be injected into the build pod. This is valid for both source builds and pipeline builds:
apiVersion: v1 kind: BuildConfig spec: ... strategy: sourceStrategy: env: - name: GIT_SSL_NO_VERIFY value: "true"
apiVersion: v1 kind: BuildConfig spec: ... strategy: jenkinsPipelineStrategy: env: - name: GIT_SSL_NO_VERIFY value: "true"
Enable a Generic Webhook Trigger
A default build configuration already has a webhook trigger enabled, it is enabled by default when the configuration is created:
apiVersion: v1 kind: BuildConfig spec: triggers: - type: Generic generic: secret: Euf3bjjw
OpenShift will listen for invocations at the following URL: https://openshift.default.svc.cluster.local/oapi/v1/namespaces/<project-name>/buildconfigs/<build-configuration-name>/webhooks/<generic-secret-value>/generic