Skip to content

Using relative paths in stacks makes envs stop working #12370

@thezoomlesss

Description

@thezoomlesss

Before you start please confirm the following.

Problem Description

I have two stacks, identical in every way, except the fact that one has the uses relative paths.
The one with the paths is not able to load the ENV set in the UI.
They use the same docker-compose file, everything is the same, except the relative paths.

Expected Behavior

For the ENV vars to show

Actual Behavior

The ENV vars are not set

Steps to Reproduce

  1. Create a stack from a git repo
  2. Ensure the docker-compose.yml contains the stack.env defined
  3. Ensure the file exists in the repo
  4. Create ENV vars from the UI
  5. turn on relative paths
  6. Deploy

Portainer logs or screenshots

image
image

The logs show the env vars in there

2024/11/09 08:46PM INF github.com/portainer/portainer-ee/api/stacks/deployments/deployer_remote.go:261 > Stack deployment output | output="{\"level\":\"info\",\"repository\":\"https://github.com/thezoomlesss/HomeCloud\",\"composePath\":[\"docker-compose-prod.yml\"],\"destination\":\"/portainer-compose-unpacker\",\"env\":[\"VITE_APP_RESTAPI_URL=http://rpi4.local:9915\",\"FOO=BAR\",\"Test=ER\"],\"skipTLSVerify\":false,\"time\":1731185171,\"caller\":\"/home/runner/work/release/release/deploy.go:31\",\"message\":\"Deploying Compose stack from Git repository\"}\n{\"level\":\"info\",\"user\":\"thezoomlesss\",\"time\":1731185171,\"caller\":\"/home/runner/work/release/release/deploy.go:41\",\"message\":\"Using Git authentication\"}\n{\"level\":\"info\",\"directory\":\"/portainer-compose-unpacker\",\"time\":1731185171,\"caller\":\"/home/runner/work/release/release/deploy.go:56\",\"message\":\"Checking the file system...\"}\n{\"level\":\"info\",\"directory\":\"/portainer-compose-unpacker/stacks/homecloud-relative-path\",\"time\":1731185171,\"caller\":\"/home/runner/work/release/release/deploy.go:82\",\"message\":\"Creating target destination directory on disk\"}\n{\"level\":\"info\",\"repository\":\"https://github.com/thezoomlesss/HomeCloud\",\"path\":\"/portainer-compose-unpacker/stacks/homecloud-relative-path/HomeCloud\",\"url\":\"https://github.com/thezoomlesss/HomeCloud\",\"depth\":1,\"time\":1731185171,\"caller\":\"/home/runner/work/release/release/deploy.go:97\",\"message\":\"Cloning git repository\"}\n{\"level\":\"info\",\"composeFilePaths\":[\"/portainer-compose-unpacker/stacks/homecloud-relative-path/HomeCloud/docker-compose-prod.yml\"],\"workingDirectory\":\"/portainer-compose-unpacker/stacks/homecloud-relative-path/HomeCloud\",\"projectName\":\"homecloud-relative-path\",\"time\":1731185172,\"caller\":\"/home/runner/work/release/release/deploy.go:125\",\"message\":\"Deploying Compose stack\"}\n{\"level\":\"info\",\"time\":1731185179,\"caller\":\"/home/runner/go/pkg/mod/github.com/portainer/portainer/pkg/[email protected]/compose/internal/composeplugin/composeplugin.go:48\",\"message\":\"Stack deployment successful\"}\n{\"level\":\"info\",\"time\":1731185179,\"caller\":\"/home/runner/work/release/release/deploy.go:143\",\"message\":\"Compose stack deployment complete\"}\n"
2024/11/09 08:46PM INF github.com/portainer/portainer-ee/api/docker/images/digest.go:58 > No environment registry credentials found, using anonymous access | image up to date indicator=docker.io/library/redis:alpine
2024/11/09 08:46PM INF github.com/portainer/portainer-ee/api/stacks/deployments/deployer_remote.go:261 > Stack deployment output | output="{\"level\":\"info\",\"repository\":\"https://github.com/thezoomlesss/HomeCloud\",\"composePath\":[\"docker-compose-prod.yml\"],\"destination\":\"/portainer-compose-unpacker\",\"env\":[\"VITE_APP_RESTAPI_URL=http://rpi4.local:9915\",\"FOO=BAR\",\"Test=ER\"],\"skipTLSVerify\":false,\"time\":1731185206,\"caller\":\"/home/runner/work/release/release/deploy.go:31\",\"message\":\"Deploying Compose stack from Git repository\"}\n{\"level\":\"info\",\"user\":\"thezoomlesss\",\"time\":1731185206,\"caller\":\"/home/runner/work/release/release/deploy.go:41\",\"message\":\"Using Git authentication\"}\n{\"level\":\"info\",\"directory\":\"/portainer-compose-unpacker\",\"time\":1731185206,\"caller\":\"/home/runner/work/release/release/deploy.go:56\",\"message\":\"Checking the file system...\"}\n{\"level\":\"info\",\"directory\":\"/portainer-compose-unpacker/stacks/homecloud-relative-path\",\"time\":1731185206,\"caller\":\"/home/runner/work/release/release/deploy.go:82\",\"message\":\"Creating target destination directory on disk\"}\n{\"level\":\"info\",\"repository\":\"https://github.com/thezoomlesss/HomeCloud\",\"path\":\"/portainer-compose-unpacker/stacks/homecloud-relative-path/HomeCloud\",\"url\":\"https://github.com/thezoomlesss/HomeCloud\",\"depth\":1,\"time\":1731185206,\"caller\":\"/home/runner/work/release/release/deploy.go:97\",\"message\":\"Cloning git repository\"}\n{\"level\":\"info\",\"composeFilePaths\":[\"/portainer-compose-unpacker/stacks/homecloud-relative-path/HomeCloud/docker-compose-prod.yml\"],\"workingDirectory\":\"/portainer-compose-unpacker/stacks/homecloud-relative-path/HomeCloud\",\"projectName\":\"homecloud-relative-path\",\"time\":1731185207,\"caller\":\"/home/runner/work/release/release/deploy.go:125\",\"message\":\"Deploying Compose stack\"}\n{\"level\":\"info\",\"time\":1731185207,\"caller\":\"/home/runner/work/release/release/deploy.go:143\",\"message\":\"Compose stack deployment complete\"}\n"

Portainer version

2.21.4

Portainer Edition

Business Edition (BE/EE) with 5NF / 3NF license

Platform and Version

Docker version 26.1.3, build b72abbb

OS and Architecture

ARM64

Browser

No response

What command did you use to deploy Portainer?

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions