[stabilization/2106] installer jenkins job fixes and improvements (#1453)
Updated installer job tags to be included in nightly clean builds Fixed escaping issue with passing installer framework env var to cmake Removed enforcement of aws profile for uploading Various changes to shorten the install path cpack uses Added cpack log file dump on error Added build tagging from git repo info to installer job Fixed bug causing bootsrapper to crash on secondary machinesmain
commit
c05943abf4
@ -0,0 +1,52 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(_target_name ${CMAKE_HOST_SYSTEM_NAME})
|
||||
if(${_target_name} STREQUAL Darwin)
|
||||
set(_target_name Mac)
|
||||
endif()
|
||||
|
||||
if(CPACK_AUTO_GEN_TAG)
|
||||
set(_python_script python.sh)
|
||||
if(${_target_name} STREQUAL Windows)
|
||||
set(_python_script python.cmd)
|
||||
endif()
|
||||
|
||||
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." _root_path)
|
||||
file(TO_NATIVE_PATH "${_root_path}/python/${_python_script}" _python_cmd)
|
||||
file(TO_NATIVE_PATH "${_root_path}/scripts/build/tools/generate_build_tag.py" _gen_tag_script)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${_python_cmd} -s -u ${_gen_tag_script}
|
||||
RESULT_VARIABLE _gen_tag_result
|
||||
OUTPUT_VARIABLE _gen_tag_output
|
||||
ERROR_VARIABLE _gen_tag_errors
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if (NOT ${_gen_tag_result} EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to generate build tag! Errors: ${_gen_tag_errors}")
|
||||
endif()
|
||||
|
||||
set(_url_tag ${_gen_tag_output})
|
||||
else()
|
||||
set(_url_tag ${CPACK_PACKAGE_VERSION})
|
||||
endif()
|
||||
|
||||
set(_full_tag ${_url_tag}/${_target_name})
|
||||
|
||||
if(CPACK_DOWNLOAD_SITE)
|
||||
set(CPACK_DOWNLOAD_SITE ${CPACK_DOWNLOAD_SITE}/${_full_tag})
|
||||
endif()
|
||||
if(CPACK_UPLOAD_URL)
|
||||
set(CPACK_UPLOAD_URL ${CPACK_UPLOAD_URL}/${_full_tag})
|
||||
endif()
|
||||
@ -0,0 +1,73 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def run_git_command(args, repo_root):
|
||||
|
||||
process = subprocess.run(['git', *args],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
cwd=repo_root,
|
||||
env=os.environ.copy(),
|
||||
universal_newlines=True,
|
||||
)
|
||||
|
||||
if process.returncode != 0:
|
||||
print(
|
||||
f'An error occurred while running a command\n'
|
||||
f'Command: git {subprocess.list2cmdline(args)}\n'
|
||||
f'Return Code: {process.returncode}\n'
|
||||
f'Error: {process.stderr}',
|
||||
file=sys.stderr
|
||||
)
|
||||
exit(1)
|
||||
|
||||
output = process.stdout.splitlines()
|
||||
if not output:
|
||||
print(f'No output received for command: git {subprocess.list2cmdline(args)}.')
|
||||
output
|
||||
|
||||
return output[0].strip('"')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
'''
|
||||
Generates a build ID based on the state of the git repository. Will first attempt to use
|
||||
existing environment variable (e.g. BRANCH_NAME, CHANGE_ID, CHANGE_DATE) before falling
|
||||
back to running git commands directly
|
||||
'''
|
||||
repo_root = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||
|
||||
branch = os.environ.get('BRANCH_NAME')
|
||||
if not branch:
|
||||
branch = run_git_command(['rev-parse', '--abbrev-ref', 'HEAD'], repo_root)
|
||||
branch = branch.replace('/', '-')
|
||||
|
||||
commit_hash = os.environ.get('CHANGE_ID')
|
||||
if not commit_hash:
|
||||
commit_hash = run_git_command(['rev-parse', 'HEAD'], repo_root)
|
||||
commit_hash = commit_hash[0:9]
|
||||
|
||||
# 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=%cI', commit_hash], repo_root)
|
||||
commit_date = commit_date[0:10]
|
||||
|
||||
print(f'{branch}/{commit_date}-{commit_hash}')
|
||||
exit(0)
|
||||
Loading…
Reference in New Issue