[JIRA] (JENKINS-43578) Declarative pipeline: post section doesn't play nice with agent none

3 views
Skip to first unread message

Kevin.Fox@pnnl.gov (JIRA)

unread,
Sep 4, 2018, 6:10:01 PM9/4/18
to jenkinsc...@googlegroups.com
Kevin Fox commented on Improvement JENKINS-43578
 
Re: Declarative pipeline: post section doesn't play nice with agent none

Has there been a solution for this found yet? I want to run agent none so I can run different docker containers per test. But I want to have a post always job that runs in a kubernetes client docker image that cleans out the cluster of anything created by any of the stages. I haven't been able to figure out a way to do this.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

xitrium@gmail.com (JIRA)

unread,
Sep 4, 2018, 6:15:03 PM9/4/18
to jenkinsc...@googlegroups.com

Kevin.Fox@pnnl.gov (JIRA)

unread,
Sep 4, 2018, 6:29:02 PM9/4/18
to jenkinsc...@googlegroups.com

Interesting. How do you specify an agent section so that you can run it within a container on the node?

xitrium@gmail.com (JIRA)

unread,
Sep 4, 2018, 6:33:01 PM9/4/18
to jenkinsc...@googlegroups.com

Maybe the scripted pipeline version would work, something like
node {
/* Requires the Docker Pipeline plugin to be installed */
docker.image('node:7-alpine').inside

{ stage('Test') \{ sh 'node --version' }

}
}
 
from pressing "Toggle scripted pipeline (Advanced)" on this page: https://jenkins.io/doc/book/pipeline/docker/

xitrium@gmail.com (JIRA)

unread,
Sep 4, 2018, 6:34:02 PM9/4/18
to jenkinsc...@googlegroups.com
Sean Talts edited a comment on Improvement JENKINS-43578
Maybe the scripted pipeline version would work, something like
{code:java}
 
node {
    /* Requires the Docker Pipeline plugin to be installed */


    docker.image('node:7-alpine').inside {
        stage('Test')
\ {
sh 'node --version'
}
    }
}
{code}

 
from pressing "Toggle scripted pipeline (Advanced)" on this page: 
[ https://jenkins.io/doc/book/pipeline/docker/ ]

Kevin.Fox@pnnl.gov (JIRA)

unread,
Sep 4, 2018, 6:54:02 PM9/4/18
to jenkinsc...@googlegroups.com

tried with step and without. something like:

post {
always {
node('docker') {
docker.image("kfox1111/kubeclient:2018-08-29-1").inside {
sh 'ls /'

 

WorkflowScript: 62: Expected a symbol @ line 62, column 17.
docker.image("kfox1111/kubeclient:2018-08-29-1").inside {

Not liking something there.

 

Kevin.Fox@pnnl.gov (JIRA)

unread,
Sep 4, 2018, 7:05:02 PM9/4/18
to jenkinsc...@googlegroups.com

This looks like it does the trick:

post {
always {
node('docker') {

script {
docker.image("kfox1111/kubeclient:2018-08-29-1").inside {

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:25:15 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Not A Defect
 

Bulk closing resolved issues.

Jenkins / Improvement JENKINS-43578
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