jenkinsci / jenkinsci/credentials-binding-plugin

[JENKINS-75741] freesyle job syntax missing defined usernamePassword() method

Open
#516 0 comments 0 reactions 0 assignees View on GitHub
component:credentials-binding-plugin imported-jira-issue priority:critical resolution:unresolved
Dominant language
Java
Stars
57
Forks
108
PR merge metrics
No merged PRs in 30d

Description

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)

 

---
Originally reported by normana400, imported from: freesyle job syntax missing defined usernamePassword() method


  • status: Open
  • priority: Critical
  • component(s): credentials-binding-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20251211-141027

Raw content of original issue

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)
 

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.