Skip to content

Commit

Permalink
Support custom runner cli args e.g --disableupdate (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdi-torabi authored Aug 7, 2024
1 parent 656b820 commit b79ab33
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ jobs:
- IAM policy and role setup instructions can be found [here](docs/CrossAccountIAM.md)
- Modify `ec2_spot_instance_strategy` for other deployment strategies. List of all values can be found [here](action.yaml)

**IMPORTANT NOTE**

`An error occured: Runner version vX.YZ is deprecated and cannot receive messages.`

Error message above is usually caused by `--disableupdate` custom configuration argument used with a deprecated Runner version.
Make sure to use a runner that has not been deprecated or omit `github_action_runner_version` to use the latest available version.


```yaml
jobs:
start-runner:
Expand All @@ -152,8 +160,9 @@ jobs:
aws_iam_role_arn: "arn:aws:iam::REDACTED:role/REDACTED"
aws_region: "us-west-2"
github_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
github_action_runner_version: v2.300.2 # Optional (default is latest release)
github_job_start_ttl_seconds: 60 # Optional - (defaults to 0 disabling this feature)
github_action_runner_version: v2.300.2 # Optional (default is latest release)
github_action_runner_extra_cli_args: "--disableupdate" # Extra cli args for runner startup command
github_job_start_ttl_seconds: 60 # Optional - (defaults to 0 disabling this feature)
ec2_instance_type: c5.4xlarge
ec2_ami_id: ami-008fe2fc65df48dac
ec2_root_disk_size_gb: "100" # Optional - (defaults to AMI settings)
Expand Down
3 changes: 3 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ inputs:
github_action_runner_version:
description: 'GitHub action runner version'
required: false
github_action_runner_extra_cli_args:
description: 'GitHub action runner extra cli args'
required: false
# Custom label support still needs more work. For now we default to job ID
#github_action_runner_label:
# description: 'GitHub action runner label'
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ActionConfig {
this.githubRef = github.context.ref;
this.githubRepo = github.context.repo.repo;
this.githubActionRunnerVersion = core.getInput("github_action_runner_version");
this.githubActionRunnerExtraCliArgs = core.getInput("github_action_runner_extra_cli_args");
this.githubActionRunnerLabel = this.githubJobId;
this.githubJobStartTtlSeconds = core.getInput("github_job_start_ttl_seconds");
// Ec2 params
Expand Down Expand Up @@ -791,7 +792,7 @@ class UserData {
"export RUNNER_ALLOW_RUNASROOT=1",
`RUNNER_NAME=${this.config.githubJobId}-$(hostname)-ec2`,
"[ -n \"$(command -v yum)\" ] && yum install libicu -y",
`./config.sh --unattended --ephemeral --url https://github.com/${github.context.repo.owner}/${github.context.repo.repo} --token ${runnerRegistrationToken.token} --labels ${this.config.githubActionRunnerLabel} --name $RUNNER_NAME`,
`./config.sh --unattended --ephemeral --url https://github.com/${github.context.repo.owner}/${github.context.repo.repo} --token ${runnerRegistrationToken.token} --labels ${this.config.githubActionRunnerLabel} --name $RUNNER_NAME ${this.config.githubActionRunnerExtraCliArgs}`,
jobStartIdleTimeoutTask,
"./run.sh",
];
Expand Down
5 changes: 5 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ConfigInterface {
githubRef: string;
githubRepo: string;
githubActionRunnerVersion: string;
githubActionRunnerExtraCliArgs: string;
githubActionRunnerLabel: string;
githubJobStartTtlSeconds: string;

Expand Down Expand Up @@ -42,6 +43,7 @@ export class ActionConfig implements ConfigInterface {
githubRef: string;
githubRepo: string;
githubActionRunnerVersion: string;
githubActionRunnerExtraCliArgs: string;
githubActionRunnerLabel: string;
githubJobStartTtlSeconds: string;

Expand Down Expand Up @@ -73,6 +75,9 @@ export class ActionConfig implements ConfigInterface {
this.githubActionRunnerVersion = core.getInput(
"github_action_runner_version"
);
this.githubActionRunnerExtraCliArgs = core.getInput(
"github_action_runner_extra_cli_args"
);
this.githubActionRunnerLabel = this.githubJobId;
this.githubJobStartTtlSeconds = core.getInput("github_job_start_ttl_seconds");

Expand Down
2 changes: 1 addition & 1 deletion src/ec2/userdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class UserData {
"export RUNNER_ALLOW_RUNASROOT=1",
`RUNNER_NAME=${this.config.githubJobId}-$(hostname)-ec2`,
"[ -n \"$(command -v yum)\" ] && yum install libicu -y",
`./config.sh --unattended --ephemeral --url https://github.com/${github.context.repo.owner}/${github.context.repo.repo} --token ${runnerRegistrationToken.token} --labels ${this.config.githubActionRunnerLabel} --name $RUNNER_NAME`,
`./config.sh --unattended --ephemeral --url https://github.com/${github.context.repo.owner}/${github.context.repo.repo} --token ${runnerRegistrationToken.token} --labels ${this.config.githubActionRunnerLabel} --name $RUNNER_NAME ${this.config.githubActionRunnerExtraCliArgs}`,
jobStartIdleTimeoutTask,
"./run.sh",
];
Expand Down

0 comments on commit b79ab33

Please sign in to comment.