Mount volume for container run in GitHub action
# 🌱|help-and-getting-started
h
I have a GitHub action that check out sources on first step uses: actions/checkout@v3 and then runs garden run container action kind: Run type: container I want to mount the sources to that Run container volumes: - name: my-sources containerPath: /sources/ hostPath: ${local.env.GITHUB_WORKSPACE} But it looks like mounts a host machine dir instead of GitHub action container path as the mounted dir doesn't contain sources. Is it possible to mount sources dir somehow?
o
If this is not the repo you are running garden from I can suggest running git clone as a Build step within garden and then you can reference that build environment from other actions. This is how I do it. In this way it is more portable and not dependent on Github Actions, but you will need to manage the credentials separately if you need them.
h
That's repo I'm running garden from so it would be double work as I already have sources cloned in the GH Action
o
oh so you just want some files in your run job? You should only need to put them in the
include
section of the action spec.
Although I don't use the
container
action myself so might be a little different.
To mount into the pod explicitly you would need a volume on the cluster, the source directory is present on the node you are running from which isn't (logically) on the cluster. This is a very different workflow and way harder.
h
I think for container run
include
is not going to work. I want actually to build java app and container is needed for anyone even without local java set up to be able to build and run app locally in garden. There is also an option to have jar build configured in a multistage dockerfile like in quickstart-example project but this option also has it's own challenges because of some gradle plugins and libs that we use.
o
I guess I'm a little confused at your end goal. I might be able to provide a suggestion if you described what you have as your inputs and your desired results
I do something which I think is similar in my own garden setup
h
Nevermind, I managed to mount a volume. I used garden Build type: exec action to run
docker run -v /host/path/:/sources/ ...
command instead of garden Run type: container action and it worked
3 Views