Skip to content
Nigel Babu edited this page Oct 4, 2018 · 1 revision

How to write a new job

Structuring your code

I'm going to give this example where you want a write a job called glusterd2-smoke. The standard is put your yaml in glusterd2-smoke.yml and the scripts that you write into scripts/glusterd2-smoke folder. You need at least one script to perform actions on your worker nodes.

The workflow for Centos CI is different from a regular Jenkins job. There are two flows on how to do this based on whether you're going to test on one node or whether you're going to test on multiple nodes.

Test with one node

  1. You call get-node.sh in builders.yml in your job. This will get you a node to work with. The IP address will be placed in the hosts and the SSID will be placed in cico-ssid. This is required for clean up.:

    builders:

    • shell: !include-raw: scripts/common/get-node.sh
  2. If you already have a script that can do the setup for you inside this clean VM, you call that script next as a parameter to bootstrap.sh. Any environment variable your script needs should be passed on this line or it will not be in the environment of the node.

    builders:

    • shell: !include-raw: scripts/common/get-node.sh
    • shell: scripts/common/bootstrap.sh $WORKSPACE/scripts/my-job/my-job.sh "ENV_VAR=$ENV_VAR ENV_VAR2=$ENV_VAR2"
  3. Remember to add a publisher that calls return-node.sh.

    • post-tasks:
      • matches:

        "Building remotely" should always be in the build console output

        • log-text: Building remotely script: !include-raw: scripts/common/return-node.sh