-
Notifications
You must be signed in to change notification settings - Fork 814
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
[Jenkins] supporting the new folder naming convention #1442
Conversation
# versions of Jenkins > 1.597 need to be sorted by build number (integer) | ||
try: | ||
dirs = sorted(dirs, key=lambda x: int(x.split('/')[-1]), reverse=True) | ||
except: |
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.
You should almost never use bare "except:" as it would also catch System exiting exceptions which you don't want.
You should use except Exception or even better catch the actual exceptions that can be raised here.
ce5334d
to
756ed60
Compare
build_file = os.path.join(dir_name, 'build.xml') | ||
|
||
if not os.access(build_file, os.R_OK): | ||
self.log.debug("Can't read build file at %s" % (build_file)) |
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.
You don't need this line
One last thing is that now you'll parse the build.xml twice. One to get the timestamp and one to get the other metadata, can you consolidate this ? Looks good otherwise! |
bac7616
to
26acdb3
Compare
# We try to get the last valid build | ||
for index in xrange(0, len(dirs) - 1): | ||
for index in xrange(len(dirs)): |
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.
Nice bug fix!
We should likely just do:
for dir_name in dirs:
unless i'm missing something ?
26acdb3
to
f223822
Compare
f223822
to
5bc5224
Compare
[Jenkins] supporting the new folder naming convention
Starting from v1.597, the build folder names are not named with a timestamp anymore but with an ID. We have to get the timestamp from the
build.xml
file and to use the folder name to guess the build number.