MettleCI Example Pipeline for DevOps
Here is a summary of the DevOps pipeline along with a detailed description of each Stage, Job, and Task. In the example below Test_CI is a Stage, Compliance_Test_WARN is a Job within that Stage, and the tasks within this Job are detailed in the page below. Different build tools employ different terminology, but Stage, Job and Task are commonly adopted.
This example uses a screenshot from Microsoft Azure DevOps (below), but the process is identical regardless of the build tool being used. You can use this description to create a MettleCI build pipeline using a build tool for which we do not currently provide a pipeline template.
Select the pipeline stage to jump to its description:
Notes
Note that every build Job has implicit access to the DataStage asset repository where this pipeline definition is stored. Some build tools make this explicit and produce a log entry showing this. For example Azure DevOps automatically introduces a task at the beginning of each Job with a title for the form
Checkout <repository-name@<branch> to s\<project-name>
.Some of the pipeline templates (e.g.
deploy_template.yml
) are parameterised, meaning they may perform different tasks based on the context within which they are invoked (e.g. deploying to legacy vs. deploying to target)
Upgrade Pipeline - Stages, Jobs, and Tasks
1. Diagnostics
This stage is simply a diagnostic step to help with initial development of your pipeline. Once you have confirmed that your pipeline is behaving as required you can safely delete this step.
Diagnostics
# | Task | Command | Description |
---|---|---|---|
1 | Diagnostics v11.7 | various | Uses the Build Agent to log environment variables and variable groups for diagnostics purposes. |
2. Create DSParams Diff Artifact
Create DSParams Diff Artifact
# | Task | Command | Description |
---|---|---|---|
1 | Fetch template DSParams |
| Fetch the template
|
2 | Create artefacts directory | Inline script | Verify that the build directory |
3 | Generate diff |
| Generate a |
4 | Publish diff artefact | Build tool specific | Define the |
3. Deploy CI
Deploy to Continuous Integration
This Job is defined in pipeline template deploy_template.yml
# | Task | Command | Description |
---|---|---|---|
1 | Download artefact | Build tool specific | Download the previously-created |
2 | Create project |
| Verify that the CI project exists (otherwise, create it). |
3 | Configure properties |
| Replace variables in the This example operates on *.sh files in the 'datastage' base directory, the DSParams file, and all Parameter Sets using values from the file 'var.ci' (as determined by the environmentId parameter) // Substituted files are created in a new temporary build directory on your build agent host called 'config'
|
4 | Upload config files |
| Upload the |
5 | Execute deploy script |
| Execute your |
6 | Deploy DataStage assets |
| Perform an incremental deployment of your DataStage assets to the CI project. |
7 | Cleanup |
| Execute the script |
8 | Check for results | Inline script | Detects and records (in a build pipeline variable) whether the Job compilation performed by the Deploy DataStage assets task produced an output JUnit |
9 | Publish compilation results | Build tool specific | If a JUnit |
4. Test CI
Compliance Test Warnings
This Job is defined in pipeline template compliance_template.yml
.
# | Task | Command | Description |
---|---|---|---|
1 | Checkout Compliance repository | Build tool specific | Make the Compliance repository (separate to the DataStage asset repository, where this pipeline definition is stored) accessible to the build agent. |
2 | Run Compliance Warnings |
| Invokes MettleCI Compliance checks for changes jobs. Note that in this mode (including the
|
3 | Check for results | Build tool specific | Detects and records (in a build pipeline variable) whether the Compliance check performed by the Run Compliance task produced an output JUnit |
4 | Publish compliance results | Build tool specific | If a JUnit |
Compliance Test Failures
This Job is defined in pipeline template compliance_template.yml
# | Task | Command | Description |
---|---|---|---|
1 | Checkout Compliance repository | Build tool specific | Make the Compliance repository (separate to the DataStage asset repository, where this pipeline definition is stored) accessible to the build agent. |
2 | Run Compliance (CI FAIL) |
| Invoke MettleCI Compliance checks for changes jobs. Note that in this mode (omitting the |
3 | Check for results | Inline script | Detects and records (in a build pipeline variable) whether the Compliance check performed by the Run Compliance task produced an output JUnit |
4 | Publish compliance results | Build tool specific | If a JUnit |
Unit Test
This Job is defined in pipeline template unittest_template.yml
# | Task | Command | Description |
---|---|---|---|
1 | Upload config files |
| Upload the file |
2 | Upload unit test specs |
| Upload your repository’s |
3 | Configure properties | | Replace variables in the |
4 | Create unit test report dir |
| Create directory to receive unit test outputs. |
5 | Run Unit Tests |
| Invoke the Unit Tests defined in your |
6 | Download unit test reports |
| Download any JUnit |
7 | Cleanup |
| Execute the script stored in the repository file |
8 | Check for results | Inline script | Detects and records (in a build pipeline variable) whether the Unit Test execution performed by the Run Unit Tests task produced an output JUnit |
9 | Publish compilation results | Build tool specific | If a JUnit |
5. Deploy QA
Deploy to Upgrade Target - Continuous Integration
This Job is defined in pipeline template deploy_template.yml
# | Task | Command | Description |
---|---|---|---|
1 | Download artefact | Build tool specific | Download the previously-created |
2 | Create project |
| Verify that the target CI project exists (otherwise, create it) |
3 | Fetch template DSParams |
| Download the target DataStage environment’s template |
4 | Create artefacts directory | Inline script | Verify that the build directory |
5 | Fetch diff | Build tool specific | Fetch the previously-generated |
6 | Generate merged DSParams file |
| Replace variables in the |
7 | Configure properties |
| Replace variables in the |
8 | Upload config files |
| Upload the |
9 | Execute deploy script |
| Execute the script |
10 | Deploy DataStage assets |
| Perform an incremental deployment of your DataStage assets to the target CI project. |
11 | Cleanup |
| Execute the |
12 | Check for results | Inline script | Detects and records (in a build pipeline variable) whether the Job compilation performed by the Deploy DataStage assets task produced an output JUnit |
13 | Publish compilation results | Build tool specific | If a JUnit |
7. Deploy Perf
This stage is identical to Deploy QA above but acts on the Performance environment.
8. Deploy Prod
This stage is identical to Deploy QA above but acts on the Production environment.
© 2015-2024 Data Migrators Pty Ltd.