In order to increase the security of our CI system, we classify jobs and nodes as either unrestricted or restricted:


How to create a restricted jobs

In order to create a restricted job and run it on a restricted node, you have take the following steps:

  1. Create a Jenkins job which starts with the name 'restricted-' (case-sensitive). In the following image, all jobs eligible for execution on restricted slaves are marked in green while all unrestricted jobs are red:
  2. Within your Jenkinsfile, make sure that all nodes start with 'restricted-' (case-sensitive). In the following you see two examples. The green one will be scheduled on a restricted node while the red one runs on unrestricted nodes. Note: Due to security measures, it is not possible mix restricted and unrestricted nodes within the same job.

    1. node('restricted-mxnetlinux-cpu') {
        ws('workspace/sanity') {
          init_git()
          docker_run('ubuntu_cpu', 'sanity_check', false)
        }
      }

    2. node('mxnetlinux-cpu') {
        ws('workspace/sanity') {
          init_git()
          docker_run('ubuntu_cpu', 'sanity_check', false)
        }
      }

  3. That's it. Auto scaling will automatically take care that your required slaves will be provisioned.

Background

The enforcement of these restrictions is done using the Jenkins Job Restrictions plugin. Our nodes are created with the following configuration:

Restricted nodes


Unrestricted nodes