Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63006

Unable to load gitea credentials in pipeline through withCredentials

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • gitea-plugin
    • None

      It's not possible to use withCredentials in a jenkins pipeline to load the credentials setup for gitea-plugin.

      The credentials are working as they should. It's just the following that isn't possible:

      Pipeline:

      environment {
        GITEA_TOKEN = credentials('gitea-credentials')
      }

      Result:

      ERROR: No suitable binding handler could be found for type org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl. Supported types are StandardUsernamePasswordCredentials,FileCredentials,StringCredentials,DockerServerCredentials,SSHUserPrivateKey.

       

      Pipeline:

      withCredentials([[$class: "org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl", credentialsId: 'gitea-credentials', variable: 'token']])

      Result:
      java.lang.ClassCastException: org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl cannot be cast to org.jenkinsci.plugins.credentialsbinding.MultiBinding
       

       

          [JENKINS-63006] Unable to load gitea credentials in pipeline through withCredentials

          Mattias Persson created issue -
          Mattias Persson made changes -
          Description Original: It's not possible to use withCredentials in a jenkins pipeline to load the credentials setup for gitea-plugin.

          {{The credentials are working as they should. It's just the following that isn't possible:}}

          {{environment {}}
          {{  GITEA_TOKEN = credentials('gitea-credentials')}}
          {{ }}}
          {{}}
          ERROR: No suitable binding handler could be found for type org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl. Supported types are StandardUsernamePasswordCredentials,FileCredentials,StringCredentials,DockerServerCredentials,SSHUserPrivateKey.

          {{withCredentials([[$class: "org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl", credentialsId: 'gitea-credentials', variable: 'token']])}}
          {{}}
          java.lang.ClassCastException: org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl cannot be cast to org.jenkinsci.plugins.credentialsbinding.MultiBinding
           

           
          New: It's not possible to use withCredentials in a jenkins pipeline to load the credentials setup for gitea-plugin.

          {{The credentials are working as they should. It's just the following that isn't possible:}}

          Pipeline:

          {{environment {}}
           {{  GITEA_TOKEN = credentials('gitea-credentials')}}
          }

          Result:

          ERROR: No suitable binding handler could be found for type org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl. Supported types are StandardUsernamePasswordCredentials,FileCredentials,StringCredentials,DockerServerCredentials,SSHUserPrivateKey.

           

          Pipeline:

          {{withCredentials([[$class: "org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl", credentialsId: 'gitea-credentials', variable: 'token']])}}

          Result:
           java.lang.ClassCastException: org.jenkinsci.plugin.gitea.credentials.PersonalAccessTokenImpl cannot be cast to org.jenkinsci.plugins.credentialsbinding.MultiBinding
            

           
          Syed Hassan made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]

            Unassigned Unassigned
            mattiasbpersson Mattias Persson
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: