[JIRA] (JENKINS-41607) Declarative: agent dockerfile fails when agent inside stage

2 views
Skip to first unread message

bitwiseman@gmail.com (JIRA)

unread,
Jan 31, 2017, 5:12:02 PM1/31/17
to jenkinsc...@googlegroups.com
Liam Newman created an issue
 
Jenkins / Bug JENKINS-41607
Declarative: agent dockerfile fails when agent inside stage
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2017/Jan/31 10:11 PM
Priority: Major Major
Reporter: Liam Newman
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

bitwiseman@gmail.com (JIRA)

unread,
Jan 31, 2017, 5:16:02 PM1/31/17
to jenkinsc...@googlegroups.com
Liam Newman updated an issue
Change By: Liam Newman
In a project with a {{Dockerfile}}, This pipeline succeeds:

{code:language=groovy}
pipeline {
    agent {
        dockerfile true
    }
    stages {
        stage ('Build') {
            steps {
                sh 'echo "hello"'
            }
        }
    }
}{code}

This pipeline fails:

{code:language=groovy}
pipeline {
    agent none
    stages {
        stage ('Build') {
            agent {
                dockerfile true
            }
            steps {
                sh 'echo "hello"'
            }
        }
    }
}
{code}

The reason this happens is that the agent inside a stage step does not do checkout scm automatically.  This is very confusing behavior.
Agent initialization should be consistent whether at top or inside a stage.

bitwiseman@gmail.com (JIRA)

unread,
Jan 31, 2017, 5:19:01 PM1/31/17
to jenkinsc...@googlegroups.com
Liam Newman updated an issue
In a project with a {{Dockerfile}}, This pipeline succeeds:

{code:language=groovy}
pipeline {
    agent {
        dockerfile true
    }
    stages {
        stage ('Build') {
            steps {
                sh 'echo "hello"'
            }
        }
    }
}{code}

This pipeline fails:

{code:language=groovy}
pipeline {
    agent none any
    stages {
        stage ('Build') {
            agent {
                dockerfile true
            }
            steps {
                sh 'echo "hello"'
            }
        }
    }
}
{code}

The reason this happens is that the agent inside a stage step does not do checkout scm automatically.  This is very confusing behavior.
Agent initialization should be consistent whether at top or inside a stage.

bitwiseman@gmail.com (JIRA)

unread,
Jan 31, 2017, 5:19:01 PM1/31/17
to jenkinsc...@googlegroups.com
Liam Newman updated an issue
Change By: Liam Newman
Summary: Declarative: agent dockerfile fails when agent inside stage with top-level agent none

bitwiseman@gmail.com (JIRA)

unread,
Jan 31, 2017, 5:38:02 PM1/31/17
to jenkinsc...@googlegroups.com
Liam Newman updated an issue
In a project with a {{Dockerfile}}, This pipeline succeeds:

{code:language=groovy}
pipeline {
    agent {
        dockerfile true
    }
    stages {
        stage ('Build') {
            steps {
                sh 'echo "hello"'
            }
        }
    }
}{code}

This pipeline fails:

{code:language=groovy}
pipeline {
    agent any

    stages {
        stage ('Build') {
            agent {
                dockerfile true
            }
            steps {
                sh 'echo "hello"'
            }
        }
    }
}
{code}

The reason this happens is that the agent inside a stage step does not do checkout scm automatically.  This is very confusing behavior.
Agent initialization should be consistent whether at top or inside a stage.


The following also works, because of {{reuseNode true}}, but dockerfile would never work without that when inside a state (due to JENKINS-41605).
{code:language=groovy}
pipeline {
    agent any

    stages {
        stage ('Build') {
            agent {
                dockerfile {
                    reuseNode true

                }
            }
            steps {
                sh 'echo "hello"'
            }
        }
    }
}
{code}

andrew.bayer@gmail.com (JIRA)

unread,
Feb 14, 2017, 5:05:01 PM2/14/17
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Bug JENKINS-41607
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Feb 14, 2017, 5:23:02 PM2/14/17
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Duplicate
 

This is effectively a symptom of JENKINS-41605, so closing this.

Change By: Andrew Bayer
Status: In Progress Resolved
Resolution: Duplicate

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:47 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Duplicate
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages