Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map Persistent Volume Claims as mounted volumes in the build container #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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