Skip to content

Getting Started

Rajan, Sarat edited this page Aug 22, 2019 · 2 revisions

Getting Started

Project Setup

To get started you will need to add two files to the root of your repository:

  1. Jenkinsfile : this is what bootstraps Jenkins to run POET pipeline code.
  2. pipeline.yml : this is POET's pipeline definition.

Plugins dependency

Have a look at the plugins needed to get started with POET pipeline.

Jenkinsfile

Create a file named Jenkinsfile in your project with the following contents:

@Library('poet-pipeline@master')

def wf = new com.tmobile.sre.jenkins.Workflow()
wf.start(agent_label: "Linux")

This just tells jenkins to load the code and bootstraps out pipeline. You won't really need to deal with this from now on.

Note that any branch or revision may be specified if you want to test out specific code, e.g. @Library('poet-pipeline@my_new_branch').

By default the pipeline workflow will look for a file called pipeline.yml, but you may specify an alternative by passing in pipeline: "my-pipeline-file.yml" (this can be handy for testing variations), as depicted below:

@Library('poet-pipeline@master')

def wf = new com.tmobile.sre.jenkins.Workflow()
wf.start(agent_label: "Linux", pipeline: "my-pipeline-file.yml")

More use cases and control options are captured here, for further reading.

pipeline.yml

Next, create a file named 'pipeline.yml'. This will contain your pipeline.

Here is an example minimal pipeline (1 step) to build a java project :

pipeline:
  appName: pipeline-test
  appVersion:
    master: 2.0.1
  steps:
    - name: build-jar
      image: maven:3-jdk-8-alpine
      commands:
        - mvn -Dmaven.repo.local=.m2 clean test package

Commit both these files to your repository.

This is where the real pipeline definiton lives. Continue on to the next section for more details.