Set EnvVar for git submodule mirrors to support volume mounting git mirrors in plugins
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 378
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 74
Description
**Is your feature request related to a problem? Please describe.**
We have a project that uses a git submodule for some external data, and runs its CI steps using the `docker-buildkite-plugin`. We're using the latest `buildkite-agent` so git-mirrors are enabled everywhere.
The agent provides the `BUILDKITE_REPO_MIRROR` env var so that the plugins can volume mount the mirror directory into the containers, but there is no variable provided for any submodules, resulting in errors attempting to do git operations on the submodule inside the CI container.
**Describe the solution you'd like**
The default checkout phase should set environment variable(s) for all git submodule mirrors used for the checkout so that plugin authors can add mirror volume mounts. I imagine it'd need to look something like `BUILDKITE_REPO_SUBMODULE_MIRROR_` with x being an integer, similar to how the other plugin variables work for arrays.
**Describe alternatives you've considered**
If I could disable git-mirrors just for this pipeline I would, since this repo is relatively small (please let me know if I missed an env var that'd do that for me). That'd be a fine solution for us, but having the mirrors mount properly would be preferable long term.
Our current workaround is to hardcode a volume mount for the submodule mirror in our docker plugin config.
**Additional context**
The operations that are failing in our containers are `go build`s (with buildvcs enabled, buildvcs=false works around the issue for the build steps) and a golang linter that needs to run `go list all` which apparently needs the submodule's git dir.
Contributor guide
Research direction
Start at the agent's default checkout phase and trace how BUILDKITE_REPO_MIRROR is exported for git mirrors. Determine how submodule mirrors are discovered and represented, then add environment variables that let the docker-buildkite-plugin mount each mirror. Done means checkout exposes all required submodule mirror paths and the container can run git-dependent Go commands against them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, git, go
- Domain
- ci-cd, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100