Setup cloud runner state properly within RemoteClientCli

pull/310/head
Frostebite 2021-12-22 01:12:36 +00:00
parent 443a0403d5
commit 62b4c04614
9 changed files with 20 additions and 302 deletions

View File

@ -1,98 +0,0 @@
getInput=getInput(query) {
return Input.githubEnabled
? core.getInput(query)
: Input.cliOptions[query] !== undefined
? Input.cliOptions[query]
: process.env[query] !== undefined
? process.env[query]
: false;
}
androidKeystorePass=
androidKeystoreBase64=
ANDROID_VERSION_CODE=1
kubeConfig=
HOSTNAME=ip-10-0-1-22.eu-west-2.compute.internal
customImage=false
testCustomSecret=VALUEXXX
androidKeyaliasPass=
BUILDID=0-windows64-btbj
SHLVL=1
branch=remote-builder/unified-providers
githubRepo=game-ci/unity-builder
HOME=/root
cloudRunnerCpu=1.0
versioningStrategy=None
platform=StandaloneWindows64
githubEnabled=false
ANDROID_KEYSTORE_NAME=
buildPathFull=/data/0-windows64-btbj
version=2019.2.11f1
region=eu-west-2
AWS_EXECUTION_ENV=AWS_ECS_FARGATE
specifiedVersion=
chownFilesTo=
BUILD_FILE=StandaloneWindows64.exe
runNumber=0
buildMethod=
ANDROID_KEYALIAS_NAME=
BUILD_NAME=StandaloneWindows64
VERSION=none
AWS_DEFAULT_REGION=eu-west-2
logToFile=true
runnerTempPath=undefined
sshAgent=
androidVersionCode=false
ECS_CONTAINER_METADATA_URI_V4=http://169.254.170.2/v4/978ea84caeab48ddad29e3b8243e4e3d-1072172599
androidKeystoreName=
BUILD_METHOD=
kubeVolumeSize=5Gi
ECS_CONTAINER_METADATA_URI=http://169.254.170.2/v3/978ea84caeab48ddad29e3b8243e4e3d-1072172599
CUSTOM_PARAMETERS=
steamPathFull=/data/0-windows64-btbj/steam
customParameters=
repoPathFull=/data/0-windows64-btbj/repo
cloudRunnerCluster=
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
libraryFolderFull=/data/0-windows64-btbj/repo/test-project/Library
androidAppBundle=false
androidKeyaliasName=
preBuildSteps=
buildFile=StandaloneWindows64.exe
ContainerMemory=750M
projectPath=test-project
buildName=StandaloneWindows64
unityVersion=auto
BUILD_TARGET=StandaloneWindows64
targetPlatform=StandaloneWindows64
BUILD_PATH=build/StandaloneWindows64
ALLOW_EMPTY_PASSWORD=yes
PROJECT_PATH=test-project
AWS_REGION=eu-west-2
awsBaseStackName=game-ci-3-test
GITHUB_WORKSPACE=/github/workspace
length=0
buildVersion=none
builderPathFull=/data/0-windows64-btbj/builder
cliOptions=[object Object]
postBuildSteps=
name=Input
cloudRunnerMemory=750M
PWD=/data
buildsPath=build
allowDirtyBuild=false
githubToken=
UNITY_VERSION=2019.2.11f1
buildPath=build/StandaloneWindows64
projectPathFull=/data/0-windows64-btbj/repo/test-project
kubeVolume=
customBuildSteps=
- name: 'step 1'
image: 'alpine'
commands: ['printenv']
secrets:
- name: 'testCustomSecret'
value: 'VALUEXXX'
prototype=[object Object]
ContainerCpu=1.0
remoteBuilderIntegrationTests=true

View File

@ -1,97 +0,0 @@
getInput=getInput(query) {
return Input.githubEnabled
? core.getInput(query)
: Input.cliOptions[query] !== undefined
? Input.cliOptions[query]
: process.env[query] !== undefined
? process.env[query]
: false;
}
androidKeystoreBase64=
androidKeystorePass=
ANDROID_VERSION_CODE=1
kubeConfig=
customImage=false
HOSTNAME=ip-10-0-0-201.eu-west-2.compute.internal
testCustomSecret=VALUEXXX
androidKeyaliasPass=
BUILDID=0-windows64-h1wl
SHLVL=1
branch=remote-builder/unified-providers
githubRepo=game-ci/unity-builder
HOME=/root
cloudRunnerCpu=1.0
versioningStrategy=None
platform=StandaloneWindows64
githubEnabled=false
ANDROID_KEYSTORE_NAME=
version=2019.2.11f1
buildPathFull=/data/0-windows64-h1wl
AWS_EXECUTION_ENV=AWS_ECS_FARGATE
region=eu-west-2
specifiedVersion=
runNumber=0
BUILD_FILE=StandaloneWindows64.exe
chownFilesTo=
BUILD_NAME=StandaloneWindows64
buildMethod=
ANDROID_KEYALIAS_NAME=
VERSION=none
AWS_DEFAULT_REGION=eu-west-2
logToFile=true
sshAgent=
androidVersionCode=false
ECS_CONTAINER_METADATA_URI_V4=http://169.254.170.2/v4/25d37a163d3642b08b3847875d61c58f-2663259997
androidKeystoreName=
BUILD_METHOD=
ECS_CONTAINER_METADATA_URI=http://169.254.170.2/v3/25d37a163d3642b08b3847875d61c58f-2663259997
steamPathFull=/data/0-windows64-h1wl/steam
customParameters=
CUSTOM_PARAMETERS=
kubeVolumeSize=5Gi
cloudRunnerCluster=
repoPathFull=/data/0-windows64-h1wl/repo
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
libraryFolderFull=/data/0-windows64-h1wl/repo/test-project/Library
androidAppBundle=false
preBuildSteps=
androidKeyaliasName=
buildFile=StandaloneWindows64.exe
ContainerMemory=750M
projectPath=test-project
buildName=StandaloneWindows64
BUILD_TARGET=StandaloneWindows64
unityVersion=auto
targetPlatform=StandaloneWindows64
ALLOW_EMPTY_PASSWORD=yes
BUILD_PATH=build/StandaloneWindows64
PROJECT_PATH=test-project
AWS_REGION=eu-west-2
awsBaseStackName=game-ci-3-test
GITHUB_WORKSPACE=/github/workspace
builderPathFull=/data/0-windows64-h1wl/builder
length=0
buildVersion=none
cliOptions=[object Object]
postBuildSteps=
name=Input
cloudRunnerMemory=750M
PWD=/data
buildsPath=build
allowDirtyBuild=false
githubToken=
UNITY_VERSION=2019.2.11f1
buildPath=build/StandaloneWindows64
projectPathFull=/data/0-windows64-h1wl/repo/test-project
kubeVolume=
prototype=[object Object]
ContainerCpu=1.0
customBuildSteps=
- name: 'step 1'
image: 'alpine'
commands: ['printenv']
secrets:
- name: 'testCustomSecret'
value: 'VALUEXXX'
remoteBuilderIntegrationTests=true

View File

@ -1,98 +0,0 @@
getInput=getInput(query) {
return Input.githubEnabled
? core.getInput(query)
: Input.cliOptions[query] !== undefined
? Input.cliOptions[query]
: process.env[query] !== undefined
? process.env[query]
: false;
}
androidKeystoreBase64=
androidKeystorePass=
ANDROID_VERSION_CODE=1
kubeConfig=
customImage=false
HOSTNAME=ip-10-0-1-224.eu-west-2.compute.internal
testCustomSecret=VALUEXXX
androidKeyaliasPass=
BUILDID=0-windows64-qwbx
SHLVL=1
githubRepo=game-ci/unity-builder
branch=remote-builder/unified-providers
HOME=/root
cloudRunnerCpu=1.0
platform=StandaloneWindows64
versioningStrategy=None
buildPathFull=/data/0-windows64-qwbx
version=2019.2.11f1
githubEnabled=false
ANDROID_KEYSTORE_NAME=
AWS_EXECUTION_ENV=AWS_ECS_FARGATE
region=eu-west-2
specifiedVersion=
runNumber=0
BUILD_FILE=StandaloneWindows64.exe
chownFilesTo=
BUILD_NAME=StandaloneWindows64
buildMethod=
ANDROID_KEYALIAS_NAME=
VERSION=none
logToFile=true
AWS_DEFAULT_REGION=eu-west-2
androidVersionCode=false
runnerTempPath=undefined
sshAgent=
ECS_CONTAINER_METADATA_URI_V4=http://169.254.170.2/v4/a7cf38309de6450a9ad8717b181bc485-2780554367
androidKeystoreName=
BUILD_METHOD=
ECS_CONTAINER_METADATA_URI=http://169.254.170.2/v3/a7cf38309de6450a9ad8717b181bc485-2780554367
CUSTOM_PARAMETERS=
kubeVolumeSize=5Gi
customParameters=
steamPathFull=/data/0-windows64-qwbx/steam
repoPathFull=/data/0-windows64-qwbx/repo
cloudRunnerCluster=
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
libraryFolderFull=/data/0-windows64-qwbx/repo/test-project/Library
androidAppBundle=false
androidKeyaliasName=
preBuildSteps=
ContainerMemory=750M
projectPath=test-project
buildFile=StandaloneWindows64.exe
BUILD_TARGET=StandaloneWindows64
buildName=StandaloneWindows64
unityVersion=auto
targetPlatform=StandaloneWindows64
ALLOW_EMPTY_PASSWORD=yes
BUILD_PATH=build/StandaloneWindows64
PROJECT_PATH=test-project
AWS_REGION=eu-west-2
GITHUB_WORKSPACE=/github/workspace
awsBaseStackName=game-ci-3-test
buildVersion=none
length=0
builderPathFull=/data/0-windows64-qwbx/builder
cliOptions=[object Object]
cloudRunnerMemory=750M
name=Input
postBuildSteps=
PWD=/data
allowDirtyBuild=false
buildsPath=build
UNITY_VERSION=2019.2.11f1
githubToken=
buildPath=build/StandaloneWindows64
projectPathFull=/data/0-windows64-qwbx/repo/test-project
kubeVolume=
prototype=[object Object]
customBuildSteps=
- name: 'step 1'
image: 'alpine'
commands: ['printenv']
secrets:
- name: 'testCustomSecret'
value: 'VALUEXXX'
ContainerCpu=1.0
remoteBuilderIntegrationTests=true

10
dist/index.js vendored
View File

@ -85,8 +85,9 @@ core.info(`\r\n`);
core.info(`INPUT:`); core.info(`INPUT:`);
for (const element of properties) { for (const element of properties) {
program.option(`--${element} <${element}>`, 'default description'); program.option(`--${element} <${element}>`, 'default description');
if (model_1.Input[element] !== undefined && model_1.Input[element] !== '') if (model_1.Input[element] !== undefined && model_1.Input[element] !== '') {
core.info(element); core.info(`${element} ${model_1.Input[element]}`);
}
} }
core.info(`\r\n`); core.info(`\r\n`);
program.option('-m, --mode <mode>', 'cli or default'); program.option('-m, --mode <mode>', 'cli or default');
@ -2847,6 +2848,7 @@ class WorkflowCompositionRoot {
static runJob(baseImage) { static runJob(baseImage) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
core.info(`Remote envs ${JSON.stringify(cloud_runner_state_1.CloudRunnerState.readBuildEnvironmentVariables(), undefined, 4)} Remote secrets ${JSON.stringify(cloud_runner_state_1.CloudRunnerState.defaultSecrets, undefined, 4)}`);
core.info(`Custom build steps: ${cloud_runner_state_1.CloudRunnerState.buildParams.customBuildSteps}`); core.info(`Custom build steps: ${cloud_runner_state_1.CloudRunnerState.buildParams.customBuildSteps}`);
if (cloud_runner_state_1.CloudRunnerState.buildParams.customBuildSteps === '') { if (cloud_runner_state_1.CloudRunnerState.buildParams.customBuildSteps === '') {
yield new build_automation_workflow_1.BuildAutomationWorkflow().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, cloud_runner_state_1.CloudRunnerState.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets)); yield new build_automation_workflow_1.BuildAutomationWorkflow().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, cloud_runner_state_1.CloudRunnerState.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
@ -3202,12 +3204,12 @@ const core = __webpack_require__(42186);
*/ */
class Input { class Input {
static get remoteBuilderIntegrationTests() { static get remoteBuilderIntegrationTests() {
return Input.getInput(`remoteBuilderIntegrationTests`); return Input.getInput(`remoteBuilderIntegrationTests`) || Input.getInput(`remoteBuilderTests`);
} }
static getInput(query) { static getInput(query) {
return Input.githubEnabled return Input.githubEnabled
? core.getInput(query) ? core.getInput(query)
: Input.cliOptions[query] !== undefined : Input.cliOptions !== undefined && Input.cliOptions[query] !== undefined
? Input.cliOptions[query] ? Input.cliOptions[query]
: process.env[query] !== undefined : process.env[query] !== undefined
? process.env[query] ? process.env[query]

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -48,7 +48,9 @@ core.info(`\r\n`);
core.info(`INPUT:`); core.info(`INPUT:`);
for (const element of properties) { for (const element of properties) {
program.option(`--${element} <${element}>`, 'default description'); program.option(`--${element} <${element}>`, 'default description');
if (Input[element] !== undefined && Input[element] !== '') core.info(element); if (Input[element] !== undefined && Input[element] !== '') {
core.info(`${element} ${Input[element]}`);
}
} }
core.info(`\r\n`); core.info(`\r\n`);
program.option('-m, --mode <mode>', 'cli or default'); program.option('-m, --mode <mode>', 'cli or default');

View File

@ -33,7 +33,7 @@ describe('Cloud Runner', () => {
const keys = Object.keys(buildParameter); const keys = Object.keys(buildParameter);
for (const element of keys) { for (const element of keys) {
if (buildParameter[element] !== undefined) { if (buildParameter[element] !== undefined) {
expect(file).toContain(`${element}`); expect(file).toContain(`${element}=`);
} }
} }
} }

View File

@ -18,6 +18,13 @@ export class WorkflowCompositionRoot implements WorkflowInterface {
private static async runJob(baseImage: any) { private static async runJob(baseImage: any) {
try { try {
core.info(
`Remote envs ${JSON.stringify(
CloudRunnerState.readBuildEnvironmentVariables(),
undefined,
4,
)} Remote secrets ${JSON.stringify(CloudRunnerState.defaultSecrets, undefined, 4)}`,
);
core.info(`Custom build steps: ${CloudRunnerState.buildParams.customBuildSteps}`); core.info(`Custom build steps: ${CloudRunnerState.buildParams.customBuildSteps}`);
if (CloudRunnerState.buildParams.customBuildSteps === '') { if (CloudRunnerState.buildParams.customBuildSteps === '') {
await new BuildAutomationWorkflow().run( await new BuildAutomationWorkflow().run(

View File

@ -11,12 +11,12 @@ class Input {
public static githubEnabled = true; public static githubEnabled = true;
public static cliOptions; public static cliOptions;
static get remoteBuilderIntegrationTests(): boolean { static get remoteBuilderIntegrationTests(): boolean {
return Input.getInput(`remoteBuilderIntegrationTests`); return Input.getInput(`remoteBuilderIntegrationTests`) || Input.getInput(`remoteBuilderTests`);
} }
private static getInput(query) { private static getInput(query) {
return Input.githubEnabled return Input.githubEnabled
? core.getInput(query) ? core.getInput(query)
: Input.cliOptions[query] !== undefined : Input.cliOptions !== undefined && Input.cliOptions[query] !== undefined
? Input.cliOptions[query] ? Input.cliOptions[query]
: process.env[query] !== undefined : process.env[query] !== undefined
? process.env[query] ? process.env[query]