-
Notifications
You must be signed in to change notification settings - Fork 500
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
Make push-build.sh version regex'ing CI-friendly. #192
Conversation
@@ -40,6 +40,7 @@ BRANCH_REGEX="master|release-([0-9]{1,})\.([0-9]{1,})(\.([0-9]{1,}))*$" | |||
declare -A VER_REGEX=([release]="v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-alpha|-beta)*\.*(0|[1-9][0-9]*)?" | |||
[dotzero]="v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.0$" | |||
[build]="([0-9]{1,})\+([0-9a-f]{5,40})" | |||
[cibuild]="([0-9]{1,})\+*([0-9a-f]{5,40})*" |
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.
these should probably be ?
s instead of *
s? probably not a huge deal though.
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.
also I suspect this entire thing should be optional. right now git describe --tags
prints out v1.3.11-beta.0
and v1.4.6-beta.0
, where the 0 comes from the tag. git
doesn't add a 0 if there are no additional commits past the tag.
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.
We need some separation here. VER_REGEX[build] is used in places throughout that do require a releasable version string. And [cibuild] is not a releasable version 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'm not saying we should change VER_REGEX[build]
. what I'm saying is that the bug is when the git branch was just tagged with a release string, it will only match VER_REGEX[release]
with no additional suffix.
For example,
$ git checkout v1.4.5
HEAD is now at 5a0a696... Kubernetes version v1.4.5
$ ( source hack/lib/version.sh && KUBE_ROOT=$(pwd) kube::version::get_version_vars && kube::version::save_version_vars /dev/stdout )
KUBE_GIT_COMMIT='5a0a696437ad35c133c0c8493f7e9d22b0f9b81b'
KUBE_GIT_TREE_STATE='clean'
KUBE_GIT_VERSION='v1.4.5'
KUBE_GIT_MAJOR='1'
KUBE_GIT_MINOR='4'
I'm pretty sure v1.4.5
will not match ${VER_REGEX[release]}\.${VER_REGEX[cibuild]}
.
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. Understood. PTAL.
6767d48
to
70b67d4
Compare
@@ -98,7 +98,7 @@ RELEASE_BUCKET_MIRROR=$FLAGS_bucket_mirror | |||
[[ $KUBE_GCS_UPDATE_LATEST == "n" ]] && FLAGS_noupdatelatest=1 | |||
|
|||
KUBECTL_OUTPUT=$(cluster/kubectl.sh version --client 2>&1 || true) | |||
if [[ "$KUBECTL_OUTPUT" =~ GitVersion:\"(${VER_REGEX[release]}\.${VER_REGEX[build]})\", ]]; then | |||
if [[ "$KUBECTL_OUTPUT" =~ GitVersion:\"(${VER_REGEX[release]}\.${VER_REGEX[cibuild]})?\", ]]; then |
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.
uh, this now makes the entire thing optional. I don't think that's what we want?
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 think we need a separate [cibuild]
- just change \.${VER_REGEX[build]}
to (\.${VER_REGEX[build]})?
.
70b67d4
to
bfe255d
Compare
@@ -98,7 +98,7 @@ RELEASE_BUCKET_MIRROR=$FLAGS_bucket_mirror | |||
[[ $KUBE_GCS_UPDATE_LATEST == "n" ]] && FLAGS_noupdatelatest=1 | |||
|
|||
KUBECTL_OUTPUT=$(cluster/kubectl.sh version --client 2>&1 || true) | |||
if [[ "$KUBECTL_OUTPUT" =~ GitVersion:\"(${VER_REGEX[release]}\.${VER_REGEX[build]})\", ]]; then | |||
if [[ "$KUBECTL_OUTPUT" =~ GitVersion:\"((${VER_REGEX[release]}(\.${VER_REGEX[cibuild]})?)\", ]]; then |
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.
now this has 3 (
s and 2 )
s?
I still don't understand why we need a separate [cibuild]
- this will now match something like v1.4.6-beta.0.1
which is not valid.
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.
Sorry, WIP. Will PTAL when the time is right.
WRT to [cibuild], anago checks for an incoming version to build a release from. This release should be a full CI version string with a +sha.
bfe255d
to
7c43726
Compare
PTAL |
7c43726
to
35e1cec
Compare
ping. Just want to make sure this isn't blocking. |
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.
yay tests!
DOTZERO="v1.4.0" | ||
SHORT="v1.4.5" | ||
LONG="v1.4.5-alpha.0" | ||
BUILD="v1.4.5-alpha.0.435" |
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.
is this actually a version we'll ever see? I think if you are getting the build number, git describe
(which is what hack/lib/version.sh uses) will also always append the sha.
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.
With the move into CI, I'm not sure what versions I'll see, but will take your guidance here. If you don't encounter $BUILD in CI, we can remove.
2d93193
to
82ac58e
Compare
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.
LG with one fix. (maybe verify that tests pass? :)
fi | ||
|
||
printf "%-40s" "$SHA : " | ||
if [[ $SHA =~ ${VER_REGEX[release]}\.${VER_REGEX[cibuild]} ]]; then |
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.
s/ci//
:)
82ac58e
to
d1f0d6f
Compare
PTAL |
closes #191
cc @kubernetes/test-infra-admins