[cpack/jenkins-main] update commit date format string to something that works on all machines

This commit is contained in:
scottr
2021-06-20 13:38:16 -07:00
parent 646fc30dab
commit 21d92a414e
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -258,8 +258,8 @@ def CheckoutRepo(boolean disableSubmodules = false) {
palRm('commitid')
// CHANGE_DATE is used by the installer to provide some ability to sort tagged builds in addition to BRANCH_NAME and CHANGE_ID
commitDateFmt = '%%cs'
if (env.IS_UNIX) commitDateFmt = '%cs'
commitDateFmt = '%%cI'
if (env.IS_UNIX) commitDateFmt = '%cI'
palSh("git show -s --format=${commitDateFmt} ${env.CHANGE_ID} > commitdate", 'Getting commit date')
env.CHANGE_DATE = readFile file: 'commitdate'
+2 -1
View File
@@ -66,7 +66,8 @@ if __name__ == "__main__":
# include the commit date to allow some sensible way of sorting
commit_date = os.environ.get('CHANGE_DATE')
if not commit_date:
commit_date = run_git_command(['show', '-s', '--format=%cs', commit_hash], repo_root)
commit_date = run_git_command(['show', '-s', '--format=%cI', commit_hash], repo_root)
commit_date = commit_date[0:10]
print(f'{branch}/{commit_date}-{commit_hash}')
exit(0)