Skip to content

Commit

Permalink
Document mirrord usage for local testing (#17)
Browse files Browse the repository at this point in the history
* Document mirrord usage for local testing

Co-authored-by: Arthur Shvarts <[email protected]>

---------

Co-authored-by: Arthur Shvarts <[email protected]>
  • Loading branch information
Oded-B and ashvarts authored Jul 5, 2024
1 parent e2b552d commit 82d4fc2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,34 @@ See [here](docs/observability.md)

## Development

### Local Testing

Telefonistka have 3 major methods to interact with the world:

* Receive event webhooks from GitHub
* Send API calls to GitHub REST and GraphQL APIs(requires network access and credentials)
* Send API calls to ArgoCD API(requires network access and credentials)

Supporting all those requirements in a local environment might require lots of setup.
Assuming you have a working lab environment, the easiest way to locally test Telefonistka might be with tools like [mirrord](https://mirrord.dev/) or [telepresence](https://www.telepresence.io/)

A [mirrord.json](mirrord.json) is supplied as reference.

This is how I compile and trigger mirrord execution

```sh
go build . && mirrord exec -f mirrord.json ./telefonistka server
```

Alternatively, you can use `ngrok` or similar services to route webhook to a local instance, but you still need to provide credentials to all outbound API calls.

* use Ngrok ( `ngrok http 8080` ) to expose the local instance
* See the URLs in ngrok command output.
* Add a webhook to repo setting (don't forget the `/webhook` path in the URL).
* Content type needs to be `application/json`, **currently** only PR events are needed

### Building Container Image From Forks

To publish container images from a forked repo set the `IMAGE_NAME` and `REGISTRY` GitHub Action Repository variables to use GitHub packages.
`REGISTRY` should be `ghcr.io` and `IMAGE_NAME` should match the repository slug, like so:
like so:
Expand Down
21 changes: 21 additions & 0 deletions mirrord.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"target": {
"path": "deployment/telefonistka",
"namespace": "telefonistka"
},
"agent": {
"namespace": "mirrord"
},
"feature": {
"fs": {
"mode": "read",
"read_write": ".+\\.json" ,
"read_only": [ "^/etc/telefonistka-gh-app-creds/.*" ]
}
},
"operator": false,
"kubeconfig": "~/.kube/config",
"sip_binaries": "bash",
"telemetry": true
}

0 comments on commit 82d4fc2

Please sign in to comment.