portainer: Portainer fails to deploy stack with GitOps polling, private repo, relative volumes
Before you start please confirm the following.
- Yes, I’ve searched similar issues on GitHub.
- Yes, I’ve checked whether this issue is covered in the Portainer documentation or knowledge base.
Problem Description
With a private repo, GitOps enabled, and relative volume mounts then Portainer will fail to copy the repo’s file most of the time when polling and attempting to deploy a new commit. Force pulling and redeploying works and populates the file, which are then deleted by the next polling.
Expected Behavior
The files are copied over and not erased.
Actual Behavior
The files aren’t copied over.
Steps to Reproduce
- Create private repo
- Enable GitOps, polling, with credentials
- Do a force pull and redeploy, the files are there
- Let Portainer pull the new commit via polling, the files are gone
Portainer logs or screenshots
No response
Portainer version
2.19.2
Portainer Edition
Business Edition (BE/EE) with 5NF / 3NF license
Platform and Version
Swarm 24.0.7
OS and Architecture
Mint 20.3 AMD64
Browser
No response
What command did you use to deploy Portainer?
https://downloads.portainer.io/ee2-19/portainer-agent-stack.yml
Additional Information
No response
About this issue
- Original URL
- State: open
- Created 7 months ago
- Reactions: 4
- Comments: 18 (3 by maintainers)
Here’s the problem:
https://github.com/portainer/portainer/blob/develop/api/git/types/types.go#L25C1-L33C2
and when building the unpacker command it calls
appendGitAuthIfNeeded
https://github.com/portainer/portainer/blob/develop/api/stacks/deployments/compose_unpacker_cmd_builder.go#L185-L190
here it only checks if
Username
orPassword
is set, otherwise it skips authentication completely. However if you have stored credentials, theUsername
andPassword
will be blank and only theGitCredentialID
is set. I guess it works when creating the stack because theUsername
andPassword
is set in the creation process, but won’t get set in the reconciliation when pulling updates.appendGitAuthIfNeeded
needs to resolve theGitCredentialID
intoUsername
andPassword
and append it to the unpacker command options.Webhook also returns an error:
I have a the same behavior.
Polling is failing to redeploy a updated compose file from git.
The frontend notification is
could not get the contents of the file 'docker-compose.yml'
Log shows:
Using the pull and redeploy button updates the containers, but it does not spawn the files on the filesystem. The files that were cloned when first creating the stack are also deleted after the first poll.
#10630 might be playing a part here - we’ve just released 2.19.3 which should fix this, so while I don’t think it solves all your issues it might help with some. But there is some useful detail here that I’ll pass on to the team, thanks.