Reputation: 123
I'm trying to configure a pipeline with these steps:
I want them to be executed in this specific order on the same agent.
My setup is the server and one agent.
If I do this configuration
pipeline {
agent ???
options {
copyArtifactPermission(...);
}
stages
{
stage('BuildStage')
{
agent {label 'agent1'}
steps
{
build( [...] )
}
}
stage('Copy artifacts')
{
agent {label 'agent1'}
steps
{
copyArtifacts ...
}
}
stage('Integration Test')
{
agent {label 'agent1'}
steps
{
build( [...] )
}
}
}
}
It seems that the steps are not scheduled because the master node is busy executing the pipeline.
I'm thinking that I should force the master to execute the pipeline (hence the agent ???) and each stage on the agent?
I can get it to work by adding 'wait:false' to each step, but then I'm not sure the order is kept?
I have also set number of executors to 2, but it doesn't seem to solve the problem.
I'm coming from TeamCity, so maybe I've just misunderstood something basic about Jenkins?
Upvotes: 0
Views: 57
Reputation: 494
If all the steps are meant to be run in the same agent, you can set it only once:
pipeline {
agent { label 'agent1' }
...
// Remove all other 'agent'
}
Don`t worry about the stages order (quote from https://www.jenkins.io/doc/book/pipeline/syntax/#sequential-stages)
Stages in Declarative Pipeline may have a stages section containing a list of nested stages to be run in sequential order.
Upvotes: 2