OpenShift Build Configuration Definition: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 23: Line 23:
  '''[[OpenShift_REST_Resource_Definition_Schema#spec|spec]]''':  
  '''[[OpenShift_REST_Resource_Definition_Schema#spec|spec]]''':  
   
   
   failedBuildsHistoryLimit: 5
   '''strategy''':
    '''type''': '''Source'''
   
   
  nodeSelector: null
    '''[[OpenShift_Build_Configuration_Definition#sourceStrategy|sourceStrategy]]''':
   
   
      '''[[OpenShift_Build_Configuration_Definition#env|env]]''':
          - name: MAVEN_MIRROR_URL
            value: "..."
          - name: ARTIFACT_DIR
            value: "..."
      forcePull: true
      from:
        kind: ImageStreamTag
        name: jboss-eap70-openshift:1.5
        namespace: openshift
 
   output:
   output:
     to:
     to:
       kind: ImageStreamTag
       kind: ImageStreamTag
       name: session-servlet:latest
       name: session-servlet:latest
  failedBuildsHistoryLimit: 5
  nodeSelector: null
   
   
   postCommit: {}
   postCommit: {}
Line 44: Line 61:
       uri: https://github.com/NovaOrdis/novaordis-session-servlet.git
       uri: https://github.com/NovaOrdis/novaordis-session-servlet.git
     type: Git
     type: Git
  '''strategy''':
    '''type''': '''Source'''
    '''[[OpenShift_Build_Configuration_Definition#sourceStrategy|sourceStrategy]]''':
      '''[[OpenShift_Build_Configuration_Definition#env|env]]''':
          - name: MAVEN_MIRROR_URL
            value: "..."
          - name: ARTIFACT_DIR
            value: "..."
      forcePull: true
      from:
        kind: ImageStreamTag
        name: jboss-eap70-openshift:1.5
        namespace: openshift
   
   
   successfulBuildsHistoryLimit: 5
   successfulBuildsHistoryLimit: 5

Revision as of 03:14, 7 December 2017

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: "..."
      forcePull: true
      from:
        kind: ImageStreamTag
        name: jboss-eap70-openshift:1.5
        namespace: openshift
 
  output:
    to:
      kind: ImageStreamTag
      name: session-servlet:latest
  failedBuildsHistoryLimit: 5

  nodeSelector: null

  postCommit: {}

  resources: {}

  runPolicy: Serial

  source:
    contextDir: /
    git:
      ref: master
      uri: https://github.com/NovaOrdis/novaordis-session-servlet.git
    type: Git

  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.

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