-
Notifications
You must be signed in to change notification settings - Fork 73
Added option to take credential id from annotation to allow forbidden characters in k8s to be used in credential id #27
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
Conversation
… characters in k8s to be used in credential id
|
I'm not sure why you need this. IDs need to be unique - an annotation allows you to have collisions and this is not handled in this PR. |
|
I needed it when migrating a Jenkins instance that had a shared library that could take credential IDs from multiple places (repos could specify which credentials to use for the specific build via a config file) to k8s. I agree with the downsides, as at the moment I don't have time to implement handling of collisions should I close the PR? |
|
Agree, it's useful for migrations. Can it be added at least as experimental feature? |
|
Hi, @jtnord Would you please merge this pull request and released a new version? Thanks |
|
I definitely have an interest in adding this functionality. I support a over a thousand developers working on dozens of Jenkins instances and while we are encouraging all teams to use compliant naming schemes and eventually will force them to do so, we can't delay the migration to use of Kubernetes secrets. Right now we are just working with a forked version of the repository but I would love to see this be added even if just as an experimental feature. |
|
Hi, |
|
Hello @jtnord, @UrosGligovic I have been working on this PR for a few days already and did not manage to come up with a good solution to verify the credential uniqueness. By introducing a simple condition before addSecret action, It is possible to avoid overwriting the existing credential if the ID conflicts with the annotation, but there is a problem when the Secret is being deleted. In other words. Let's assume that we have a credential: After applying a following creds: Nothing happens with the existing Jenkins credential. It is not being overwritten as the referred object already exists in Jenkins. There is no way to connect the specific Kubernetes object with a Jenkins credential. I have also tried to avoid any actions in case of two or more conflicting objects - no ADDITION, MODIFICATION, or DELETION with a SEVERE notification in the Jenkins log. Even though, I would vote to add the simple condition before ADDING/MODIFYING credential and accept the risk of an accidental credential deletion. Guys, let's decide if we want to move this PR forward as it seems that at least a few people are waiting for this change. |
|
in order to support the desired behaviour I would be tempted to introduce a new plugin that did mapping from requestedIDs to in fact - if we did not use an annotation and stored this in a configMap simiar to described above I would possibly be inclined to accept it into this plugin, however I think it may have more use that just this plugin (as you could prepare a migration to k8s as the credential provider long in advance of actually migrating to k8s) |
|
based on my last comment I am closing this as I have no intention in supporting this functionality in this plugin. |
Added option to take credential id from annotation to allow forbidden characters in k8s to be used in credential id (uppercase letters for example)