OpenShift Build Configuration Definition

From NovaOrdis Knowledge Base
Revision as of 07:09, 7 December 2017 by Ovidiu (talk | contribs) (→‎env)
Jump to navigation Jump to search

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 pod.


=scripts

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:

apiVersion: v1
kind: BuildConfig
spec: 
  ...
  strategy:
     sourceStrategy:
       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