In this tutorial, you will create a CDS Workflow with the Web UI.
Let’s create a project. On the top navbar, click on ‘Create a project’.
The project is now create, you have to link a repository manager. Be sure to have a Repository manager as GitHub, Bitbucket Server or GitLab set up on your CDS Instance.
Select ‘Advanced’ section
In the section ‘Link to a repository manager’, select ‘github’, then click on ‘Connect’
A popup is displayed, Click on ‘Click here’ to finalize the link with GitHub. By doing that, you allow CDS to create hook on GitHub.
Here, GitHub is well linked on your CDS project.
You’ve got a project, linked to GitHub. Let’s create an application.
A CDS Application is useful to have a link to a Git Repository.
Go on Project -> Applications tab, click on ‘Create a new application’
Enter application name, here ‘my-java-app’
Go on Advanced tab, select a Repository
Expand configuration, select ‘https’. If your repository is public, you can keep empty fields, then click on ‘Save’
This token will be used to let CDS create a tag.
Create a token on GitHub.
GitHub give you a token, put it in password field.
Notice: the build pipeline does nothing here. You can add some job inside it, please read this tutorial to create a ‘build’ pipeline.
Create the pipeline
Then select your application.
Click on create to create the workflow.
In this example, we create a Workflow to build, tag and release an application.
So, we have to trigger this workflow on each commit, on every git branches - and on each tag created. This will be useful to compile code from all developer and sometimes create a tag from master branch if the build is Success.
The application is linked to a GitHub Git Repository, we have two choices to trigger automatically the workflow:
The difference between both is simple: a Git Repository Webhook does not work if your CDS Instance is not reachable from GitHub. So, we have to add a Git Repository Poller
version: v1.0
name: create-tag
parameters:
tagLevel:
type: list
default: major;minor;patch
description: major, minor or patch
jobs:
- job: CreateTag
steps:
- checkout: '{{.cds.workspace}}'
- gitTag:
path: '{{.cds.workspace}}'
tagLevel: '{{.cds.pip.tagLevel}}'
tagMessage: Release from CDS run {{.cds.version}}
Select the pipeline ‘build-pipeline’, then click on the sidebar ‘Add a pipeline’
Edit the pipeline ‘create-tag’
Click on Edit as Code button, then paste that code:
Pipeline is created
The workflow is now ready to be launched, but before launch it, let’s configure some Run Condition on the pipeline ‘create-tag’. We don’t want to launch it on each commit - we want to decide when to launch it.
Edit Run Conditions.
Launch the workflow.
The workflow is stopped, because you set cds.manual to true in your run conditions.
Select the pipeline, then click on the ‘play’ button.
You can choose the tag level.
Tag is created, cf. step logs.
Tag is created on GitHub.
Release action action is implemented for GitHub only. You can use it to create a release from a tag and push some artifacts on it.