/microvm-action-runner

A service to create ad-hoc action runners on microvms

Primary LanguageGo

microvm-action-runner

This is a POC service for creating on-the-fly self-hosted action runners on flintlock microvms.

Usage

Clone and build the binary:

git clone https://github.io/weaveworks-liquidmetal/microvm-action-runner
cd microvm-action-runner
make build

Start the service:

./microvm-action-runner start \
	--host <flintlock address and port> \
	--token <pat token>

# run --help for more flag options

# more flintlock hosts can be added with additional `host` flags
# eg, --host foo:9090 --host bar:9090
#     or --hosts foo:9090,bar:9090

Setup

  1. Start a flintlockd service. Note the address and port.

  2. Create a Github PAT token with repo scope.

  3. Start the service.

  4. Expose the service.

  5. Navigate to the repo/org/ent where you want to use these runners.

  6. Go to Settings then Webhooks.

  7. Select Add webhook.

  8. Fill in the Payload URL with your https url plus /webhook. eg: https://my-service.org/webhook.

  9. Change the Content type to be application/json.

  10. If you wish to set a plaintext secret, set that in the Secret field. Remember to restart the service with the --secret flag.

  11. For the question Which events would you like to trigger this webhook?, select Let me select individual events., then from the expanded options deselect Pushes, and select Workflow jobs.

  12. Click Add webhook.

Your service should now be ready to receive webhook requests from workflow jobs in that repo/org/ent.

Contributing / Local Development

  1. Fork the repo.

  2. Clone your fork.

  3. Run make test.

  4. Make your changes, ensuring there are new tests and everything passes.

  5. Manually test using ngrok (below). (Integration/acceptance tests are coming, for now we must manually verify).

  6. Open a PR.

Local testing

To check out the service without going to the effort of exposing the service properly, you can use ngrok. You can get a free plan as an individual.

After you have started your microvm-action-runner service, use ngrok to expose it:

ngrok http localhost:3000

Use the https endpoint generated by ngrok for your Payload URL when setting up the webhook.