Skip to content

Conversation

chickenandpork
Copy link
Contributor

This PR allows the gitlab-runner to map Persistent Volume Claims to the runner's build container by leveraging runners.kubernetes.volumes.pvc blocks.

For example, I wanted a cache for a locally-running "Allure" test utility; I created a PVC, and configured it to mount as:

  ...
  resource "kubernetes_persistent_volume" "allure_results" {
    metadata {
      name = "allure-results"
    }
    ...
  }

  ...

  build_job_pvcs = {
    "/var/run/allure" = { name = "${kubernetes_persistent_volume.allure_results.metadata.0.name}" }
  }
  ...

This of course creates the config.toml section as follows:

  [[runners.kubernetes.volumes.pvc]]
    name = "allure-results-0"
    mount_path = "/var/run/allure"

Of course this is https://docs.gitlab.com/runner/executors/kubernetes.html#pvc-volumes in the docs and I haven't needed to flesh out read_only nor sub_path but extending it shouldn't be too difficult.

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.

1 participant