From 700df615af4c7cabc37fb1e42c4797f2a1299c2e Mon Sep 17 00:00:00 2001 From: Volodymyr Machula Date: Thu, 22 Apr 2021 19:46:55 +0300 Subject: [PATCH] Fix issue with ARM64, refactor info messages (#41) * Fix issue with ARM64, refactor info messages * Update runner version to the latest * Update dist Co-authored-by: GitHub Actions --- dist/index.js | 25 +++++++++++++------------ src/aws.js | 7 ++++--- src/gh.js | 16 ++++++++-------- src/index.js | 2 +- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/dist/index.js b/dist/index.js index a2f4378e..1417fd18 100644 --- a/dist/index.js +++ b/dist/index.js @@ -55094,9 +55094,10 @@ async function startEc2Instance(label, githubRegistrationToken) { '#!/bin/bash', '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.277.1/actions-runner-linux-${RUNNER_ARCH}-2.277.1.tar.gz', - 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.277.1.tar.gz', + 'curl -O -L https://github.com/actions/runner/releases/download/v2.278.0/actions-runner-linux-${RUNNER_ARCH}-2.278.0.tar.gz', + 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.278.0.tar.gz', 'export RUNNER_ALLOW_RUNASROOT=1', + 'export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1', `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, './run.sh', ]; @@ -55153,7 +55154,7 @@ async function waitForInstanceRunning(ec2InstanceId) { core.info(`AWS EC2 instance ${ec2InstanceId} is up and running`); return; } catch (error) { - core.error(`AWS EC2 instance ${ec2InstanceId} init error`); + core.error(`AWS EC2 instance ${ec2InstanceId} initialization error`); throw error; } } @@ -55297,33 +55298,33 @@ async function removeRunner() { } } -async function waitForRunnerCreated(label) { +async function waitForRunnerRegistered(label) { const timeoutMinutes = 5; const retryIntervalSeconds = 10; const quietPeriodSeconds = 30; let waitSeconds = 0; - core.info(`Waiting ${quietPeriodSeconds}s before polling for runner`); + core.info(`Waiting ${quietPeriodSeconds}s for the AWS EC2 instance to be registered in GitHub as a new self-hosted runner`); await new Promise(r => setTimeout(r, quietPeriodSeconds * 1000)); - core.info(`Polling for runner every ${retryIntervalSeconds}s`); + core.info(`Checking every ${retryIntervalSeconds}s if the GitHub self-hosted runner is registered`); return new Promise((resolve, reject) => { const interval = setInterval(async () => { const runner = await getRunner(label); if (waitSeconds > timeoutMinutes * 60) { - core.error('GitHub self-hosted runner creation error'); + core.error('GitHub self-hosted runner registration error'); clearInterval(interval); - reject(`A timeout of ${timeoutMinutes} minutes is exceeded. Please ensure your EC2 instance has access to the Internet.`); + reject(`A timeout of ${timeoutMinutes} minutes is exceeded. Your AWS EC2 instance was not able to register itself in GitHub as a new self-hosted runner.`); } if (runner && runner.status === 'online') { - core.info(`GitHub self-hosted runner ${runner.name} is created and ready to use`); + core.info(`GitHub self-hosted runner ${runner.name} is registered and ready to use`); clearInterval(interval); resolve(); } else { waitSeconds += retryIntervalSeconds; - core.info('Waiting...'); + core.info('Checking...'); } }, retryIntervalSeconds * 1000); }); @@ -55332,7 +55333,7 @@ async function waitForRunnerCreated(label) { module.exports = { getRegistrationToken, removeRunner, - waitForRunnerCreated, + waitForRunnerRegistered, }; @@ -55357,7 +55358,7 @@ async function start() { const ec2InstanceId = await aws.startEc2Instance(label, githubRegistrationToken); setOutput(label, ec2InstanceId); await aws.waitForInstanceRunning(ec2InstanceId); - await gh.waitForRunnerCreated(label); + await gh.waitForRunnerRegistered(label); } async function stop() { diff --git a/src/aws.js b/src/aws.js index e7e9494b..7dc2161c 100644 --- a/src/aws.js +++ b/src/aws.js @@ -11,9 +11,10 @@ async function startEc2Instance(label, githubRegistrationToken) { '#!/bin/bash', '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.277.1/actions-runner-linux-${RUNNER_ARCH}-2.277.1.tar.gz', - 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.277.1.tar.gz', + 'curl -O -L https://github.com/actions/runner/releases/download/v2.278.0/actions-runner-linux-${RUNNER_ARCH}-2.278.0.tar.gz', + 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.278.0.tar.gz', 'export RUNNER_ALLOW_RUNASROOT=1', + 'export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1', `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, './run.sh', ]; @@ -70,7 +71,7 @@ async function waitForInstanceRunning(ec2InstanceId) { core.info(`AWS EC2 instance ${ec2InstanceId} is up and running`); return; } catch (error) { - core.error(`AWS EC2 instance ${ec2InstanceId} init error`); + core.error(`AWS EC2 instance ${ec2InstanceId} initialization error`); throw error; } } diff --git a/src/gh.js b/src/gh.js index 44f3efe4..1105c397 100644 --- a/src/gh.js +++ b/src/gh.js @@ -51,33 +51,33 @@ async function removeRunner() { } } -async function waitForRunnerCreated(label) { +async function waitForRunnerRegistered(label) { const timeoutMinutes = 5; const retryIntervalSeconds = 10; const quietPeriodSeconds = 30; let waitSeconds = 0; - core.info(`Waiting ${quietPeriodSeconds}s before polling for runner`); + core.info(`Waiting ${quietPeriodSeconds}s for the AWS EC2 instance to be registered in GitHub as a new self-hosted runner`); await new Promise(r => setTimeout(r, quietPeriodSeconds * 1000)); - core.info(`Polling for runner every ${retryIntervalSeconds}s`); + core.info(`Checking every ${retryIntervalSeconds}s if the GitHub self-hosted runner is registered`); return new Promise((resolve, reject) => { const interval = setInterval(async () => { const runner = await getRunner(label); if (waitSeconds > timeoutMinutes * 60) { - core.error('GitHub self-hosted runner creation error'); + core.error('GitHub self-hosted runner registration error'); clearInterval(interval); - reject(`A timeout of ${timeoutMinutes} minutes is exceeded. Please ensure your EC2 instance has access to the Internet.`); + reject(`A timeout of ${timeoutMinutes} minutes is exceeded. Your AWS EC2 instance was not able to register itself in GitHub as a new self-hosted runner.`); } if (runner && runner.status === 'online') { - core.info(`GitHub self-hosted runner ${runner.name} is created and ready to use`); + core.info(`GitHub self-hosted runner ${runner.name} is registered and ready to use`); clearInterval(interval); resolve(); } else { waitSeconds += retryIntervalSeconds; - core.info('Waiting...'); + core.info('Checking...'); } }, retryIntervalSeconds * 1000); }); @@ -86,5 +86,5 @@ async function waitForRunnerCreated(label) { module.exports = { getRegistrationToken, removeRunner, - waitForRunnerCreated, + waitForRunnerRegistered, }; diff --git a/src/index.js b/src/index.js index dca68e39..00bc5152 100644 --- a/src/index.js +++ b/src/index.js @@ -14,7 +14,7 @@ async function start() { const ec2InstanceId = await aws.startEc2Instance(label, githubRegistrationToken); setOutput(label, ec2InstanceId); await aws.waitForInstanceRunning(ec2InstanceId); - await gh.waitForRunnerCreated(label); + await gh.waitForRunnerRegistered(label); } async function stop() {