Reputation: 495
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}")
}
}
}
Upvotes: 17
Views: 57803
Reputation: 1789
you need to add new variable or name or like a constant (i don't no exact name)
step 1. click on this link: http://localhost:8080/manage/configureTools/
step 2. add tool whatever you want like: node, maven, jdk , etc.
step 3. if it's not visible then first you need to install plugin according to your requirement.
step 4. try again step 2 and use you created "Name" in jenkins file.
Upvotes: 0
Reputation: 1
if you can, avoid naming the agent, use pipeline { agent any ...
Upvotes: -3
Reputation: 1796
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'
}
...
}
Upvotes: 22
Reputation: 180
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.
Upvotes: 5