From df22e7b2a895722047f1d5b2c4d08cd52b4f817f Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Tue, 7 Feb 2023 08:53:44 +1300 Subject: [PATCH 01/12] Build runner from base AMI --- src/aws.js | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/aws.js b/src/aws.js index c6bd8c9d..944d0f90 100644 --- a/src/aws.js +++ b/src/aws.js @@ -3,7 +3,7 @@ const core = require('@actions/core'); const config = require('./config'); // User data scripts are run as the root user -function buildUserDataScript(githubRegistrationToken, label) { +function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2.301.1") { if (config.input.runnerHomeDir) { // If runner home directory is specified, we expect the actions-runner software (and dependencies) // to be pre-installed in the AMI, so we simply cd into that directory and then start the runner @@ -17,10 +17,11 @@ function buildUserDataScript(githubRegistrationToken, label) { } else { return [ '#!/bin/bash', + 'yum update && yum install -y docker git && systemctl enable docker', 'mkdir actions-runner && cd actions-runner', 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', - 'curl -O -L https://github.com/actions/runner/releases/download/v2.299.1/actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz', - 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz', + `curl -O -L https://github.com/actions/runner/releases/download/v${runnerVersion}/actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, + `tar xzf ./actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, 'export RUNNER_ALLOW_RUNASROOT=1', `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, './run.sh', @@ -28,25 +29,29 @@ function buildUserDataScript(githubRegistrationToken, label) { } } +async function getLatestAmazonLinuxAmi() { + const ssm = new AWS.SSM(); + const result = await ssm.getParameter({ Name: "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2" }).promise() + return result.Parameter.Value +} + async function startEc2Instance(label, githubRegistrationToken) { const ec2 = new AWS.EC2(); const userData = buildUserDataScript(githubRegistrationToken, label); - const params = { - ImageId: config.input.ec2ImageId, - InstanceType: config.input.ec2InstanceType, - MinCount: 1, - MaxCount: 1, - UserData: Buffer.from(userData.join('\n')).toString('base64'), - SubnetId: config.input.subnetId, - SecurityGroupIds: [config.input.securityGroupId], - IamInstanceProfile: { Name: config.input.iamRoleName }, - TagSpecifications: config.tagSpecifications, - }; - try { - const result = await ec2.runInstances(params).promise(); + const result = await ec2.runInstances({ + ImageId: await getLatestAmazonLinuxAmi(), + InstanceType: config.input.ec2InstanceType, + MinCount: 1, + MaxCount: 1, + UserData: Buffer.from(userData.join('\n')).toString('base64'), + SubnetId: config.input.subnetId, + SecurityGroupIds: [config.input.securityGroupId], + IamInstanceProfile: { Name: config.input.iamRoleName }, + TagSpecifications: config.tagSpecifications, + }).promise(); const ec2InstanceId = result.Instances[0].InstanceId; core.info(`AWS EC2 instance ${ec2InstanceId} is started`); return ec2InstanceId; From 14d5559eda100d86b099109a0092905bd9b10729 Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 10:21:33 +1300 Subject: [PATCH 02/12] Mark runners as ephemeral --- src/aws.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aws.js b/src/aws.js index 944d0f90..e3d01948 100644 --- a/src/aws.js +++ b/src/aws.js @@ -11,7 +11,7 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. '#!/bin/bash', `cd "${config.input.runnerHomeDir}"`, 'export RUNNER_ALLOW_RUNASROOT=1', - `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, + `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label} --ephemeral`, './run.sh', ]; } else { @@ -23,7 +23,7 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. `curl -O -L https://github.com/actions/runner/releases/download/v${runnerVersion}/actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, `tar xzf ./actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, 'export RUNNER_ALLOW_RUNASROOT=1', - `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, + `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label} --ephemeral`, './run.sh', ]; } From 8ca8f212e0172006546c9ff31dce5f6cce55d584 Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 14:36:31 +1300 Subject: [PATCH 03/12] Add some debug --- dist/index.js | 44 ++++++++++++++++++++++++++------------------ src/gh.js | 3 +++ 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/dist/index.js b/dist/index.js index c213fdae..ab6fc8ea 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62803,7 +62803,7 @@ const core = __webpack_require__(42186); const config = __webpack_require__(34570); // User data scripts are run as the root user -function buildUserDataScript(githubRegistrationToken, label) { +function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2.301.1") { if (config.input.runnerHomeDir) { // If runner home directory is specified, we expect the actions-runner software (and dependencies) // to be pre-installed in the AMI, so we simply cd into that directory and then start the runner @@ -62811,42 +62811,47 @@ function buildUserDataScript(githubRegistrationToken, label) { '#!/bin/bash', `cd "${config.input.runnerHomeDir}"`, 'export RUNNER_ALLOW_RUNASROOT=1', - `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, + `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label} --ephemeral`, './run.sh', ]; } else { return [ '#!/bin/bash', + 'yum update && yum install -y docker git && systemctl enable docker', 'mkdir actions-runner && cd actions-runner', 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', - 'curl -O -L https://github.com/actions/runner/releases/download/v2.299.1/actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz', - 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz', + `curl -O -L https://github.com/actions/runner/releases/download/v${runnerVersion}/actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, + `tar xzf ./actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, 'export RUNNER_ALLOW_RUNASROOT=1', - `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, + `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label} --ephemeral`, './run.sh', ]; } } +async function getLatestAmazonLinuxAmi() { + const ssm = new AWS.SSM(); + const result = await ssm.getParameter({ Name: "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2" }).promise() + return result.Parameter.Value +} + async function startEc2Instance(label, githubRegistrationToken) { const ec2 = new AWS.EC2(); const userData = buildUserDataScript(githubRegistrationToken, label); - const params = { - ImageId: config.input.ec2ImageId, - InstanceType: config.input.ec2InstanceType, - MinCount: 1, - MaxCount: 1, - UserData: Buffer.from(userData.join('\n')).toString('base64'), - SubnetId: config.input.subnetId, - SecurityGroupIds: [config.input.securityGroupId], - IamInstanceProfile: { Name: config.input.iamRoleName }, - TagSpecifications: config.tagSpecifications, - }; - try { - const result = await ec2.runInstances(params).promise(); + const result = await ec2.runInstances({ + ImageId: await getLatestAmazonLinuxAmi(), + InstanceType: config.input.ec2InstanceType, + MinCount: 1, + MaxCount: 1, + UserData: Buffer.from(userData.join('\n')).toString('base64'), + SubnetId: config.input.subnetId, + SecurityGroupIds: [config.input.securityGroupId], + IamInstanceProfile: { Name: config.input.iamRoleName }, + TagSpecifications: config.tagSpecifications, + }).promise(); const ec2InstanceId = result.Instances[0].InstanceId; core.info(`AWS EC2 instance ${ec2InstanceId} is started`); return ec2InstanceId; @@ -62985,6 +62990,7 @@ const config = __webpack_require__(34570); // use the unique label to find the runner // as we don't have the runner's id, it's not possible to get it in any other way async function getRunner(label) { + core.debug("Github Token part " + config.input.githubToken.substring(0, 10)); const octokit = github.getOctokit(config.input.githubToken); try { @@ -63001,6 +63007,8 @@ async function getRegistrationToken() { const octokit = github.getOctokit(config.input.githubToken); try { + core.debug("Gitub context"); + core.debug(config.githubContext); const response = await octokit.request('POST /repos/{owner}/{repo}/actions/runners/registration-token', config.githubContext); core.info('GitHub Registration Token is received'); return response.data.token; diff --git a/src/gh.js b/src/gh.js index abf9af94..d23a323c 100644 --- a/src/gh.js +++ b/src/gh.js @@ -6,6 +6,7 @@ const config = require('./config'); // use the unique label to find the runner // as we don't have the runner's id, it's not possible to get it in any other way async function getRunner(label) { + core.debug("Github Token part " + config.input.githubToken.substring(0, 10)); const octokit = github.getOctokit(config.input.githubToken); try { @@ -22,6 +23,8 @@ async function getRegistrationToken() { const octokit = github.getOctokit(config.input.githubToken); try { + core.debug("Gitub context"); + core.debug(config.githubContext); const response = await octokit.request('POST /repos/{owner}/{repo}/actions/runners/registration-token', config.githubContext); core.info('GitHub Registration Token is received'); return response.data.token; From cf9b18f28a66bc65e9fdefe4efe54e6930b65fbf Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 14:41:09 +1300 Subject: [PATCH 04/12] moredebug --- src/gh.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gh.js b/src/gh.js index d23a323c..1969dc6b 100644 --- a/src/gh.js +++ b/src/gh.js @@ -20,10 +20,11 @@ async function getRunner(label) { // get GitHub Registration Token for registering a self-hosted runner async function getRegistrationToken() { + core.debug("Github Token part " + config.input.githubToken.substring(0, 10)); const octokit = github.getOctokit(config.input.githubToken); try { - core.debug("Gitub context"); + core.debug("Github context"); core.debug(config.githubContext); const response = await octokit.request('POST /repos/{owner}/{repo}/actions/runners/registration-token', config.githubContext); core.info('GitHub Registration Token is received'); From 3fc7a981e8b0c6ade4558422c440c3d819060751 Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 14:45:27 +1300 Subject: [PATCH 05/12] package --- dist/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index ab6fc8ea..97c84723 100644 --- a/dist/index.js +++ b/dist/index.js @@ -63004,10 +63004,11 @@ async function getRunner(label) { // get GitHub Registration Token for registering a self-hosted runner async function getRegistrationToken() { + core.debug("Github Token part " + config.input.githubToken.substring(0, 10)); const octokit = github.getOctokit(config.input.githubToken); try { - core.debug("Gitub context"); + core.debug("Github context"); core.debug(config.githubContext); const response = await octokit.request('POST /repos/{owner}/{repo}/actions/runners/registration-token', config.githubContext); core.info('GitHub Registration Token is received'); From bf45531550a7cd65bbdffd5da54a94429e03426e Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 14:54:53 +1300 Subject: [PATCH 06/12] Octokit logging --- dist/index.js | 3 ++- src/gh.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 97c84723..c03be020 100644 --- a/dist/index.js +++ b/dist/index.js @@ -63005,7 +63005,7 @@ async function getRunner(label) { // get GitHub Registration Token for registering a self-hosted runner async function getRegistrationToken() { core.debug("Github Token part " + config.input.githubToken.substring(0, 10)); - const octokit = github.getOctokit(config.input.githubToken); + const octokit = github.getOctokit(config.input.githubToken, { log: core }); try { core.debug("Github context"); @@ -63015,6 +63015,7 @@ async function getRegistrationToken() { return response.data.token; } catch (error) { core.error('GitHub Registration Token receiving error'); + core.error(error); throw error; } } diff --git a/src/gh.js b/src/gh.js index 1969dc6b..f14f0b48 100644 --- a/src/gh.js +++ b/src/gh.js @@ -21,7 +21,7 @@ async function getRunner(label) { // get GitHub Registration Token for registering a self-hosted runner async function getRegistrationToken() { core.debug("Github Token part " + config.input.githubToken.substring(0, 10)); - const octokit = github.getOctokit(config.input.githubToken); + const octokit = github.getOctokit(config.input.githubToken, { log: core }); try { core.debug("Github context"); @@ -31,6 +31,7 @@ async function getRegistrationToken() { return response.data.token; } catch (error) { core.error('GitHub Registration Token receiving error'); + core.error(error); throw error; } } From 89e53dcb5650c27970157ea99c898b99bce60544 Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 15:08:40 +1300 Subject: [PATCH 07/12] Fix versioning --- dist/index.js | 5 +++-- src/aws.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index c03be020..f1f3a2c7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62820,8 +62820,9 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. 'yum update && yum install -y docker git && systemctl enable docker', 'mkdir actions-runner && cd actions-runner', 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', - `curl -O -L https://github.com/actions/runner/releases/download/v${runnerVersion}/actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, - `tar xzf ./actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, + `RUNNER_VERSION=${runnerVersion}`, + "curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz", + "tar xzf ./actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz", 'export RUNNER_ALLOW_RUNASROOT=1', `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label} --ephemeral`, './run.sh', diff --git a/src/aws.js b/src/aws.js index e3d01948..6400ccb2 100644 --- a/src/aws.js +++ b/src/aws.js @@ -20,8 +20,9 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. 'yum update && yum install -y docker git && systemctl enable docker', 'mkdir actions-runner && cd actions-runner', 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', - `curl -O -L https://github.com/actions/runner/releases/download/v${runnerVersion}/actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, - `tar xzf ./actions-runner-linux-${RUNNER_ARCH}-${runnerVersion}.tar.gz`, + `RUNNER_VERSION=${runnerVersion}`, + "curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz", + "tar xzf ./actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz", 'export RUNNER_ALLOW_RUNASROOT=1', `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label} --ephemeral`, './run.sh', From 21e721c8611b3bcf3dcd981516a1c9fb72d21b6f Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 16:05:23 +1300 Subject: [PATCH 08/12] Better dependency installc --- dist/index.js | 4 +++- src/aws.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index f1f3a2c7..41634dc9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62817,7 +62817,9 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. } else { return [ '#!/bin/bash', - 'yum update && yum install -y docker git && systemctl enable docker', + 'yum update -y', + 'yum install -y docker git', + 'systemctl enable docker', 'mkdir actions-runner && cd actions-runner', 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', `RUNNER_VERSION=${runnerVersion}`, diff --git a/src/aws.js b/src/aws.js index 6400ccb2..139641aa 100644 --- a/src/aws.js +++ b/src/aws.js @@ -17,7 +17,9 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. } else { return [ '#!/bin/bash', - 'yum update && yum install -y docker git && systemctl enable docker', + 'yum update -y', + 'yum install -y docker git', + 'systemctl enable docker', 'mkdir actions-runner && cd actions-runner', 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', `RUNNER_VERSION=${runnerVersion}`, From e58605e12e0b4d03dd48f95b1b071277683343bd Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 16:16:33 +1300 Subject: [PATCH 09/12] start docker --- dist/index.js | 1 + src/aws.js | 1 + 2 files changed, 2 insertions(+) diff --git a/dist/index.js b/dist/index.js index 41634dc9..c64d4af4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62820,6 +62820,7 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. 'yum update -y', 'yum install -y docker git', 'systemctl enable docker', + 'systemctl start docker', 'mkdir actions-runner && cd actions-runner', 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', `RUNNER_VERSION=${runnerVersion}`, diff --git a/src/aws.js b/src/aws.js index 139641aa..c345c8bf 100644 --- a/src/aws.js +++ b/src/aws.js @@ -20,6 +20,7 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. 'yum update -y', 'yum install -y docker git', 'systemctl enable docker', + 'systemctl start docker', 'mkdir actions-runner && cd actions-runner', 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', `RUNNER_VERSION=${runnerVersion}`, From 69b1d63e8938ec1d322ddc0579166f0f720a2293 Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 16:31:53 +1300 Subject: [PATCH 10/12] Install htop --- dist/index.js | 2 +- src/aws.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index c64d4af4..991c123c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62818,7 +62818,7 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. return [ '#!/bin/bash', 'yum update -y', - 'yum install -y docker git', + 'yum install -y docker git htop', 'systemctl enable docker', 'systemctl start docker', 'mkdir actions-runner && cd actions-runner', diff --git a/src/aws.js b/src/aws.js index c345c8bf..7e918545 100644 --- a/src/aws.js +++ b/src/aws.js @@ -18,7 +18,7 @@ function buildUserDataScript(githubRegistrationToken, label, runnerVersion = "2. return [ '#!/bin/bash', 'yum update -y', - 'yum install -y docker git', + 'yum install -y docker git htop', 'systemctl enable docker', 'systemctl start docker', 'mkdir actions-runner && cd actions-runner', From 5116df255a45e0ba9a985e1b96973bf215e900bc Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 8 Feb 2023 16:37:08 +1300 Subject: [PATCH 11/12] More storage --- dist/index.js | 1 + src/aws.js | 1 + 2 files changed, 2 insertions(+) diff --git a/dist/index.js b/dist/index.js index 991c123c..b5fb1d8c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62853,6 +62853,7 @@ async function startEc2Instance(label, githubRegistrationToken) { UserData: Buffer.from(userData.join('\n')).toString('base64'), SubnetId: config.input.subnetId, SecurityGroupIds: [config.input.securityGroupId], + BlockDeviceMappings: [ { DeviceName: "/dev/xvda", Ebs: {Encrypted: true, DeleteOnTermination: true, VolumeSize: 20, VolumeType: "gp3" }} ], IamInstanceProfile: { Name: config.input.iamRoleName }, TagSpecifications: config.tagSpecifications, }).promise(); diff --git a/src/aws.js b/src/aws.js index 7e918545..6b37a964 100644 --- a/src/aws.js +++ b/src/aws.js @@ -53,6 +53,7 @@ async function startEc2Instance(label, githubRegistrationToken) { UserData: Buffer.from(userData.join('\n')).toString('base64'), SubnetId: config.input.subnetId, SecurityGroupIds: [config.input.securityGroupId], + BlockDeviceMappings: [ { DeviceName: "/dev/xvda", Ebs: {Encrypted: true, DeleteOnTermination: true, VolumeSize: 20, VolumeType: "gp3" }} ], IamInstanceProfile: { Name: config.input.iamRoleName }, TagSpecifications: config.tagSpecifications, }).promise(); From 51d3080b8d68bc40aa26e23297c701a58eef1bc1 Mon Sep 17 00:00:00 2001 From: Robin Stark Date: Wed, 15 Feb 2023 16:08:04 +1300 Subject: [PATCH 12/12] More responsive instance state checking --- dist/index.js | 4 ++-- src/gh.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index b5fb1d8c..b3280bf5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -63047,8 +63047,8 @@ async function removeRunner() { async function waitForRunnerRegistered(label) { const timeoutMinutes = 5; - const retryIntervalSeconds = 10; - const quietPeriodSeconds = 30; + const retryIntervalSeconds = 5; + const quietPeriodSeconds = 10; let waitSeconds = 0; core.info(`Waiting ${quietPeriodSeconds}s for the AWS EC2 instance to be registered in GitHub as a new self-hosted runner`); diff --git a/src/gh.js b/src/gh.js index f14f0b48..c2cef857 100644 --- a/src/gh.js +++ b/src/gh.js @@ -58,8 +58,8 @@ async function removeRunner() { async function waitForRunnerRegistered(label) { const timeoutMinutes = 5; - const retryIntervalSeconds = 10; - const quietPeriodSeconds = 30; + const retryIntervalSeconds = 5; + const quietPeriodSeconds = 10; let waitSeconds = 0; core.info(`Waiting ${quietPeriodSeconds}s for the AWS EC2 instance to be registered in GitHub as a new self-hosted runner`);