1

We created Jenkins Pipeline as a Code using Blue Ocean and it was working fine until recently. Now when we try to pass parameters for keychainPwd for Xcode integration plugin in Blue Ocean, it gives us errors and our Blue Ocean Pipeline for iOS is not working.

We tried to use Secret key of credential and tried to pass it as parameter but it is not working.

 environment {
        Keychain_pwd_id     = credentials('test')
    }

Here 'test' secret key was created. We tried following as well:

keychainPwd: hudson.util.Secret.fromString("${Keychain_pwd_id}")

pipeline {
environment {
        Keychain_pwd_id     = credentials('test')
    }
  stages {

    stage('Xcode Build') {
      steps {
        xcodeBuild(buildIpa: true, bundleID: 'com.xxx.xxxxxxxxxx', cleanBeforeBuild: true, configuration: 'Release', developmentTeamID: 'xxxxxxxx', developmentTeamName: 'xxxxxxxxxxxxxxxxxxxxx', ipaExportMethod: ‘enterprise’, ipaName: ‘xxxxxxxxxxx’, ipaOutputDirectory: 'build', keychainName: 'login', keychainPath: '${HOME}/Library/Keychains/login.keychain', keychainPwd: "${Keychain_pwd_id}, manualSigning: true, provisioningProfiles: [[provisioningProfileAppId: 'xxxxxxxxxxxxxxxxxxx', provisioningProfileUUID: 'xxxxxxxxxxxxxxxxxxxxxxxxxx']], unlockKeychain: true, xcodeSchema: ‘xxxxxxxxxxxxxxxx
        }
    }

  }
}

Expecting "class hudson.util.Secret" for parameter "keychainPwd" but got "${keychainPwd}" of type class java.lang.String instead @ line 12, column 407.

daspilker
  • 8,154
  • 1
  • 35
  • 49
  • I'm currently working through the same issue. It seems the xcodebuild plugin updated recently to require it. Will update on my end if I figure it out. Update: I was able to get this building with the following answers: https://stackoverflow.com/questions/50299927/how-do-i-compare-user-inputed-password-to-credentials-passphrase https://stackoverflow.com/questions/38276341/jenkins-ci-pipeline-scripts-not-permitted-to-use-method-groovy-lang-groovyobject The change from the first link is what you're looking for, but you may need to approve your script via the info in the second link. – Richi Rivera Jun 26 '19 at 17:33

1 Answers1

1

I'm currently working through the same issue. It seems the xcodebuild plugin updated recently to require it.

I was able to get this building with the following answers: How do i compare user inputed password to credentials passphrase

Jenkins CI Pipeline Scripts not permitted to use method groovy.lang.GroovyObject

The change from the first link is what you're looking for, but you may need to approve your script via the info in the second link.