Limit pod name to 63 characters, and shorten randomly generated string #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR has two small changes. Hope that it's alright that they're both in one PR. They're closely related.
The first fixes a bug where the plugin fails to use a pod if the pod's name is over 63 characters. I believe this is due to the fact that the JNLP container has a max hostname of 64 bytes (including the null terminator).
As as a result, when
workspace.child(HOSTNAME_FILE).readToString()
is executed, it returns the first 63 characters of the pod name, which causes the plugin to look for the wrong pod.The second change makes the random string appended to the end of the pod name more like Kubernetes' string generation. With this PR, only 5 characters are appended (or replaced if it exceeds the max length) to the end of the string.