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: Add GitHub timeout #22

Merged
merged 8 commits into from
Aug 5, 2024

Conversation

ethanholz
Copy link
Contributor

The purpose of this PR is to add the required changes to enable a configurable timeout on waiting for the runner to become registered with GitHub.

The purpose of this commit is to add the required changes to enable a
configurable timeout on waiting for the runner to become registered with
GitHub.
@ethanholz
Copy link
Contributor Author

This is still work in progress will need to update the README to reflect these changes.

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.70%. Comparing base (065a4a8) to head (2e83946).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
+ Coverage   94.64%   94.70%   +0.05%     
==========================================
  Files           3        3              
  Lines         299      302       +3     
==========================================
+ Hits          283      286       +3     
  Misses         16       16              
Flag Coverage Δ
unittests 94.70% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ethanholz
Copy link
Contributor Author

Related to #20

@ethanholz ethanholz marked this pull request as ready for review August 5, 2024 14:12
This should allow for a bit of a longer wait and should cover most edge
cases.
Copy link
Contributor

@dwhswenson dwhswenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor request to clarify the documentation, and please correct some inconsistencies in the default value (I'm guessing you changed the default a couple times). Otherwise looks good!


timeout : int
The maximum time in seconds to wait for the runner to be online.
Defaults to 300 seconds.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fa9c585

Comment on lines 150 to 151
# Set the default timeout to 10 minutes
gh_timeout = 1200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment seems inconsistent with number (assuming this is seconds)

# Set the default timeout to 10 minutes
gh_timeout = 1200
# If the user has set the timeout, we will use that instead
if gh_timeout_var is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking on the logic here: does this show up as None (not in the environ dict) or does it show up as an empty string (in the environ dict, but not set to a meaningful value)?

If it is actually None, wouldn't the following be an easier way to extract or get default?

gh_timeout = int(os.environ.get("INPUT_GH_TIMEOUT", 1200))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set in 8a43683

README.md Outdated
@@ -38,6 +38,7 @@ For more information see the [self-hosted runner security docs](https://docs.git
| aws_tags | The AWS tags to use for your runner, formatted as a JSON list. See `README` for more details. | false | |
| extra_gh_labels | Any extra GitHub labels to tag your runners with. Passed as a comma-separated list with no spaces. | false | |
| instance_count | The number of instances to create, defaults to 1 | false | 1 |
| gh_timeout | The amount of timeout for waiting for a runner to be online by GitHub. | false | 1200 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe some clarification here that this is "seen online by GitHub after cloud providers says it has launched"? Not sure the best way to phrase that, but I'm not sure that the current phrasing would be perfectly clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in: abf7339

action.yml Outdated
@@ -47,6 +47,9 @@ inputs:
repo:
description: "The repo to run against. Will use the the current repo if not specified."
required: false
gh_timeout:
description: 'The amount of timeout for waiting for a runner to be online by GitHub.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as with the other point on similar text; maybe some more clarification

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed here: abf7339

This is removed because the default _is not_ set by this function but
instead set by the application itself.
@ethanholz
Copy link
Contributor Author

This seems to resolve the changes requested, let me know if there is anything else I can change!

Copy link
Contributor

@dwhswenson dwhswenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Merging.

@dwhswenson dwhswenson merged commit 9429469 into omsf-eco-infra:main Aug 5, 2024
5 checks passed
@ethanholz ethanholz deleted the feat/add-github-timeout branch August 6, 2024 22:02
@ethanholz ethanholz restored the feat/add-github-timeout branch August 6, 2024 22:02
@ethanholz ethanholz deleted the feat/add-github-timeout branch August 6, 2024 22:02
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 a configurable timeout to wait for the runner to be registered on GitHub
2 participants