-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[cli] Make preflight test containers with unique name #4378
Conversation
Signed-off-by: Tyler Jewell <[email protected]>
Signed-off-by: Tyler Jewell <[email protected]>
@@ -256,21 +256,28 @@ docker_compose() { | |||
fi | |||
} | |||
|
|||
# Return srandom character alphanumeric string (upper and lower case) of length $1 | |||
generate_random_string() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this function is used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not anymore. My first commit was going to use it with a 10 character code. And then I decided to use CHE_PORT
instead as the unique ID. But I wanted to leave this utility method in the library for future use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we only add it if we require it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sure that is typical, but I can see a number of situations in the near future where we may want to use it. It wasn't the easiest thing to dig up - so is it inappropriate to leave in unused methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I would say that we only let code really used in master. Dead code is usually deleted.
you may add the code to the pull request so if you need to find it again, you could get it.
Or paste it to a gist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
# Return srandom character alphanumeric string (upper and lower case) of length $1
generate_random_string() {
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1)
echo $NEW_UUID
}
Build finished. |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/2147/ |
* generate random names for test containers Signed-off-by: Tyler Jewell <[email protected]>
What does this PR do?
Solves race condition when starting multiple Che servers quickly where the preflight test containers were sharing the same name and running into conflicts. This sets the name of preflight containers to be unique by appending the port of the Che server.
What issues does this PR fix or reference?
#4353
Changelog
[cli] Give containers used in preflight tests unique name
Release Notes
N/A
Docs PR
N/A