def extractCredFromFile()

in jenkins-docker/server/setCredentials.groovy [72:93]


def extractCredFromFile(filePath){
  def jsonSlurper = new JsonSlurper()
  def fileContents = jsonSlurper.parse(new File(filePath))

  fileContents.each { name, credential ->
    switch(credential.type.toLowerCase()) {
      case "userpassword":
        addUserPasswordCredential(
          credential.id,
          credential.user,
          credential.password,
          credential.description)
        break
      case "string":
        addStringCredential(
          credential.id,
          credential.string,
          credential.description)
        break
    }
  }
}