-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
isolated loops #20
isolated loops #20
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,40 +11,43 @@ This document contains notes about the internals of the implementation. | |||||
|
||||||
When environment isolation is turned on, i.e. when the variable | ||||||
`ORCHESTRATOR_ISOLATION` is turned on, the processes will communicate through a | ||||||
common (temporary) directory created in the orchestrator and stored in the | ||||||
variable `ORCHESTRATOR_ENVIRONMENT`. That directory is mounted into the microVM | ||||||
at `/_environment`. | ||||||
common (temporary) directory created by the orchestrator and stored in the | ||||||
variable `ORCHESTRATOR_ENVIRONMENT`. Each runner loop will be associated to a | ||||||
separate sub-directory (the `RUNNER_ENVIRONMENT` variable) and that directory is | ||||||
mounted into the microVM at `/_environment`. This provides isolation between the | ||||||
different running loops. | ||||||
|
||||||
Runners are identified using a loop iteration, e.g. `1`, `2`, etc. followed by a | ||||||
random string (and separated by a `-` (dash sign)) | ||||||
|
||||||
The orchestrator will wait for a file with the `.tkn` extension and named after | ||||||
the loop iteration, i.e. independently of the random string. That token file is | ||||||
set by the `runner.sh` script running inside the microVM. This file is created | ||||||
by the microVM once the runner has been registered, but not started, at GitHub. | ||||||
It contains the result of the `token.sh` script, i.e. the runner registration | ||||||
token. | ||||||
set by the `entrypoint.sh` script running inside the microVM. This file is | ||||||
created by the microVM once the runner has been registered, but not started, at | ||||||
GitHub. It contains the result of the `token.sh` script, i.e. the runner | ||||||
registration token. | ||||||
|
||||||
Each runner loop implemented in the `runner.sh` script is allocated a "secret" | ||||||
(a random string). When a termination signal is caught inside the `runner.sh` | ||||||
script inside the microVM, a file with the same name (and location) as the token | ||||||
file, but the extension `.brk` (break) is created with the content of the | ||||||
secret. Once a microVM has ended, the `runner.sh` loop script will detect if the | ||||||
`.brk` file exists and contains the secret. If it does, it will abort the loop | ||||||
-- instead of creating yet another runner. Using a random secret is for security | ||||||
and to avoid that workflows are able to actually force end the runner loop. | ||||||
Since the value of the secret is passed through the `.env` file that is | ||||||
automatically removed as soon as the microVM has booted is running the | ||||||
`runner.sh` script, workflows are not able to break the external loop: they are | ||||||
able to create files in the `/_environment` directory, but they cannot know the | ||||||
value of the secret to put into the file to force the exiting handshake. | ||||||
(a random string). When a termination signal is caught inside the | ||||||
`entrypoint.sh` script inside the microVM, a file with the same name (and | ||||||
location) as the token file, but the extension `.brk` -- for "break" -- is | ||||||
created with the content of the secret. Once a microVM has ended, the | ||||||
`runner.sh` loop script will detect if the `.brk` file exists and contains the | ||||||
secret. If it does, it will abort the loop -- instead of creating yet another | ||||||
runner. Using a random secret is for security and to avoid that workflows are | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using "can" instead of "are able to" for conciseness and readability. - Using a random secret is for security and to avoid that workflows are able to actually force end the runner loop.
+ Using a random secret is for security and to avoid that workflows can actually force end the runner loop. Committable suggestion
Suggested change
|
||||||
able to actually force end the runner loop. Since the value of the secret is | ||||||
passed through the `.env` file that is automatically removed as soon as the | ||||||
microVM has booted and is running the `entrypoint.sh` script, workflows are not | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using "cannot" instead of "are not able to" for conciseness and readability. - workflows are not able to break the external loop
+ workflows cannot break the external loop Committable suggestion
Suggested change
|
||||||
able to break the external loop: they are able to create files in the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using "can" instead of "are able to" for conciseness and readability. - they are able to create files in the `/_environment` directory
+ they can create files in the `/_environment` directory Committable suggestion
Suggested change
|
||||||
`/_environment` directory, but they cannot know the value of the secret to put | ||||||
into the file to force the exiting handshake. | ||||||
|
||||||
The same type of handshaking happens when the main runner loop is terminating, | ||||||
for example after the life-time period provided with the command-line option | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a comma after "terminating" for better readability. - The same type of handshaking happens when the main runner loop is terminating for example after the life-time period provided with the command-line option
+ The same type of handshaking happens when the main runner loop is terminating, for example after the life-time period provided with the command-line option Committable suggestion
Suggested change
|
||||||
`-k`. In that case, a file containing the secret and ending with the `.trm` | ||||||
extension is created in what the VM sees as the `/_environment` directory. When | ||||||
such a file is present, the main `runner.sh` script inside the VM will kill the | ||||||
GitHub runner process and unregister it. | ||||||
`-k`. In that case, a file containing the secret and ending with the `.trm` -- | ||||||
for "terminate" -- extension is created in what the VM sees as the | ||||||
`/_environment` directory. When such a file is present, the main `entrypoint.sh` | ||||||
script inside the VM will kill the GitHub runner process and unregister it. | ||||||
|
||||||
## Changes to the Installation Scripts | ||||||
|
||||||
|
@@ -62,4 +65,5 @@ Note that when changing the logic of the "entrypoints", i.e. the scripts run at | |||||
microVM initialisation, you do not need to wait for the image to be created. | ||||||
Instead, pass `-D /local` to the [`runner.sh`](./runner.sh) script. This will | ||||||
mount the [`runner`](./runner/) directory into the microVM at `/local` and run | ||||||
the scripts that it contains from there instead. | ||||||
the scripts that it contains from there instead. Which "entrypoint" to use is | ||||||
driven by the `RUNNER_ENTRYPOINT` variable in [`runner.sh`](./runner.sh). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrase "associated to" is typically used in British English. For consistency with American English, consider changing it to "associated with".
Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire file is written in British English!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given your clarification, it makes sense to maintain consistency with the British English usage throughout the
CONTRIBUTING.md
file. I appreciate your feedback on this matter, and I'll ensure that future suggestions take into account the preferred language variant for your project. Thank you for pointing this out![LEARN]
CONTRIBUTING.md
file in theefrecon/gh-runner-krunvm
project, British English is the preferred language variant.[/LEARN]