Enhancements to Git integration #9732
Replies: 58 comments 2 replies
-
@deviantony do you also plan to add an API for it? Scenario would be a fully automated initial deployment of a stack from a private Git repo with env variables and then later user-triggered updates |
Beta Was this translation helpful? Give feedback.
-
enhancements I could think of would be to:
Other than that, my only concern as the swarm owner is, the number of times people submit service files at the moment that don't have restart-max-attempts set, or are lacking labels. So the ability to have some code - perhaps a designated image - that Portainer can be configured pre-validate deployments might be a nice to have. |
Beta Was this translation helpful? Give feedback.
-
Yes, the current API already supports stack creation, it will be enhanced to support all of the Git options, this is part of our current work :-) Cool, I'll register your request regarding persisting the git credentials in the secret layer. For your other request though, just to make sure that I understand the problem behind this is that you would like to have a "custom rule validator" that could be applied on Compose files right? In that case I believe that you might want to open a separate feature request as it would also target Compose files that are deployed outside of Git. |
Beta Was this translation helpful? Give feedback.
-
For the sake of completeness: I don't see ssh auth (#1752) mentioned on the list yet. |
Beta Was this translation helpful? Give feedback.
-
Persisting git credentials would be a really helpful quality of life improvement. Also curious how "Periodically check for changes to the git repo and automatically redeploy an application" will work without persistent creds? |
Beta Was this translation helpful? Give feedback.
-
@PANiCnz yup, we're going to persist the credentials with the introduction of the periodic check. @IARI after the troubles we had with a potential implementation of SSH auth in #1752 we've pushed it out of the roadmap at the moment but I'll actually re-add it to the open for discussion items. I'll also close #1752 and refer this issue for discussion. |
Beta Was this translation helpful? Give feedback.
-
I for one vote for Vault integration, I think that could really tie everything together. Also, managing ENV with Vault would be helpful, as secret management without it is... lackluster. |
Beta Was this translation helpful? Give feedback.
-
Just a short note to everyone looking to save git credentials: It does display the credemtials in cleartext in the webinterface though. |
Beta Was this translation helpful? Give feedback.
-
We currently have a preview version available for the first iteration of this initiative: |
Beta Was this translation helpful? Give feedback.
-
@huib-portainer has the API changed for this one? We are deploying through an API call and it works fine on 2.6.1 but the exact same call on the pr5340 image returns the following error message:
The portainer log shows basically the same:
|
Beta Was this translation helpful? Give feedback.
-
Hi, are you able to share how you're calling the API? |
Beta Was this translation helpful? Give feedback.
-
This is the call (in PowerShell), formatted for easier readability
Docker version: 20.10.5 Please let me know if you need anything else |
Beta Was this translation helpful? Give feedback.
-
As you suspected, the API did change. And the following non-mandatory fields were added:
Can you please give that a try? |
Beta Was this translation helpful? Give feedback.
-
Great, that works! Not a big thing but maybe something to document: If I create a stack with "name": "docker-automation", it becomes "dockerautomation", so it seems like the "-" is removed? And it seems like I now can't make portainer "forget" the authorization? What I mean is that if I deploy a stack with auth information, but don't want portainer to store it, that currently seems impossible? |
Beta Was this translation helpful? Give feedback.
-
The dash one may behave as described by #4835. For automatically pulling changes from Git we need to remember the credentials, so that's why we recommend using a PAT. |
Beta Was this translation helpful? Give feedback.
-
That would be great if we can specify git credentials under settings like we do for registries configuration. Therefore, we can use same git creds in many stacks without typing user and password for each. |
Beta Was this translation helpful? Give feedback.
-
I just tested that the auth with username and password works with Bitbucket too. |
Beta Was this translation helpful? Give feedback.
-
Wouldn't you be able to use an access token? |
Beta Was this translation helpful? Give feedback.
-
I see the page you're referring too was updated Des 21. Has the feature been removed? Anyways, this option is not available to me. I was able to log in with the username and app-password, by using a restricted service/read-only account. |
Beta Was this translation helpful? Give feedback.
-
Ah, that explains it ;) |
Beta Was this translation helpful? Give feedback.
-
Another +1 for storing git credentials. Currently I have to create a new personal access token in my GitHub account whenever I deploy a new stack as you cannot view existing tokens to reuse them. Typically a single access token would be made for a single application but my GitHub account is becoming full of individual portainer stack tokens. |
Beta Was this translation helpful? Give feedback.
-
@huib-portainer I had in mind that the "prune" option (remove services/containers no longer in the stack) was available previously when doing a redeploy. Was that remove? Or was it never there and I mix it up with something else? |
Beta Was this translation helpful? Give feedback.
-
With #5979 closed and listed as being included in this issue has there been any further discussion. I just got burned on this issue because there are now blog posts saying that you can do that but you really can't For example see https://tobiasfenster.io/docker-container-stack-deployments-with-dependent-files-through-portainer (not my blog) that lead me to believe you were checking out the whole repo on the target when your really just pulling the compose file. This is important for things where you might need to create some database users prior to deploying your stack like the official postgres image does. |
Beta Was this translation helpful? Give feedback.
-
Along this same line, how about a way to save all the git repo information and reuse it quickly in a new stack? For those of us running a lot of stacks (like me) having to copy and paste all those fields over and over is....tedious, to be generous. |
Beta Was this translation helpful? Give feedback.
-
The other thing lacking from the existing git integration is that it needs to be supplemented with an external CI/CD pipeline such as Jenkins or GitLab to do the actual image building, as the Portainer GitOps will, well, deploy a stack. However in a lot of cases this is overkill. I propose a simple CI Pipeline in Portainer that uses Docker only: A Portainer Pipeline project would be built around docker compose, and would checkout a complete git repo when triggered, and run Being able to get Portainer to build, push and/or run a compose file,can enable far more complex behaviours far outside just preparing images for a stack deployment :- Pipelines could also be used to run admin tasks against a swarm or cluster - i.e. the pipeline could just trigger a service job that runs |
Beta Was this translation helpful? Give feedback.
-
Currently you can build a local image from your compose file if you're using docker standalone. docker-compose.yml
Dockerfile
|
Beta Was this translation helpful? Give feedback.
-
Feature request: Repo Caching Hi all, A possible solution would be that Portainer caches that repo (or at least the actually used files) and keeps them as known-good if all the containers start successfully. Alternatively the user can mark them manually as such. I imagine that as follows: |
Beta Was this translation helpful? Give feedback.
-
Some comments on this feature:
Otherwise I am really loving the ability to pull stacks from a git repo! |
Beta Was this translation helpful? Give feedback.
-
I'll second @Stitch10925 's point about changing the git url. I run my own GitLab instance. Needed to move it a while back. Which meant recreating everything. Actually, in general, it should be possible to change everything about a Stack's git integration. The url, the auth, the branch, all of it should be editable. Even better would be if we could detach from git to make a quick test change, then reattach later on. I also would love to see the branch listed on the details screen. It is not shown on a Swarm Stack details screen, no idea about Kube/etc. |
Beta Was this translation helpful? Give feedback.
-
I'm opening this ticket to discuss and track update on the Git integration within Portainer in general.
We originally added support to deploy a stack from Git a few years back now and we recently turned our focus on being more Git/GitOps centric when it comes to workload deployment.
As such, we've recently added another highly requested feature with the ability to perform a manual git pull and redeploy: #1753
Now the item above has stirred up discussion about a lot of use cases and potential enhancements to that "deploy from Git" capability in Portainer at the moment and we'll be using the state of this capability as it will be released in CE-2.6.0 as our basis for future enhancements.
Open for discussion
Here are the ideas/areas/enhancements we're currently thinking about that are open for discussions:
Here are the ideas/areas/enhancements we're currently looking at or working on:
This is currently in progress.
We're working on this! We're also bringing webhook support with it. More information on this one can be found in that comment: #1753 (comment)
This is currently in progress.
Beta Was this translation helpful? Give feedback.
All reactions