Built in ephemeral runner support started
parent
f2e2a4bc06
commit
04dfd76d44
|
|
@ -0,0 +1,64 @@
|
||||||
|
name: Remote Build AWS Fargate GitHub Ephemeral Runner
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: { branches: [main, aws, remote-builder/unified-providers] }
|
||||||
|
|
||||||
|
env:
|
||||||
|
AWS_REGION: 'eu-west-1'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
buildForAllPlatforms:
|
||||||
|
name: AWS Fargate Build
|
||||||
|
if: github.event.pull_request.draft == false
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
projectPath:
|
||||||
|
- test-project
|
||||||
|
unityVersion:
|
||||||
|
# - 2019.2.11f1
|
||||||
|
- 2019.3.15f1
|
||||||
|
targetPlatform:
|
||||||
|
#- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
|
||||||
|
#- StandaloneWindows64 # Build a Windows 64-bit standalone.
|
||||||
|
- StandaloneLinux64 # Build a Linux 64-bit standalone.
|
||||||
|
#- iOS # Build an iOS player.
|
||||||
|
#- Android # Build an Android .apk.
|
||||||
|
#- WebGL # WebGL.
|
||||||
|
# - StandaloneWindows # Build a Windows standalone.
|
||||||
|
# - WSAPlayer # Build an Windows Store Apps player.
|
||||||
|
# - PS4 # Build a PS4 Standalone.
|
||||||
|
# - XboxOne # Build a Xbox One Standalone.
|
||||||
|
# - tvOS # Build to Apple's tvOS platform.
|
||||||
|
# - Switch # Build a Nintendo Switch player
|
||||||
|
# steps
|
||||||
|
steps:
|
||||||
|
- name: Checkout (default)
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
if: github.event.event_type != 'pull_request_target'
|
||||||
|
with:
|
||||||
|
lfs: true
|
||||||
|
- name: Configure AWS Credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
|
with:
|
||||||
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
aws-region: eu-west-2
|
||||||
|
- uses: ./
|
||||||
|
id: aws-fargate-unity-build
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_DEFAULT_REGION: eu-west-2
|
||||||
|
CloudRunnerBranch: remote-builder/unified-providers
|
||||||
|
DEBUG: true
|
||||||
|
with:
|
||||||
|
cloudRunnerCluster: aws
|
||||||
|
projectPath: ${{ matrix.projectPath }}
|
||||||
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
|
targetPlatform: ${{ matrix.targetPlatform }}
|
||||||
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
awsBaseStackName: game-ci-stack
|
||||||
|
customBuildSteps: ephemeral
|
||||||
|
|
@ -61,10 +61,4 @@ jobs:
|
||||||
targetPlatform: ${{ matrix.targetPlatform }}
|
targetPlatform: ${{ matrix.targetPlatform }}
|
||||||
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
awsBaseStackName: game-ci-stack
|
awsBaseStackName: game-ci-stack
|
||||||
customBuildSteps: >-
|
customBuildSteps: ephemeral
|
||||||
- name: 'step 1'
|
|
||||||
image: 'alpine'
|
|
||||||
commands: ['mkdir actions-runner && cd actions-runner && curl -O -L https://github.com/actions/runner/releases/download/v2.283.1/actions-runner-linux-x64-2.283.1.tar.gz && tar xzf ./actions-runner-linux-x64-2.283.1.tar.gz']
|
|
||||||
secrets:
|
|
||||||
- name: 'testCustomSecret'
|
|
||||||
value: 'VALUEXXX'
|
|
||||||
|
|
|
||||||
|
|
@ -1204,17 +1204,19 @@ class CloudRunner {
|
||||||
static runMainJob(baseImage) {
|
static runMainJob(baseImage) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (this.buildParams.customBuildSteps === '') {
|
if (this.buildParams.customBuildSteps === '') {
|
||||||
cloud_runner_logger_1.default.log(`Cloud Runner is running in standard build automation mode`);
|
|
||||||
yield CloudRunner.standardBuildAutomation(baseImage);
|
yield CloudRunner.standardBuildAutomation(baseImage);
|
||||||
}
|
}
|
||||||
|
else if (this.buildParams.customBuildSteps === 'ephemeral') {
|
||||||
|
yield CloudRunner.runJobAsEphemeralGitHubRunner(baseImage);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
cloud_runner_logger_1.default.log(`Cloud Runner is running in custom job mode`);
|
|
||||||
yield CloudRunner.runCustomJob(this.buildParams.customBuildSteps);
|
yield CloudRunner.runCustomJob(this.buildParams.customBuildSteps);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static standardBuildAutomation(baseImage) {
|
static standardBuildAutomation(baseImage) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
cloud_runner_logger_1.default.log(`Cloud Runner is running in standard build automation mode`);
|
||||||
cloud_runner_logger_1.default.logWithTime('Pre build steps time');
|
cloud_runner_logger_1.default.logWithTime('Pre build steps time');
|
||||||
yield this.runCustomJob(this.buildParams.preBuildSteps);
|
yield this.runCustomJob(this.buildParams.preBuildSteps);
|
||||||
cloud_runner_logger_1.default.logWithTime('Setup time');
|
cloud_runner_logger_1.default.logWithTime('Setup time');
|
||||||
|
|
@ -1226,8 +1228,16 @@ class CloudRunner {
|
||||||
cloud_runner_logger_1.default.logWithTime('Post build steps time');
|
cloud_runner_logger_1.default.logWithTime('Post build steps time');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
static runJobAsEphemeralGitHubRunner(baseImage) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
cloud_runner_logger_1.default.log(`Cloud Runner is running in ephemeral GitHub runner mode`);
|
||||||
|
const installAndStartRunner = 'mkdir actions-runner && cd actions-runner && curl -O -L https://github.com/actions/runner/releases/download/v2.283.1/actions-runner-linux-x64-2.283.1.tar.gz && tar xzf ./actions-runner-linux-x64-2.283.1.tar.gz';
|
||||||
|
yield this.CloudRunnerProviderPlatform.runBuildTask(this.buildGuid, baseImage, [installAndStartRunner], `/${buildVolumeFolder}`, `/${buildVolumeFolder}`, this.defaultGitShaEnvironmentVariable, [...this.defaultSecrets]);
|
||||||
|
});
|
||||||
|
}
|
||||||
static runCustomJob(buildSteps) {
|
static runCustomJob(buildSteps) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
cloud_runner_logger_1.default.log(`Cloud Runner is running in custom job mode`);
|
||||||
buildSteps = yaml_1.default.parse(buildSteps);
|
buildSteps = yaml_1.default.parse(buildSteps);
|
||||||
for (const step of buildSteps) {
|
for (const step of buildSteps) {
|
||||||
const stepSecrets = step.secrets.map((x) => {
|
const stepSecrets = step.secrets.map((x) => {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -247,15 +247,16 @@ class CloudRunner {
|
||||||
|
|
||||||
private static async runMainJob(baseImage: any) {
|
private static async runMainJob(baseImage: any) {
|
||||||
if (this.buildParams.customBuildSteps === '') {
|
if (this.buildParams.customBuildSteps === '') {
|
||||||
CloudRunnerLogger.log(`Cloud Runner is running in standard build automation mode`);
|
|
||||||
await CloudRunner.standardBuildAutomation(baseImage);
|
await CloudRunner.standardBuildAutomation(baseImage);
|
||||||
|
} else if (this.buildParams.customBuildSteps === 'ephemeral') {
|
||||||
|
await CloudRunner.runJobAsEphemeralGitHubRunner(baseImage);
|
||||||
} else {
|
} else {
|
||||||
CloudRunnerLogger.log(`Cloud Runner is running in custom job mode`);
|
|
||||||
await CloudRunner.runCustomJob(this.buildParams.customBuildSteps);
|
await CloudRunner.runCustomJob(this.buildParams.customBuildSteps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async standardBuildAutomation(baseImage: any) {
|
private static async standardBuildAutomation(baseImage: any) {
|
||||||
|
CloudRunnerLogger.log(`Cloud Runner is running in standard build automation mode`);
|
||||||
CloudRunnerLogger.logWithTime('Pre build steps time');
|
CloudRunnerLogger.logWithTime('Pre build steps time');
|
||||||
await this.runCustomJob(this.buildParams.preBuildSteps);
|
await this.runCustomJob(this.buildParams.preBuildSteps);
|
||||||
CloudRunnerLogger.logWithTime('Setup time');
|
CloudRunnerLogger.logWithTime('Setup time');
|
||||||
|
|
@ -266,8 +267,22 @@ class CloudRunner {
|
||||||
await this.runCustomJob(this.buildParams.postBuildSteps);
|
await this.runCustomJob(this.buildParams.postBuildSteps);
|
||||||
CloudRunnerLogger.logWithTime('Post build steps time');
|
CloudRunnerLogger.logWithTime('Post build steps time');
|
||||||
}
|
}
|
||||||
|
private static async runJobAsEphemeralGitHubRunner(baseImage: any) {
|
||||||
|
CloudRunnerLogger.log(`Cloud Runner is running in ephemeral GitHub runner mode`);
|
||||||
|
const installAndStartRunner =
|
||||||
|
'mkdir actions-runner && cd actions-runner && curl -O -L https://github.com/actions/runner/releases/download/v2.283.1/actions-runner-linux-x64-2.283.1.tar.gz && tar xzf ./actions-runner-linux-x64-2.283.1.tar.gz';
|
||||||
|
await this.CloudRunnerProviderPlatform.runBuildTask(
|
||||||
|
this.buildGuid,
|
||||||
|
baseImage,
|
||||||
|
[installAndStartRunner],
|
||||||
|
`/${buildVolumeFolder}`,
|
||||||
|
`/${buildVolumeFolder}`,
|
||||||
|
this.defaultGitShaEnvironmentVariable,
|
||||||
|
[...this.defaultSecrets],
|
||||||
|
);
|
||||||
|
}
|
||||||
private static async runCustomJob(buildSteps) {
|
private static async runCustomJob(buildSteps) {
|
||||||
|
CloudRunnerLogger.log(`Cloud Runner is running in custom job mode`);
|
||||||
buildSteps = YAML.parse(buildSteps);
|
buildSteps = YAML.parse(buildSteps);
|
||||||
for (const step of buildSteps) {
|
for (const step of buildSteps) {
|
||||||
const stepSecrets: CloudRunnerSecret[] = step.secrets.map((x) => {
|
const stepSecrets: CloudRunnerSecret[] = step.secrets.map((x) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue