Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 4 Next »

Structure

The Jenkins DevOps pipeline is defined in a “Jenkinsfile” (by default named Jenkinsfile ) and has the following structure (most detail omitted)

pipeline {
    agent { ... }
    parameters { ... }
    environment { ... }
    stages {
          stage { ... }
          stage { ... }
          ...
    }
}

To understand these sections in more detail, refer to your Jenkins documentation. We present only the MettleCI specific things you need to know. Note that Jenkins offers flexibility in where some of these sections are placed, and in some cases, allows repetition at different scopes. The {} are scope delimiters.

Sections before “stages”

The Agent section denotes what class of machines your pipeline can be executed on. For a CI/CD pipeline, you only need to specify this once since all projects are at the same release level. For an upgrade pipeline you may want to specify the agents within the stage so that different stages run on different release levels. In the example below the label should match the label you gave your agent on the MettleCI host when you set it up. Pipelines will stall if no running agent with the (matching set of) label(s) is found.

    agent {
        label 'mettleci:datastage11.7.1'
    }

The Parameters section enumerates the parameters to the pipeline with their default values. The four parameters and their meanings are discussed in Deploying a Jenkins Pipeline … note that parameters are immutable, and once set at pipeline (or scope section) start, cannot be changed.

    parameters {
        string(name: 'domainName', defaultValue: 'demo4-svcs.datamigrators.io:59445', description: 'DataStage Service Tier')
        string(name: 'serverName', defaultValue: 'demo4-engn.datamigrators.io', description: 'DataStage Engine Tier')
        string(name: 'projectName', defaultValue: 'wwi_jenkins_ds117', description: 'Logical (unsuffixed) Project Name')
        string(name: 'environmentId', defaultValue: 'ci', description: 'Environment Identifer')
    }

When run interactively, the user will be prompted for these at pipeline start time like so:

The environment section allows you to derive or set further useful variables.

  • No labels