Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ colored = "3"
gitlab-runner = "0.3.2"
lava-api = "0.2.1"
url = "2"
tokio = "1"
tokio = { version = "1", features = ["full"] }
axum = "0.8"
async-trait = "0.1"
futures = "0.3"
handlebars = "6"
Expand Down
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ inside a shell they're directly executed by the runner itself.
These variables will typically be set as (masked) CI variables, but they could
also be provided directly in the job.

The runner also supports the following environment variables, set on the
runner itself, to enable LAVA jobs to upload artifact files back to it (see
[Runner artifacts](#runner-artifacts)):

* `LAVA_ARTIFACT_UPLOAD_BASE_URL`: The externally reachable base URL of the
runner's upload endpoint (e.g. `https://my-runner-host:8443/artifacts`).
Uploads are disabled unless this is set.
* `LAVA_ARTIFACT_UPLOAD_LISTEN_ADDR` (optional): The local address the
upload server binds to, e.g. `0.0.0.0:8443`. Defaults to `0.0.0.0:0` (a
random port).

## Accessing GitLab CI job variables inside LAVA job definition file

GitLab CI job variables are exposed as fields of a ``job`` template variable
Expand Down Expand Up @@ -107,6 +118,28 @@ incomplete state.
When the gitlab job definition defines artifacts, the log file(s) of the
submitted or monitor jobs will be uploaded as an artifact by the runner.

When `LAVA_ARTIFACT_UPLOAD_BASE_URL` is set (see
[Runner variables usage](#runner-variables-usage)), each submitted LAVA job
also gets its own single-use upload URL, exposed as
`{{ runner.ARTIFACT_UPLOAD_URL }}` inside the LAVA job definition file. A test
running on the DUT (or dispatcher) can `POST` (or `curl -T`) files to this URL
followed by the relative path/filename under which the artifact should be
stored (uploads are capped at 1 GB per job), e.g.:

```
- test:
definition:
- repository:
metadata:
...
run:
steps:
- curl -T my-large-log.txt "{{ runner.ARTIFACT_UPLOAD_URL }}my-large-log.txt"
```

These uploaded files are included alongside the log/JUnit output in the
GitLab job's artifact archive once the LAVA job finishes.

## Example jobs

To submit a job to lava, monitor it and retrieve the raw log as a job artifact
Expand Down
Loading