Init a CDS Workflow from a repository

In this tutorial, you will create a CDS Workflow from an existing git repository.

  • This will creates you some files inside your local git repository.
  • Then you’ll can push them to get a CDS workflow lives with his configuration ‘as code’.

Prerequisites

To get started with CDS

$ cd <path-to-repo>
$ cdsctl login -H <cds-api-url>
# you will be ask for your username and password
$ cdsctl workflow init

This will ask you to choose:

$ cdsctl workflow init
Choose the CDS project
   FIRSTPROJECT - MyFirstProject [1]
Your choice [1-1]: 1
Initializing workflow from sguiheux/cdsdemo (git@github.com:sguiheux/cdsdemo.git)...
Choose the repository manager
   github [1]
Your choice [1-1]: 1
application FIRSTPROJECT/cdsdemo (sguiheux/cdsdemo) found in CDS
Do you want to reuse an existing pipeline? [y/n]: n
Enter your pipeline name: MyPipeline
File .cds/cdsdemo.yml created
File .cds/MyPipeline.pip.yml created
Pushing workflow to CDS...
   Pipeline MyPipeline successfully created
   Workflow cdsdemo has been updated
Now you can run: git add .cds/ && git commit -s -m "chore: init CDS workflow files"
You should consider add the following keys in githubpgp
-----BEGIN PGP PUBLIC KEY BLOCK-----

xsBNBFqn6wYBCAC3nVRHO/QxBZqvD27jm3f8KhSBA2cxccHSoFQIRykkVy6kLzth
VV2fxcEOiI9frKBxPQUKeTKQPBkbvqR9/JrP+h0opmLTQ9mQ4l5ax1K7fWazTUlR
le/fOljJtkjEs9GnsSe348CDc00aN5giQcL6NRyM0IbmYDPo/bcTXRZa/zJYnFAK
V11AAVLvjokDtA2vFDce6sqaPsu/y4M1tm2vPhef1kvJb3W4kH5soEGem5apKZ81
kvmmfjxVUFEUZKPGWZEIQli1RP8mTLTi+3B6C7klMkId8tyMo7HD/GGTwHgM3GN1
/7wTr7SUmIzyg1lTMseAugorIF/2MRqzmWbBABEBAAHNLmFwcC1wZ3AtZ2l0aHVi
IChhcHAtcGdwLWdpdGh1YikgPGNkc0Bsb2NhaG9zdD7CwGkEEwEIAB0FAlqn6wYJ
EJp/Gt0iarUSAhsDAhkBAwsJAgIVCgAAtqYIABMo6JFExLVu3O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----END PGP PUBLIC KEY BLOCK-----

ssh
ssh-rsa AAAAB3NzaC1yc2EAA30AADAQABAA06ACAQDyUXiY45Z9Bai7nsj8Tk2olZIwaDhYlBjw60TOlNLWVSvzNS5K+Rps8AA1985A7pcS1tbWtfC2xNMjRN7NznVatioHXgozLTQ/EhKOuEevOp4mCCuebUc62m/14pGKsCN/ikHb6Ca/rf0+NOKt+UUYAOvyVt7FM3NydyT8VrPZWonxULzOIDcPpyZPfbnpuooCZjK2IuaU1pzPxDgszks77bkPePKujhp17Ckfzi+Ke3SgHGr9399UgY8dD6wqvRd+xNQA+EUQNa9SGg5MJ4LgTlqiE+0s/qg7pVUtCLqTo6fSUK0oumkpClmsdwmgnBtfG+5Belli3sMJUHOdw9fQpKUYITQ6jFAaciVzXpdt9j0ImQytz8nP5cd4lpPuv5fHNbx39G7KqdraVsqe3I9Y8RSf2kCVvRON9TthRleYHoxukztsSuxcxeZ0GtaIbIauYymrAvRrAV1harOwSrFThY6sTWyofpZnKesG6S7omIGn5ZjZDtT2p5tiGnZh3gZlS2sHLALyoShUjHxgcOd2h4CMuC1JN63t94rXWfbTYH+eraAhufmnayLC8p4UM/lc0syQBy1aKywR+acScICww20xEt8SG3D5rAlJD5d2EPhJaEzGS0NC6apiaQ2CNlvaceWFoEDbkXj0TL4M0iX42va5Ry1jvo8IPwJ9MoAXrVlowyw== app-ssh-github@cds
git add .cds/ && git commit -s -m "chore: init CDS workflow files"
$ cdsctl workflow status --track
cdsdemo [b226e84 | steven.guiheux] #1.0 ➤ ✓ MyPipeline     

Run1

Update pipeline to execute a mvn package

version: v1.0
name: MyPipeline
jobs:
- job: First job
  steps:
  - checkout: '{{.cds.workspace}}'
  - script: mvn package
  - artifactUpload: target/*.jar
  requirements:
  - binary: mvn
  - binary: git

$ cdsctl workflow status --track
cdsdemo [d98bd14 | steven.guiheux] #2.0 ➤ ✓ MyPipeline

Run2