Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runners): add option to prefix registered runners in GitHub #3043

Merged
merged 6 commits into from
Mar 13, 2023

Conversation

npalm
Copy link
Member

@npalm npalm commented Mar 9, 2023

Fixes #3034

Description

This PR add the option to prefix the name registered in GitHub. By default no prefix will be used.

  • The prefix max length is check to ensure the max of 64 chars is not met.
  • For scale down the startWith check is replaced by endWith check to match the instance-id
  • Choose prefix over postfix since it will make more sense with sorting

Now tags

  • EC2 Tag: ghr:runner_name_prefix added
  • EC2 Tag: ghr:created_by added values either scale-up-lambda or pool-lambda

Start scripts

For custom AMI's scripts can be updated to retrieve the AWS EC2 Tag RunnerNamePrefix

runner_name_prefix=$(curl -f -H "X-aws-ec2-metadata-token: $token" -v http://169.254.169.254/latest/meta-data/tags/instance/ghr:runner_name_prefix) || true

Next the $runner_name_prefix can be combined with the instanceId the name. When you would like to add a seperator, add this to the terraform variable runner_name_prefix.

Example of runners based on multi-runner example:
image

Verificaton

Deployed versions main, trigger builds. Next update to branch (rebuild lambda, and ensure runners are active). Next upgrade environment. Checked that old build runners are removed by scale-down, checked new build runners are removed by scale down.

Verififed for:

  • mult-runner example
  • default example

@npalm npalm marked this pull request as draft March 9, 2023 07:48
@npalm npalm marked this pull request as ready for review March 9, 2023 09:15
@npalm npalm marked this pull request as draft March 9, 2023 10:04
@npalm npalm marked this pull request as ready for review March 9, 2023 10:25
update start scripts

fix scripts

refactor names and manage fixed tags via terraform
@npalm npalm merged commit ea4e042 into main Mar 13, 2023
@npalm npalm deleted the feat/runner-name branch March 13, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add prefix to runner name
2 participants