jenkinsci / jenkinsci/credentials-plugin

[JENKINS-51694] Fix tracking for credentials against cloud agents

Open
#807 0 comments 0 reactions 0 assignees View on GitHub
component:credentials-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
134
Forks
258
Avg merge
48m
Merged PRs (30d)
1

Description

The proposed fix for JENKINS-49235">JENKINS-49235 will cause credential tracking information for cloud agents to be removed as soon as the ephemeral agent is destroyed, making the tracking nearly useless for those agents.

We should track credentials used by ephemeral agents against the cloud that launched them rather than against the agent itself. Unfortunately, there does not currently seem to be a way to associate an agent with the cloud that launched it. The best option that I am aware of is the following:

public static Set getCloudsForNode(Node node) {

return node.getAssignedLabels().stream()
.flatMap(l -> l.getClouds().stream())
.collect(Collectors.toSet());
}

However, if there are multiple clouds that launch for the same label, there is no way to distinguish which one actually launched the node (not counting any plugin-specific code such as EC2AbstractSlave.java#getCloud). Changing that would require a new API in core.

I think it would be better to get precise tracking by implementing a new core API than approximate tracking using the above method, but I do not have a strong opinion.

---
Originally reported by dnusbaum, imported from: Fix tracking for credentials against cloud agents


  • status: Open
  • priority: Minor
  • component(s): credentials-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-08

Raw content of original issue

The proposed fix for JENKINS-49235 will cause credential tracking information for cloud agents to be removed as soon as the ephemeral agent is destroyed, making the tracking nearly useless for those agents.

We should track credentials used by ephemeral agents against the cloud that launched them rather than against the agent itself. Unfortunately, there does not currently seem to be a way to associate an agent with the cloud that launched it. The best option that I am aware of is the following:



public static Set<Cloud> getCloudsForNode(Node node) {

return node.getAssignedLabels().stream()
.flatMap(l -> l.getClouds().stream())
.collect(Collectors.toSet());
}


However, if there are multiple clouds that launch for the same label, there is no way to distinguish which one actually launched the node (not counting any plugin-specific code such as EC2AbstractSlave.java#getCloud). Changing that would require a new API in core.

I think it would be better to get precise tracking by implementing a new core API than approximate tracking using the above method, but I do not have a strong opinion.

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.