jenkinsci / jenkinsci/credentials-binding-plugin

[JENKINS-54357] withCredentials + file does not work with the same credentialsId across stages

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

Description

when using multiple blocks such as:

 

withCredentials([file(credentialsId: 'KEYFILE', variable: 'KEYFILE')]) {

  sh 'ls -lh ${KEYFILE}'
}

 

across multiple stages within the same Jenkinsfile/pipeline - it will only work the first time. After the first credentials-binding block, the keyfile gets deleted but not re-created.

 

Expectations: either have the keyfile re-created each time, or have the keyfile only deleted after the build (documented behaviour)

 

---
Originally reported by lifeofguenter, imported from: withCredentials + file does not work with the same credentialsId across stages


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

Raw content of original issue

when using multiple blocks such as:

 



withCredentials([file(credentialsId: 'KEYFILE', variable: 'KEYFILE')]) {

  sh 'ls -lh ${KEYFILE}'
}


 

across multiple stages within the same Jenkinsfile/pipeline - it will only work the first time. After the first credentials-binding block, the keyfile gets deleted but not re-created.

 

Expectations: either have the keyfile re-created each time, or have the keyfile only deleted after the build (documented behaviour)

 

environment

```
Jenkins ver. 2.138.2

credentials-binding: 1.17
```

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.