Skip to content

withCredentials() works with GitLabApiToken, but credentials() doesn't #1770

@neyrick

Description

@neyrick

Jenkins and plugins versions report

Follow-up to #536 and #1754

The withCredentials() syntax does work indeed in pipelines thanks to this MR, but the credentials() one doesn't.

Environment

What Operating System are you using (both controller, and any agents involved in the problem)?

Rocky Linux 9

Reproduction steps

Sample pipeline:

pipeline {
    agent any

  environment {
    GITLAB_API_TOKEN = credentials('tokentest')
  }
    
    stages {
        stage('Hello') {
            steps {
                    echo 'Hello World'
            }
        }
    }
}

Expected Results

Token injected as GITLAB_API_TOKEN

Actual Results

Error message:

ERROR: No suitable binding handler could be found for type com.dabsquared.gitlabjenkins.connection.GitLabApiTokenImpl. Supported types are StandardUsernamePasswordCredentials,FileCredentials,DockerServerCredentials,StringCredentials,SSHUserPrivateKey.

Anything else?

No response

Are you interested in contributing a fix?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions