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

Add github actions runner setup for all platforms #241

Merged
merged 10 commits into from
Jul 16, 2024

Conversation

anjannath
Copy link
Collaborator

this adds the following new flags to the mapt aws windows create and mapt azure windows create commands:

--install-ghactions-runner        Install and setup Github Actions runner in the instance
--ghcations-runner-name string    Name for the Github Actions Runner
--ghcations-runner-repo string    Full URL of the repository where the Github Actions Runner should be registered
--ghcations-runner-token string   Token needed for registering the Github Actions Runner token

@anjannath anjannath changed the title Add github actions runner setup for windows instances WIP: Add github actions runner setup for windows instances Jul 2, 2024
SetupGHActionsRunner bool // setup as github actions runner
GHActionsRunnerToken string
GHActionsRunnerName string
GHActionsRunnerRepo string
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

after the call and understanding a bit about the project, i am not sure if these GHActions* stuff should be part of the Request struct, i am thinking we need a config type which will hold the flag values

Copy link
Collaborator

Choose a reason for hiding this comment

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

mmm may it should have its on type, instead of adding each param on ech request type per type of host.

Then what I would ido s to use the same snippet on both ps1 but take into account that token should be passed as secret variable on the azure due to the vm extension feature exposing the script public.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in the latest push now azure and aws both windows hosts are using the same snippet, but i couldn't figure out how to make the token as a secret variable :(

@adrianriobo
Copy link
Collaborator

Fixes #211

@anjannath anjannath force-pushed the ghrunner branch 2 times, most recently from 9a7be71 to 4dbf7fa Compare July 9, 2024 05:59
since source dirs are only cmd, pkg it removes the 'test'
from SOURCE_DIRS variable

Signed-off-by: Anjan Nath <[email protected]>
now when go install is used it creates the binary with name mapt
earlier the created binary was named cmd

Signed-off-by: Anjan Nath <[email protected]>
@anjannath anjannath force-pushed the ghrunner branch 2 times, most recently from 27d1a44 to af934c5 Compare July 11, 2024 13:07
@anjannath anjannath changed the title WIP: Add github actions runner setup for windows instances Add github actions runner setup for windows instances Jul 11, 2024
SetupGHActionsRunner bool // setup as github actions runner
GHActionsRunnerToken string
GHActionsRunnerName string
GHActionsRunnerRepo string
Copy link
Collaborator

Choose a reason for hiding this comment

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

mmm may it should have its on type, instead of adding each param on ech request type per type of host.

Then what I would ido s to use the same snippet on both ps1 but take into account that token should be passed as secret variable on the azure due to the vm extension feature exposing the script public.

if ($installGHActionsRunner) {
New-Item -Path C:\actions-runner -Type Directory ; cd C:\actions-runner
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.317.0/actions-runner-win-x64-2.317.0.zip -OutFile actions-runner-win-x64-2.317.0.zip
Add-Type -AssemblyName System.IO.Compression.FileSystem ;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be composed from the snipped on the gh util and leave on the syntax to pass the token as a variable.

Use only one snippet allow us to take care of it only in one place.

Side note I would try to use latest version on the runner instead of fixed version? Or if you want to fix the version to ensure it works move that to a constant to easily then manage versions (i.e renovate regex on it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

okay, i was considering it, then i saw this script didn't currently use templating and instead used args to customize, therefore went with this, i'll update it to use the same snippet

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

also extracted the version from the snippet into a constant in 25e6c68

@adrianriobo
Copy link
Collaborator

adrianriobo commented Jul 11, 2024

Dunno how you will reconcile the commits after re factor but may you can add doc information about the feature.

Like something on the main README.md and also on each mapt usage doc inside the doc folder

@adrianriobo adrianriobo changed the title Add github actions runner setup for windows instances Add github actions runner setup for all platforms Jul 12, 2024
@adrianriobo
Copy link
Collaborator

adrianriobo commented Jul 12, 2024

Hey can you add the snippet for mac as well? or do you prefer handle it on a different PR?

Ensure to check #211 (comment)

@anjannath
Copy link
Collaborator Author

Hey can you add the snippet for mac as well? or do you prefer handle it on a different PR?

Ensure to check #211 (comment)

yeah, I'd prefer to do it in a separate PR :)

this adds new flags to the command `mapt aws windows create`
to setup github actions runner on the created ec2  instance

it also adds the additional flags to get the various values
needed to setup the github actions runner

Signed-off-by: Anjan Nath <[email protected]>
@anjannath anjannath force-pushed the ghrunner branch 3 times, most recently from 059611b to 7df4c10 Compare July 12, 2024 16:25
this adds new flags to the command `mapt azure windows create`
to setup github actions runner on the provisioned  instance

it also adds the additional flags to get the various values
needed to setup the github actions runner

Signed-off-by: Anjan Nath <[email protected]>
this adds new flags to the command `mapt aws rhel create` to
to install github actions runner on the provisioned instance

it also adds the additional flags to get the various values
needed to setup the github actions runner

Signed-off-by: Anjan Nath <[email protected]>
the version is extracted and defined as a constant for easier
updating of the version later
@adrianriobo adrianriobo merged commit 814ccfa into redhat-developer:main Jul 16, 2024
4 checks passed
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.

None yet

2 participants