Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins doesn't have label Linux

I am trying to run a Jenkins pipeline and I just keep getting the error:

Jenkins doesn't have label 'linux'

Any idea why this is happening? Is it a plugin I am missing?

pipeline {
    agent{
        label 'linux'
    }
    stages {
        stage('Checkout Code') {
            steps {
                checkout scm
            }
        }
        stage('Build Docker Container') {
            steps {
                script {
                    sh "ls -ltr"
                    env.HARBORHOST ="harbour.com"
                    env.REGISTRY = "securewbs"
                    env.IMAGE = "${env.HARBORHOST}/${env.REGISTRY}/securewbs:${env.BUILD_NUMBER}"
                    wbs = docker.build("${env.IMAGE}")
                }
            }
        }
like image 669
CPdev Avatar asked Oct 04 '18 10:10

CPdev


2 Answers

Go to Manage Jenkins->Manage Nodes. You can chose one of these nodes as your agent. Take the string from the column "name". If the name of one of your nodes is for example "master" you can write:

pipeline {
    agent {
        label 'master'
    }
    ...
}
like image 55
Michael Käfer Avatar answered Sep 24 '22 10:09

Michael Käfer


Look at the configuration section of your Jenkins instance (https://your-jenkins/configure). There is a section called Lockable Resources Manager, and your 'linux' label should be listed here.
The label is a selection field.

like image 27
Mikki Avatar answered Sep 21 '22 10:09

Mikki