Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46831

Not able to use a normal agent on stage when agent docker is declared globally

    XMLWordPrintable

Details

    Description

      When the agent globally defined is a a docker-based, then if a stage defined another agent, it seems that we are facing JENKINS-33510.

       

      PR: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/192

      Attachments

        Issue Links

          Activity

            abayer thanks for the response. I don't really care where/how the agents are specified - I just need to run all the stages in docker containers. Are you saying that it's possible to run parallel stages in containers (on multiple slaves at the same time), if I change how the agents are specified in the Jenkinsfile ?

            wknapik wknapik wknapik added a comment - abayer thanks for the response. I don't really care where/how the agents are specified - I just need to run all the stages in docker containers. Are you saying that it's possible to run parallel stages in containers (on multiple slaves at the same time), if I change how the agents are specified in the Jenkinsfile ?

            abayer I tried doing that (as described in JENKINS-47103), but it didn't work back then. Has something changed ?

            wknapik wknapik wknapik added a comment - abayer I tried doing that (as described in  JENKINS-47103 ), but it didn't work back then. Has something changed ?
            0x89 Martin Sander added a comment - - edited

            abayer:

            I have a problem that might be this one or another issue:

            pipeline {
                agent {
                    docker {
                        image 'microsoft/azure-cli:2.0.28'
                        args '-u 0:0'
                    }
                }
                options { timestamps() }
            
                stages {
                    stage('azure-cli') {
                        steps {
                            sh 'az --version'
                        }
                    }
                    stage('dotnet') {
                        agent {
                            docker {
                                image 'microsoft/dotnet:2.0-runtime-stretch'
                                args '-u 0:0'
                            }
                        }
                        steps {
                            sh 'ls /usr/share/dotnet'
                        }
                    }
                }
            }
            

            stage('azure-cli') works, stage('dotnet') fails with: Error: No such container: c0ffeec0de (which is actually the container that runs microsoft/azure-cli:2.0.28, but is running on a completely different node).

            Using reuseNode for the dotnet docker agent leads to a different error: Jenkins tries to start the second docker container from within the first one.

            Is this the same issue as this or a new one? Plugin version 1.2.7.

            0x89 Martin Sander added a comment - - edited abayer : I have a problem that might be this one or another issue: pipeline { agent { docker { image 'microsoft/azure-cli:2.0.28' args '-u 0:0' } } options { timestamps() } stages { stage( 'azure-cli' ) { steps { sh 'az --version' } } stage( 'dotnet' ) { agent { docker { image 'microsoft/dotnet:2.0-runtime-stretch' args '-u 0:0' } } steps { sh 'ls /usr/share/dotnet' } } } } stage('azure-cli') works, stage('dotnet') fails with: Error: No such container: c0ffeec0de (which is actually the container that runs microsoft/azure-cli:2.0.28 , but is running on a completely different node). Using reuseNode for the dotnet docker agent leads to a different error: Jenkins tries to start the second docker container from within the first one. Is this the same issue as this or a new one? Plugin version 1.2.7.
            abayer Andrew Bayer added a comment -

            0x89 - Yeah, it's the same issue, basically. What I'd recommend is that you do agent any at the top level, then docker agents for each stage with reuseNode true - should get you the behavior you're looking for.

            abayer Andrew Bayer added a comment - 0x89 - Yeah, it's the same issue, basically. What I'd recommend is that you do agent any at the top level, then docker agents for each stage with reuseNode true - should get you the behavior you're looking for.
            trejkaz trejkaz added a comment -

            We hit this one today, but the issue linked in the description (JENKINS-33510) is marked as resolved. I assume it's now a different issue? I get the same error as above ("No such container: ------").

            trejkaz trejkaz added a comment - We hit this one today, but the issue linked in the description ( JENKINS-33510 ) is marked as resolved. I assume it's now a different issue? I get the same error as above ("No such container: ------").

            People

              Unassigned Unassigned
              alecharp Adrien Lecharpentier
              Votes:
              8 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated: