Skip to content

Instantly share code, notes, and snippets.

@yorammi
Last active November 16, 2019 23:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorammi/a2473b7256b0f602bc21187614f11f92 to your computer and use it in GitHub Desktop.
Save yorammi/a2473b7256b0f602bc21187614f11f92 to your computer and use it in GitHub Desktop.
Jenkins Pipeline 101 and TCI workshop information page

Jenkins Pipeline 101 and TCI workshop

Steps to load a TCI server

  • Create a workspace folder and work in it - e.g.
   mkdir ~/tciWorkshop && cd ~/tciWorkshop
  • clone the tci-server and tci-cust repositories:
  git clone https://github.com/TikalCI/tci-server.git
  git clone https://github.com/TikalCI/tci-cust.git
  • cd to the tci-server folder:
  cd tci-server
  • Setup the server by running the following command, and filling the values using the default ones. For the customization folder, put the absolute path to the tci-server-test folder - e.g. /Users/tci/tciWorkshop/tci-cust/tikal/tci-server-test
  ./tci.sh init
  • Load the server by running:
  ./tci.sh start

Jenkins Pipeline Exercise

Write a declarative Jenkins pipeline which fulfill the following requirements:

  • Sets 2 parameters:
    • A Boolean parameter ‘RANDOM’ (defaulted to false) whether the status is set randomly or not.
    • A choice parameter ‘STATUS’ (possible values: ‘SUCCESS’,’UNSTABLE’,’FAILURE’ & ‘ABORTED’).
  • Sets the current build status according to the parameters:
    • if not random, set it to the value of ‘STATUS’ parameter.
    • if random, set it to a random status (out of the 4 possible statuses).
  • On the post-build phase:
    • If the status is not ‘SUCCESS’, prints the status to the build log.
    • If the status is ‘SUCCESS’, prints the status to the build log only if the previous-build-status wasn’t ‘SUCCESS’, indicating the previous-build-status - e.g. [STATUS] SUCCESS (was: FAILURE).
  • The job runs on any slave.
  • The job saves only the last 10 builds.
  • The build prints the timestamp of each line to the build log.
  • The job has an overall timeout of only 10 seconds to run.
  • Use tci-library as much as possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment