Sign Up for the Quarterly Newsletter

Code Stream Concourse Integrator

The Code Stream Concourse Integrator (CSCI) Fling provides integration between a vRealize Automation Code Stream and Concourse CI tools with which users can trigger Concourse CI pipelines from Code Stream pipelines without any additional tooling/scripting. This enables users to use the features from both the tools flexibly and seamlessly as per their needs. This solution is built using Code Stream’s extensibility feature named Custom Integration.

Related Products
  • vRealize Automation Code Stream
  • Concourse CI

Note: the image is obtained dynamically by following the instructions below.

  1. Add docker endpoint to the Codestream.
  2. Add Custom Integration which will be used to trigger the Concourse pipeline. This custom integration takes apiToken, operationName, concourseURL, concourseTeam, pipelineToTrigger and jobName as input.


  3. ---
    runtime: shell
    code: |
        /app/bin/concourse-integration $apiToken $operationName $concourseURL $concourseTeam $pipelineToTrigger $jobName
        source /app/bin/output.txt
        export $(cut -d= -f1 /app/bin/output.txt)
    inputProperties:
      - name: operationName
        type: select
        title: operationName
        placeHolder: Operation Name
        defaultValue:
        bindable: true
        labelInfo: true
        labelMessage:
        options:
           - optionKey : poll-trigger-pipeline
             optionValue : Trigger Concourse Pipeline
      - name: concourseURL
        type: text
        title: concourseURL
        placeHolder: Concourse URL
        defaultValue:
        bindable: true
        labelInfo: true
        labelMessage:
      - name: concourseTeam
        type: text
        title: concourseTeam
        placeHolder: Concourse Team
        defaultValue:
        bindable: true
        labelInfo: true
        labelMessage:
      - name: pipelineToTrigger
        type: text
        title: pipelineToTrigger
        placeHolder: Pipeline to trigger
        defaultValue:
        bindable: true
        labelInfo: true
        labelMessage:
      - name: apiToken
        type: text
        title: apiToken
        placeHolder: API token
        defaultValue:
        bindable: true
        labelInfo: true
        labelMessage:
      - name: jobName
        type: text
        title: jobName
        placeHolder: Job to trigger
        defaultValue:
        bindable: true
        labelInfo: true
        labelMessage:
    outputProperties:
      - name: ImageId
        type: label
        title: Image tag
      - name: ConcourseBuildUrl
        type: label
        title: Concourse Build Url
      - name: ConcourseBuildNumber
        type: label
        title: Concourse Build Number
    
  4. Make sure we generate an API token and put that to the Codestream variables.
  5. Click on the Download button on this fling and you will get the Image URL in PDF file. Use that image URL in the below pipeline.
  6. Create a Pipeline that will be used to trigger the concourse pipeline. Sample pipeline yaml

  7. ---
    project: CMBU on CMBU
    kind: PIPELINE
    name: cs-concourse-integration
    icon: organization,left, is-purple
    enabled: true
    description: ''
    concurrency: 50
    workspace:
      endpoint: pipeline-as-code
      image: {Image URL From Downloaded PDF}
      registry: ''
      path: /app/bin
      autoCloneForTrigger: false
      limits:
        memory: 512
        cpu: 1.0
    stageOrder:
    - trigger
    stages:
      trigger:
        taskOrder:
        - trigger-pipeline
        - deploy-image
        tasks:
          trigger-pipeline:
            type: Custom
            input:
              name: cs-concourse
              version: v7
              properties:
                operationName: poll-trigger-pipeline
                concourseURL: https://runway-ci.svc-stage.eng.vmware.com
                concourseTeam: CMBU-DevOps
                pipelineToTrigger: cs-runway-demo-1
                apiToken: ${var.cs-concourse-integration-bearer-token}
                jobName: build-and-push
          deploy-image:
            type: Jenkins
            endpoints:
              jenkinsServer: vrbc-jenkins
            input:
              job: deploy
              parameters:
                API_BUILD_NUMBER: ${trigger.trigger-pipeline.output.properties.ImageId}
    
  8. Now this above pipeline can be used to trigger the concourse pipeline and will take back these properties to the Codestream pipeline.
    1. ImageId: This will be commit_id in this version.
    2. ConcourseBuildNumber: The triggered build number in Concourse.
    3. ConcourseBuildUrl: The triggered build URL from Concourse

  9. Now the above output properties can be used to do CD (continuous deployment) within Codestream.