Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output of snippet generator is broken #105

Open
TobiX opened this issue Oct 5, 2021 · 3 comments
Open

Output of snippet generator is broken #105

TobiX opened this issue Oct 5, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@TobiX
Copy link

TobiX commented Oct 5, 2021

Version report

Jenkins and plugins versions report:

Jenkins: 2.303.1
OS: Linux - 5.10.0-8-amd64
---
aws-credentials:1.32
  • What Operating System are you using (both controller, and any agents involved in the problem)?
Linux

Reproduction steps

  • Go to the pipeline snippet generator
  • Select withCredentials
  • Select an AWS credential
  • Hit "Generate pipeline script"

Results

Expected result:

A nice pipeline like

withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'foobar']]) {
    // some block
}

or

withCredentials([aws(credentialsId: 'foobar')]) {
    // some block
}

(as seen on https://www.jenkins.io/doc/pipeline/steps/credentials-binding/#withcredentials-bind-credentials-to-variables)

Actual result:

grafik

withCredentials([<object of type com.cloudbees.jenkins.plugins.awscredentials.AmazonWebServicesCredentialsBinding>]) {
    // some block
}
@TobiX TobiX added the bug Something isn't working label Oct 5, 2021
@carles-protopixel
Copy link

Hi, just to raise awareness that this issue is still open, and that the official documentation still states that this is the way to add credentials to a Jenkinsfile. I recently found myself trying to guess the syntax by searching Jenkinsfiles in GitHub.

As a reference for anyone trying to guess how to bind variables to AWS secrets, this is what I did:

withCredentials([aws(credentialsId: 'XXXXXXXX', accessKeyVariable: 'S3_ACCESS_KEY_ID', secretKeyVariable: 'S3_SECRET_ACCESS_KEY')]) {
    sh 'upload.sh'
}

@maretodoric
Copy link

As a reminder, this is still ongoing. Thank you @carles-protopixel for correct syntax

@nathanzon
Copy link

The issue still exists, Jenkins 2.387.2. Thank you @carles-protopixel for the fix, it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants