Skip to content
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

Stabilization of Verisioning and Predictable Defaults #520 #122

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions cloudformation-template/unity-mc.main.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Metadata:
- Venue
- GithubToken
- MCVersion
- MCSha
- Label:
default: Network configuration
Parameters:
Expand Down Expand Up @@ -52,6 +53,8 @@ Metadata:
default: Github token with repo:read access.
MCVersion:
default: latest
MCSha:
default: ""
Venue:
default: Name of the venue being setup
Project:
Expand Down Expand Up @@ -113,6 +116,12 @@ Parameters:
Default: latest
ConstraintDescription: The version of unity-sds/unity-management-console to install.

MCSha:
Description: Management Console Sha
Type: String
Default: ""
ConstraintDescription: A commit sha to build the Management Console from.

Venue:
Description: e.g. Dev, Test, Ops. See https://unity-sds.gitbook.io/docs/architecture/deployments-projects-and-venues
Type: String
Expand Down Expand Up @@ -464,10 +473,36 @@ Resources:
commands:
01_install_management_console:
command: !Sub |
set -ex \
&& echo "running 01_install_management_console" \
&& { if [ "${MCVersion}" = "latest" ]; then sudo -i -u ubuntu wget -q -O managementconsole.zip "https://github.com/unity-sds/unity-management-console/releases/latest/download/managementconsole.zip"; else sudo -i -u ubuntu wget -q -O managementconsole.zip "https://github.com/unity-sds/unity-management-console/releases/download/${MCVersion}/managementconsole.zip" ; fi } \
&& sudo -i -u ubuntu unzip managementconsole.zip
#!/bin/bash
sudo -u ubuntu bash << 'EOFMC'
set -ex
echo "running 01_install_management_console"
echo "requested sha: ${MCSha}"
if [ "${MCSha}" != "" ]; then
git clone https://github.com/unity-sds/unity-management-console.git
cd unity-management-console
git checkout ${MCSha}
cd /home/ubuntu/
wget https://go.dev/dl/go1.20.14.linux-amd64.tar.gz
tar xfvz go1.20.14.linux-amd64.tar.gz
export GOROOT=$(pwd)/go
export GOPATH=$(pwd)/go/bin
export PATH=$(pwd)/go/bin:$PATH
cd /home/ubuntu/unity-management-console
npm ci
git clone https://github.com/unity-sds/unity-cs-infra.git workflowresources
sudo apt-get install -y zip
npm run package && npm run build-integration
cd /home/ubuntu
unzip unity-management-console/managementconsole.zip
elif [ "${MCVersion}" = "latest" ]; then
wget -q -O managementconsole.zip "https://github.com/unity-sds/unity-management-console/releases/latest/download/managementconsole.zip"
unzip managementconsole.zip
else
wget -q -O managementconsole.zip "https://github.com/unity-sds/unity-management-console/releases/download/${MCVersion}/managementconsole.zip"
unzip managementconsole.zip
fi
EOFMC
cwd: /home/ubuntu
02_install_service:
command: !Sub |
Expand Down
9 changes: 8 additions & 1 deletion nightly_tests/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ STACK_NAME=""
PROJECT_NAME=""
VENUE_NAME=""
MC_VERSION="latest"
MC_SHA=""
CONFIG_FILE=""

# Function to display usage instructions
usage() {
echo "Usage: $0 --stack-name <cloudformation_stack_name> --project-name <PROJECT_NAME> --venue-name <VENUE_NAME> [--mc-version <MC_VERSION>] [--config-file <CONFIG_FILE>]"
echo "Usage: $0 --stack-name <cloudformation_stack_name> --project-name <PROJECT_NAME> --venue-name <VENUE_NAME> [--mc-version <MC_VERSION>] [--mc-sha <MC_SHA>] [--config-file <CONFIG_FILE>]"
exit 1
}

Expand Down Expand Up @@ -38,6 +39,10 @@ while [[ $# -gt 0 ]]; do
MC_VERSION="$2"
shift 2
;;
--mc-sha)
MC_SHA="$2"
shift 2
;;
--config-file)
CONFIG_FILE="$2"
shift 2
Expand All @@ -62,6 +67,7 @@ fi
echo "deploy.sh :: STACK_NAME: ${STACK_NAME}"
echo "deploy.sh :: PROJECT_NAME: ${PROJECT_NAME}"
echo "deploy.sh :: VENUE_NAME: ${VENUE_NAME}"
echo "deploy.sh :: MC_SHA: ${MC_SHA}"

#
# Create the SSM parameters required by this deployment
Expand Down Expand Up @@ -122,6 +128,7 @@ aws cloudformation create-stack \
ParameterKey=Project,ParameterValue=${PROJECT_NAME} \
ParameterKey=Venue,ParameterValue=${VENUE_NAME} \
ParameterKey=MCVersion,ParameterValue=${MC_VERSION} \
ParameterKey=MCSha,ParameterValue=${MC_SHA} \
ParameterKey=MarketplaceItems,ParameterValue="${escaped_config_content}" \
--tags Key=ServiceArea,Value=U-CS

Expand Down
12 changes: 10 additions & 2 deletions nightly_tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ PROJECT_NAME=""
VENUE_NAME=""
MC_VERSION="latest"
DEPLOYMENT_START_TIME=$(date +%s)
MC_SHA=""
CONFIG_FILE="marketplace_config.yaml" # Set default config file
# Function to display usage instructions
usage() {
echo "Usage: $0 --destroy <true|false> --run-tests <true|false> --project-name <PROJECT_NAME> --venue-name <VENUE_NAME> [--mc-version <MC_VERSION>] [--config-file <CONFIG_FILE>]"
echo "Usage: $0 --destroy <true|false> --run-tests <true|false> --project-name <PROJECT_NAME> --venue-name <VENUE_NAME> [--mc-version <MC_VERSION>] [--mc-sha <MC_SHA>] [--config-file <CONFIG_FILE>]"
exit 1
}

Expand Down Expand Up @@ -62,6 +63,10 @@ while [[ $# -gt 0 ]]; do
CONFIG_FILE="$2"
shift 2
;;
--mc-sha)
MC_SHA="$2"
shift 2
;;
*)
echo "Invalid option: $1" >&2
exit 1
Expand Down Expand Up @@ -135,10 +140,12 @@ echo " - Run tests? $RUN_TESTS"
echo " - Project Name: $PROJECT_NAME"
echo " - Venue Name: $VENUE_NAME"
echo " - MC Version: $MC_VERSION"
echo " - MC SHA: $MC_SHA"
echo " - Config File: $CONFIG_FILE"

echo "---------------------------------------------------------"

export MC_SHA="${MC_SHA}"
export STACK_NAME="unity-management-console-${PROJECT_NAME}-${VENUE_NAME}"
export GH_BRANCH=main
TODAYS_DATE=$(date '+%F_%H-%M')
Expand Down Expand Up @@ -198,6 +205,7 @@ mkdir -p ${LOG_DIR}
NIGHTLY_HASH=$(git rev-parse --short HEAD)
echo "Repo Hash (Nightly Test): [$NIGHTLY_HASH]" >> nightly_output.txt
echo "Repo Hash (Nightly Test): [$NIGHTLY_HASH]"
echo "Management Console SHA: [$MC_SHA]"

## update self (unity-cs-infra repository)
git pull origin ${GH_BRANCH}
Expand All @@ -206,7 +214,7 @@ git checkout ${GH_BRANCH}
#
# Deploy the Management Console using CloudFormation
#
bash deploy.sh --stack-name "${STACK_NAME}" --project-name "${PROJECT_NAME}" --venue-name "${VENUE_NAME}" --mc-version "${MC_VERSION}" --config-file "$CONFIG_FILE"
bash deploy.sh --stack-name "${STACK_NAME}" --project-name "${PROJECT_NAME}" --venue-name "${VENUE_NAME}" --mc-version "${MC_VERSION}" --config-file "$CONFIG_FILE" --mc-sha "$MC_SHA"

echo "Deploying Management Console..." >> nightly_output.txt
echo "Deploying Management Console..."
Expand Down
Loading