freesyle job syntax missing defined usernamePassword() method

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      using the freestyle version of the jobdsl, create a freestyle job that uses a binding
       

       

      def artifactoryHost = "myhost" 
      def publishUrl = """https://myhost/artifactory/libs-release/"""
      def callSbt() { 
        withCredentials([usernamePassword(credentialsId:  'my_artifactory', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) { 
          def devCredentials = """'set Credentials("Artifactory Realm", "${artifactoryHost}", sys.env("ARTIFACTORY_USER"),sys.env("ARTIFACTORY_PASSWORD"))';""" 
          def sbtCommand = """${devCredentials} ${publishStr} clean test publish""" 
          sbt(SbtVersion, sbtCommand, '-Dsbt.log.noformat=true', '-Xms2G -Xmx2G -Xss512M', null) 
        }
      }
       
      job('myjobName') {
        description("executes test and publish on this project (develop branch)")
       
        steps {
          callSbt()
        }
      }
      

       

      expected: job is created and uses credentials effectively

      actual:

      job seeding fails with error:
      No signature of method: myjob.usernamePassword() is applicable for argument types: (java.util.LinkedHashMap)
       

            Assignee:
            Unassigned
            Reporter:
            Andrew Norman
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: