Jenkins doesn't have label Linux

Calum Price picture Calum Price · Oct 4, 2018 · Viewed 18.1k times · Source

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}")
                }
            }
        }

Answer

Michael Käfer picture Michael Käfer · Apr 18, 2019

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'
    }
    ...
}