[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 machines
This commit is contained in:
Scott Romero
2021-06-22 13:12:40 -07:00
committed by GitHub
10 changed files with 205 additions and 23 deletions
+9
View File
@@ -256,6 +256,15 @@ def CheckoutRepo(boolean disableSubmodules = false) {
env.CHANGE_ID = readFile file: 'commitid'
env.CHANGE_ID = env.CHANGE_ID.trim()
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 = '%%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'
env.CHANGE_DATE = env.CHANGE_DATE.trim()
palRm('commitdate')
}
def PreBuildCommonSteps(Map pipelineConfig, String repositoryName, String projectName, String pipeline, String branchName, String platform, String buildType, String workspace, boolean mount = true, boolean disableSubmodules = false) {
@@ -308,13 +308,15 @@
},
"windows_installer": {
"TAGS": [
"package"
"nightly-clean"
],
"COMMAND": "build_installer_windows.cmd",
"PARAMETERS": {
"CONFIGURATION": "profile",
"OUTPUT_DIRECTORY": "build\\windows_vs2019",
"CMAKE_OPTIONS": "-G \"Visual Studio 16 2019\" -DCMAKE_SYSTEM_VERSION=10.0 -DLY_UNITY_BUILD=TRUE -DLY_DISABLE_TEST_MODULES=TRUE -DCPACK_WIX_ROOT=\"!WIX!\"",
"CMAKE_OPTIONS": "-G \"Visual Studio 16 2019\" -DCMAKE_SYSTEM_VERSION=10.0 -DLY_UNITY_BUILD=TRUE -DLY_DISABLE_TEST_MODULES=TRUE -DCPACK_WIX_ROOT=\"!WIX! \"",
"EXTRA_CMAKE_OPTIONS": "-DLY_INSTALLER_AUTO_GEN_TAG=ON -DLY_INSTALLER_DOWNLOAD_URL=https://dkb1uj4hs9ikv.cloudfront.net -DLY_INSTALLER_LICENSE_URL=https://example.com",
"CPACK_BUCKET": "spectra-prism-staging-us-west-2",
"CMAKE_LY_PROJECTS": "",
"CMAKE_TARGET": "ALL_BUILD",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo"
@@ -21,7 +21,7 @@ IF NOT EXIST %OUTPUT_DIRECTORY% (
PUSHD %OUTPUT_DIRECTORY%
REM Override the temporary directory used by wix to the workspace
SET "WIX_TEMP=!WORKSPACE!/temp/wix"
SET "WIX_TEMP=!WORKSPACE_TMP!/wix"
IF NOT EXIST "%WIX_TEMP%" (
MKDIR "%WIX_TEMP%"
)
@@ -50,9 +50,19 @@ IF ERRORLEVEL 1 (
GOTO :popd_error
)
ECHO [ci_build] "!CPACK_PATH!" -C %CONFIGURATION%
"!CPACK_PATH!" -C %CONFIGURATION%
IF NOT %ERRORLEVEL%==0 GOTO :popd_error
IF NOT "%CPACK_BUCKET%"=="" (
SET "CPACK_OPTIONS=-D CPACK_UPLOAD_URL=s3://%CPACK_BUCKET% %CPACK_OPTIONS%"
)
ECHO [ci_build] "!CPACK_PATH!" -C %CONFIGURATION% %CPACK_OPTIONS%
"!CPACK_PATH!" -C %CONFIGURATION% %CPACK_OPTIONS%
IF NOT %ERRORLEVEL%==0 (
REM dump the log file generated by cpack specifically for WIX
ECHO ****************************************************************
TYPE "_CPack_Packages\\WIX\\wix.log"
ECHO ****************************************************************
GOTO :popd_error
)
POPD
EXIT /b 0
+73
View File
@@ -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)