Merge branch 'development' into o3de_sdk/installer_configs

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	cmake/Packaging.cmake
#	cmake/Projects.cmake
#	scripts/build/Platform/Windows/build_config.json
This commit is contained in:
Esteban Papp
2021-10-18 14:30:02 -07:00
2446 changed files with 169263 additions and 674458 deletions
+20 -15
View File
@@ -793,27 +793,32 @@ catch(Exception e) {
}
finally {
try {
if(env.SNS_TOPIC) {
snsPublish(
topicArn: env.SNS_TOPIC,
subject:'Build Result',
message:"${currentBuild.currentResult}:${BUILD_URL}:${env.RECREATE_VOLUME}:${env.CLEAN_OUTPUT_DIRECTORY}:${env.CLEAN_ASSETS}"
)
}
node('controller') {
if("${currentBuild.currentResult}" == "SUCCESS") {
buildFailure = ""
emailBody = "${BUILD_URL}\nSuccess!"
} else {
buildFailure = tm('${BUILD_FAILURE_ANALYZER}')
emailBody = "${BUILD_URL}\n${buildFailure}!"
if(env.SNS_TOPIC_BUILD_FAILURE) {
message_json = ["build_url":env.BUILD_URL, "repository_name":env.REPOSITORY_NAME, "branch_name":env.BRANCH_NAME, "build_failure":buildFailure]
snsPublish(
topicArn: env.SNS_TOPIC_BUILD_FAILURE,
subject:'Build Failure',
message:JsonOutput.toJson(message_json)
)
}
}
if(env.POST_AR_BUILD_SNS_TOPIC) {
message_json = [
"build_url": env.BUILD_URL,
"build_number": env.BUILD_NUMBER,
"repository_name": env.REPOSITORY_NAME,
"branch_name": env.BRANCH_NAME,
"build_result": "${currentBuild.currentResult}",
"build_failure": buildFailure,
"recreate_volume": env.RECREATE_VOLUME,
"clean_output_directory": env.CLEAN_OUTPUT_DIRECTORY,
"clean_assets": env.CLEAN_ASSETS
]
snsPublish(
topicArn: env.POST_AR_BUILD_SNS_TOPIC,
subject:'Build Result',
message:JsonOutput.toJson(message_json)
)
}
emailext (
body: "${emailBody}",
@@ -31,7 +31,6 @@
],
"steps": [
"profile_vs2019",
"test_impact_analysis_profile_vs2019",
"asset_profile_vs2019",
"test_cpu_profile_vs2019"
]
@@ -306,6 +305,7 @@
},
"release_vs2019": {
"TAGS": [
"default",
"nightly-incremental",
"nightly-clean",
"weekly-build-metrics"
@@ -351,17 +351,21 @@
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo"
}
},
"windows_installer": {
"installer_vs2019": {
"TAGS": [
"nightly-clean"
"nightly-clean",
"nightly-installer"
],
"PIPELINE_ENV":{
"NODE_LABEL":"windows-packaging"
},
"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 -DLY_VERSION_ENGINE_NAME=o3de-sdk -DLY_INSTALLER_WIX_ROOT=\"!WIX!\"",
"EXTRA_CMAKE_OPTIONS": "-DLY_INSTALLER_AUTO_GEN_TAG=ON -DLY_INSTALLER_DOWNLOAD_URL=https://www.o3debinaries.org -DLY_INSTALLER_LICENSE_URL=https://www.o3debinaries.org/license",
"CPACK_BUCKET": "spectra-prism-staging-us-west-2",
"EXTRA_CMAKE_OPTIONS": "-DLY_INSTALLER_AUTO_GEN_TAG=ON -DLY_INSTALLER_DOWNLOAD_URL=!INSTALLER_DOWNLOAD_URL! -DLY_INSTALLER_LICENSE_URL=!INSTALLER_DOWNLOAD_URL!/license",
"CPACK_BUCKET": "!INSTALLER_BUCKET!",
"CMAKE_LY_PROJECTS": "",
"CMAKE_TARGET": "ALL_BUILD",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo"
@@ -57,7 +57,7 @@ IF ERRORLEVEL 1 (
exit /b 1
)
CALL :DeployCDKApplication AWSCore --all
CALL :DeployCDKApplication AWSCore "-c disable_access_log=true --all"
IF ERRORLEVEL 1 (
exit /b 1
)
@@ -18,6 +18,8 @@ from contextlib import contextmanager
import threading
import _thread
from botocore.config import Config
DEFAULT_REGION = 'us-west-2'
DEFAULT_DISK_SIZE = 300
DEFAULT_DISK_TYPE = 'gp2'
@@ -173,10 +175,27 @@ def get_region_name():
def get_ec2_client(region):
client = boto3.client('ec2', region_name=region)
client_config = Config(
region_name=region,
retries={
'mode': 'standard'
}
)
client = boto3.client('ec2', config=client_config)
return client
def get_ec2_resource(region):
resource_config = Config(
region_name=region,
retries={
'mode': 'standard'
}
)
resource = boto3.resource('ec2', config=resource_config)
return resource
def get_ec2_instance_id():
try:
instance_id = urllib.request.urlopen('http://169.254.169.254/latest/meta-data/instance-id').read()
@@ -233,6 +252,18 @@ def find_snapshot_id(ec2_client, snapshot_hint, repository_name, project, pipeli
snapshot_id = snapshot['SnapshotId']
return snapshot_id
def offline_drive(disk_number=1):
"""Use diskpart to offline a Windows drive"""
with tempfile.NamedTemporaryFile(delete=False) as f:
f.write(f"""
select disk {disk_number}
offline disk
""".encode('utf-8'))
subprocess.run(['diskpart', '/s', f.name])
os.unlink(f.name)
def create_volume(ec2_client, availability_zone, snapshot_hint, repository_name, project, pipeline, branch, platform, build_type, disk_size, disk_type):
# The actual EBS default calculation for IOps is a floating point number, the closest approxmiation is 4x of the disk size for simplicity
mount_name = get_mount_name(repository_name, project, pipeline, branch, platform, build_type)
@@ -291,23 +322,26 @@ def create_volume(ec2_client, availability_zone, snapshot_hint, repository_name,
def mount_volume_to_device(created):
print('Mounting volume...')
if os.name == 'nt':
f = tempfile.NamedTemporaryFile(delete=False)
f.write("""
select disk 1
online disk
attribute disk clear readonly
""".encode('utf-8')) # assume disk # for now
# Verify drive is in an offline state.
# Some Windows configs will automatically set new drives as online causing diskpart setup script to fail.
offline_drive()
if created:
print('Creating filesystem on new volume')
f.write("""create partition primary
select partition 1
format quick fs=ntfs
assign
active
""".encode('utf-8'))
with tempfile.NamedTemporaryFile(delete=False) as f:
f.write("""
select disk 1
online disk
attribute disk clear readonly
""".encode('utf-8')) # assume disk # for now
f.close()
if created:
print('Creating filesystem on new volume')
f.write("""
create partition primary
select partition 1
format quick fs=ntfs
assign
active
""".encode('utf-8'))
subprocess.call(['diskpart', '/s', f.name])
@@ -358,14 +392,7 @@ def unmount_volume_from_device():
print('Unmounting EBS volume from device...')
if os.name == 'nt':
kill_processes(MOUNT_PATH + 'workspace')
f = tempfile.NamedTemporaryFile(delete=False)
f.write("""
select disk 1
offline disk
""".encode('utf-8'))
f.close()
subprocess.call('diskpart /s %s' % f.name)
os.unlink(f.name)
offline_drive()
else:
kill_processes(MOUNT_PATH)
subprocess.call(['umount', '-f', MOUNT_PATH])
@@ -395,14 +422,11 @@ def detach_volume_from_ec2_instance(volume, ec2_instance_id, force, timeout_dura
def mount_ebs(snapshot_hint, repository_name, project, pipeline, branch, platform, build_type, disk_size, disk_type):
session = boto3.session.Session()
region = session.region_name
if region is None:
region = DEFAULT_REGION
region = get_region_name()
ec2_client = get_ec2_client(region)
ec2_instance_id = get_ec2_instance_id()
ec2_availability_zone = get_availability_zone()
ec2_resource = boto3.resource('ec2', region_name=region)
ec2_resource = get_ec2_resource(region)
ec2_instance = ec2_resource.Instance(ec2_instance_id)
for volume in ec2_instance.volumes.all():
@@ -469,7 +493,7 @@ def mount_ebs(snapshot_hint, repository_name, project, pipeline, branch, platfor
def unmount_ebs():
region = get_region_name()
ec2_instance_id = get_ec2_instance_id()
ec2_resource = boto3.resource('ec2', region_name=region)
ec2_resource = get_ec2_resource(region)
ec2_instance = ec2_resource.Instance(ec2_instance_id)
if os.path.isfile('envinject.properties'):