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

DRONE_RUNNER_VOLUMES mount path is ignored #2561

Closed
TankTheFrank opened this Issue Dec 29, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@TankTheFrank
Copy link

TankTheFrank commented Dec 29, 2018

I'm using 1.0.0-rc3 with "DRONE_RUNNER_VOLUMES=/var/cache/drone:/cache,/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt"

Both get mounted but the target path is ignored and gets mounted under the host path, instead of "/cache" it gets mounted under "/var/cache/drone" in the container.

Going on a limb here since the source code for 1.0.0 is not available yet but I'd say that is related to #2549

@bradrydzewski

This comment has been minimized.

Copy link
Member

bradrydzewski commented Dec 29, 2018

the source code for mounting global host volumes is available. the easiest way to trace through the code locally is through the CLI. See https://github.com/drone/drone-cli/blob/master/drone/exec/exec.go#L261:L265

@tboerger

This comment has been minimized.

Copy link
Member

tboerger commented Dec 30, 2018

The length doesn't equal 2?

func toVolumes(items []string) map[string]string {
set := map[string]string{}
for _, item := range items {
parts := strings.Split(item, ":")
if len(parts) != 2 {
key := parts[0]
val := parts[1]
set[key] = val
}
}
return set
}

@bradrydzewski

This comment has been minimized.

Copy link
Member

bradrydzewski commented Jan 3, 2019

there was a regression here. I patched rc.3 so if you re-pull the image you will get the fix.

@tboerger

This comment has been minimized.

Copy link
Member

tboerger commented Jan 3, 2019

And what about the if len(parts) != 2 ? Isn't that wrong?

@bradrydzewski

This comment has been minimized.

Copy link
Member

bradrydzewski commented Jan 4, 2019

@tboerger drone server uses different logic (below) so I think this particular issue can be closed, but you are correct that it looks like there is an issue with the CLI.

func convertVolumes(from []string) map[string]string {
	to := map[string]string{}
	for _, s := range from {
		parts := strings.Split(s, ":")
		if len(parts) != 2 {
			continue
		}
		key := parts[0]
		val := parts[1]
		to[key] = val
	}
	return to
}

I just pushed a shared function here so that we can replace the server and CLI logic, so that they share this common code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment