Skip to content

Commit

Permalink
update readme with testing instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
lucabello committed Dec 5, 2024
1 parent 88ffa72 commit 297993c
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,46 @@ This repository holds all the necessary files to build rocks for the upstream ve

The rocks on this repository are built with [OCI Factory](https://github.com/canonical/oci-factory/), which also takes care of periodically rebuilding the images.

New versions of the rock are tested using [`goss`](https://github.com/goss-org/goss) (for the actual validation) and [`noctua`](https://github.com/lucabello/noctua) (to run the actual command).
New versions of the rock are tested using [`goss`](https://github.com/goss-org/goss) and `kgoss`. To test manually, look at the [testing](#testing) section.

Automation takes care of:
* validating PRs, by simply trying to build the rock;
* pulling upstream releases, creating a PR with the necessary files to be manually reviewed;
* on PRs, validate the added (or modified) rocks by running them in a Kubernetes pod and testing them with `goss`;
* releasing to GHCR at [ghcr.io/canonical/mimir:dev](https://ghcr.io/canonical/mimir:dev), when merging to main, for development purposes.


## Testing

**Requirements**: `kubectl` (classic), `microk8s`, `rockcraft`.
Make sure that you've run `microk8s enable registry`.

Pack the rock and push it to the local registry:

```bash
# Pack the rock and push it to the local registry (replace the <variables>)
rockcraft pack
rockcraft.skopeo --insecure-policy copy --dest-tls-verify=false \
oci-archive:<rock_file> \
docker://localhost:32000/<rock_name>:<version>
```

### Testing with `kgoss`

**Extra Requirements**: `goss`, `kgoss`.

`kgoss` will run the rock in a temporary pod, copy the `goss` binary and checks to the container, and run them from the inside.

```bash
# Set GOSS_FILES_PATH to the `goss.yaml` folder (default: '.')
kgoss run -i localhost:32000/<rock_name>:<version>
```

### Testing manually

For manual exploration, you can run the rock in a pod with only `kubectl`:

```bash
kubectl run <pod_name> --image=localhost:32000/<rock_name>:<version>
kubectl exec <pod_name> -it -- /bin/bash
```

0 comments on commit 297993c

Please sign in to comment.