args is invalid option for customized docker agent in shared library using declarative pipeline

11 views
Skip to first unread message

niya...@gmail.com

unread,
May 3, 2019, 7:08:05 PM5/3/19
to Jenkins Users
Below code works in my single jenkinsfile

stage('install') {
   agent {
       docker {
            image: <some golang image>
            args '-u root:root'
            reuseNode true
       }
   }
}

But when I tried to create a shared library, and put whole pipeline inside a library and used by another repo, it keeps complaining:

org.jenkinsci.plugins.workflow.cps.CpsCompilationErrorsException: startup failed:
Invalid config option "call" for agent type "docker". Valid config options are [image, alwaysPull, args, containerPerStageRoot, customWorkspace, label, registryCredentialsId, registryUrl, reuseNode] @ line 29, column 25.
                           args '-u root:root'
                           ^
if I disable the args, it go through correctly. Other options do works for me, except args, wondering any one have the same experience? 

shared library is in GoTest.groovy:
def call() {
    pipeline {
       ...
       that stage
       ...
    }
}

my call is like:

@Library('comm...@0.0.1') _
GoTest()
Reply all
Reply to author
Forward
0 new messages