Configuring the Pipeline project by using the sample script

You can configure a Pipeline project directly from the Jenkins UI by using the sample pipeline scripts to run test assets from Jenkins.

Before you begin

You must have completed the following tasks:

Procedure

  1. Open your Jenkins Pipeline project from the list.
  2. Click Configure, and then select the Pipeline tab.
  3. Select the Pipeline script option in the Definition field.
  4. Select the sample script from the drop-down list.

    For example, if you select Hello Word from the drop-down list, then the sample script is displayed as follows:

    pipeline_sample_script
  5. Perform the following steps to edit the sample script:
    1. Replace the agent any in the script with the name of the label that you provided when you created the Agent.
      For example, if you provided a name of the label as win10_1022, then edit the script as follows:

      agent {label 'win10_1022'}

    2. Provide a name for the stage in the script.
      For example, stage('Run Demo')
    3. Specify the script that you created in step 7 in place of echo ‘Hello Word’.
  6. Click Save.

Results

You have configured the Pipeline project by using the Pipeline script option.

What to do next

You can run test assets from the Jenkins server. See Running tests from Jenkins.