[JIRA] (JENKINS-59950) Error on using keychainPwd() with DSL groovy

17 views
Skip to first unread message

dtorres@virtuallylive.com (JIRA)

unread,
Oct 27, 2019, 6:20:02 AM10/27/19
to jenkinsc...@googlegroups.com
Diego Torres created an issue
 
Jenkins / Bug JENKINS-59950
Error on using keychainPwd() with DSL groovy
Issue Type: Bug Bug
Assignee: Unassigned
Components: xcode-plugin
Created: 2019-10-27 10:19
Environment: Jenkins 2.190.1 with xcode-plugin 2.0.12, job-dsl 1.76 and structs 1.20
Labels: plugin jenkins xcode DSL
Priority: Blocker Blocker
Reporter: Diego Torres

When defining the parameter keychainPwd() using groovy for describing a job using DSL, it seems with the new version cannot be done. 

When using a string, job DSL processing shows this error:

  • Example: -->
keychainPwd('password')

Processing DSL script ios.groovy
ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.keychainPwd() is applicable for argument types: (java.lang.String) values: [password]

Prior to 2.0.12 keychainPwd used a String.

  • Example: -->

 

def keychainPwdVar = hudson.util.Secret.fromString('password')
keychainPwd(hadson.util.Secret.fromString("password"))

Processing DSL script ios.groovy
ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.keychainPwd() is applicable for argument types: (hudson.util.Secret) values: [password]

In 2.0.12 keychainPwd could use a String (deprecated) or the newone Secret.

 

I have tested all kind of possible combinations without luck. Not sure if I should define it in other way or this is a kind of bug when usind DSL.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

dtorres@virtuallylive.com (JIRA)

unread,
Oct 27, 2019, 6:21:03 AM10/27/19
to jenkinsc...@googlegroups.com
Diego Torres updated an issue
Change By: Diego Torres
When defining the parameter keychainPwd() using groovy for describing a job using DSL, it seems with the new version cannot be done. 

When using a string, job DSL processing shows this error:
* Example: -->

{code:java}
keychainPwd('password'){code}

Processing DSL script ios.groovy
ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.keychainPwd() is applicable for argument types: (java.lang.String) values: [password]

Prior to 2.0.12 keychainPwd used a String.
* Example: -->

 
{code:java}

def keychainPwdVar = hudson.util.Secret.fromString('password')

keychainPwd(keychainPwdVar)
{code}

Processing DSL script ios.groovy
ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.keychainPwd() is applicable for argument types: (hudson.util.Secret) values: [password]

In 2.0.12 keychainPwd could use a String (deprecated) or the newone Secret.

 

I have tested all kind of possible combinations without luck. Not sure if I should define it in other way or this is a kind of bug when usind DSL.

dtorres@virtuallylive.com (JIRA)

unread,
Oct 27, 2019, 6:21:03 AM10/27/19
to jenkinsc...@googlegroups.com
Diego Torres updated an issue
When defining the parameter keychainPwd() using groovy for describing a job using DSL, it seems with the new version cannot be done. 

When using a string, job DSL processing shows this error:
* Example: -->

{code:java}
keychainPwd('password'){code}
Processing DSL script ios.groovy
ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.keychainPwd() is applicable for argument types: (java.lang.String) values: [password]

Prior to 2.0.12 keychainPwd used a String.
* Example: -->

 
{code:java}
def keychainPwdVar = hudson.util.Secret.fromString('password')
keychainPwd( hadson.util.Secret.fromString("password" keychainPwdVar ) )
{code}
Processing DSL script ios.groovy
ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.keychainPwd() is applicable for argument types: (hudson.util.Secret) values: [password]

In 2.0.12 keychainPwd could use a String (deprecated) or the newone Secret.

 

I have tested all kind of possible combinations without luck. Not sure if I should define it in other way or this is a kind of bug when usind DSL.

kazuhide.t@linux-powered.com (JIRA)

unread,
Oct 28, 2019, 4:43:03 AM10/28/19
to jenkinsc...@googlegroups.com
Kazuhide Takahashi started work on Bug JENKINS-59950
 
Change By: Kazuhide Takahashi
Status: Open In Progress

kazuhide.t@linux-powered.com (JIRA)

unread,
Oct 28, 2019, 4:52:02 AM10/28/19
to jenkinsc...@googlegroups.com

kazuhide.t@linux-powered.com (JIRA)

unread,
Oct 29, 2019, 3:45:02 AM10/29/19
to jenkinsc...@googlegroups.com
Kazuhide Takahashi commented on Bug JENKINS-59950
 
Re: Error on using keychainPwd() with DSL groovy

When unlocking a macOS keychain with Jenkins Xcode Plugin, keychainPwd is not a method, it is a parameter.
If you want to write a process to unlock the keychain in your Groovy script, you would write:

...

def keychainPwdVar = ""

...

script {     
    keychainPwdVar = hudson.util.Secret.fromString('password')
}
unlockMacOSKeychain(keychainPath: "Path/To/Keychain", keychainPwd: keychainPwdVar)

or

...

def keychainPwdVar = ""

...

script {     
    keychainPwdVar = hudson.util.Secret.fromString('password')
}
xcodeBuild(
    ...
    unlockKeychain: true,
    keychainPath: "Path/To/Keychain",
    keychainPwd: keychainPwdVar,
    ...
)

However, this method is not preferable because the password appears in the Groovy script, so it is recommended that you define a keychain password / pass pair as a credential and use it if possible.

dtorres@virtuallylive.com (JIRA)

unread,
Oct 29, 2019, 4:40:02 AM10/29/19
to jenkinsc...@googlegroups.com

Hi, thanks for your fast response. It seems problem comes when using job DSL from groovy, as the syntax you have used is different. I paste you a "complete" step from groovy script for job DSL description:

 

steps { 
   keychainPwdVar = hudson.util.Secret.fromString('password')

   importDeveloperProfile { 
     profileId("jenkins-developerprofile") 
     developerProfileId("jenkins-developerprofile") 
     importIntoExistingKeychain(true) 
     keychainName("") 
     keychainPath('${HOME}/Library/Keychains/login.keychain') 
     keychainPwd(keychainPwdVar) 
   }
 
   xcodeBuild { 
     buildIpa(true) 
     generateArchive(true) 
     noConsoleLog(false) 
     logfileOutputDirectory('${WORKSPACE}/output') 
     cleanBeforeBuild(true) 
     cleanTestReports(true) 
     configuration("Release") 
     target("") 
     sdk("") 
     xcodeProjectPath("temp/project") 
     xcodeProjectFile("") 
     xcodebuildArguments("-showBuildTimingSummary") 
     cfBundleVersionValue("") 
     cfBundleShortVersionStringValue("") 
     unlockKeychain(true) 
     keychainName("") 
     keychainPath('${HOME}/Library/Keychains/login.keychain') 
     keychainPwd(keychainPwdVar) 
     symRoot("") 
     xcodeWorkspaceFile("workspace") 
     xcodeSchema("workspace") 
     buildDir("") 
     developmentTeamName("iOS TEAM") 
     developmentTeamID("0123456789") 
     allowFailingBuildResults(false) 
     ipaName("iOS") 
     provideApplicationVersion(false) 
     ipaOutputDirectory('${WORKSPACE}/output') 
     changeBundleID(false) 
     bundleID("") 
     bundleIDInfoPlistPath("") 
     interpretTargetAsRegEx(false) 
     ipaExportMethod('ad-hoc') 
     provisioningProfiles { 
       provisioningProfile { 
         provisioningProfileAppId("") 
         provisioningProfileUUID("") 
       } 
     } 
     xcodeName("") 
     uploadBitcode(false) 
     uploadSymbols(true) 
     compileBitcode(false) 
     thinning("<none>") 
     appURL('http://url-test.com') 
     displayImageURL('http://url-test.com') 
     fullSizeImageURL('http://url-test.com') 
     assetPackManifestURL("") 
   } 
}

Prior to 2.0.12, keychainPwd('password') was defined using a String but now the way of using hudson.util.Secret for job DSL groovy is failing. Could you check if this is working with job DSL plugin using groovy? If yes, please, could you give me an example using this syntax?
 

 

dtorres@virtuallylive.com (JIRA)

unread,
Oct 29, 2019, 4:44:02 AM10/29/19
to jenkinsc...@googlegroups.com
Diego Torres edited a comment on Bug JENKINS-59950
Hi, thanks for your fast response. It seems problem comes when using job DSL from groovy, as the syntax you have used is different. I paste you a "complete" step from groovy script for job DSL description:

 
{code:java}
} {code}

Prior to 2.0.12, keychainPwd('password') was defined using a String but now the way of using hudson.util.Secret for job DSL groovy is failing. Could you check if this is working with job DSL plugin using groovy? If yes, please, could you give me an example using this syntax?

{code}
 

kazuhide.t@linux-powered.com (JIRA)

unread,
Oct 30, 2019, 5:49:03 AM10/30/19
to jenkinsc...@googlegroups.com

Unfortunately, the Job DSL plugin doesn't seem to be compatible with the encrypted parameter (hudson.util.Secret).
Therefore, to unlock the keychain from the Job DSL plugin via Xcode Plugin, it seems that there is no choice but to define the keychain path and password pair in "Configure System" and specify it with keychainName.

dtorres@virtuallylive.com (JIRA)

unread,
Oct 31, 2019, 4:17:02 AM10/31/19
to jenkinsc...@googlegroups.com

Ok, thanks again for your response. I will modify it for using a keychain previously stored in Jenkins configuration. Maybe when Job DSL was compatible with encrypted parameters.

I will comment you again if a problem comes up using this method.

Reply all
Reply to author
Forward
0 new messages