-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Get project id from existing platform config files #28
Comments
Thanks for taking it for a spin, really appreciate your comments! Unfortunately .platform/local/project.yaml is created by the platform cli after it knows the project ID. There are various ways for the platform CLI to figure out the project and environment, but they mostly depend on on the git remote, which only works for git repos hosted on platform, not repos on github or gitlab. So I struggled with this and never came up with an authoritative answer better than just asking the user. Would love any suggestions of course. |
I see, in that case maybe close the issue (we can re-open) or flag it as "really nice to have" or something? After all, it is a nice to have and a one-time thing rather than something critical. I need to create a platform project from scratch to fully understand the procedure but I don't see happening anytime soon. |
Closing, but it's a lovely pursuit, and I think everybody thought there would be a way, and there would have been in the days before github and gitlab support. Would love to hear how your use the the add-on worked otherwise. |
In the projects I encountered Again, I only started working with Platform 3 weeks ago. So for sure not fully up-to-date with the details. |
Yeah, the README in .platform/local tells all:
|
We may check if the file is already there, and if so use the project ID. That can indeed be useful when it's commited |
I think that making discoverability of the project/environment from the repo/config should be a goal for sure. Where would we prod that along @lolautruche ? |
I'm willing to give this a try. I can put it on low-prio for this/next week. By looking at the code it should be ok to check this on installation of the extension and copy the correct value to |
@rfay care to re-open this? It's not top priority but my guess is it's not far away now |
Closing for now, happy to reopen when you get back to it. I don't personally think it can be done reliably. |
@rfay can you elaborate? If the person retrieves the project with the platform.sh CLI tool via The only scenario I can think of where the project isnt set up (ie In any of the above scenarios, I would think the add-on could still check for the file's existence and use it if available. |
You're right, if people use And of course DDEV does not require people to install the platform cli at all on the host, because it's in the web container. However, if we change the expectation slightly to tell people to install the CLI and get the project with |
But this is the platformsh add-on, not DDEV proper. If they're using this add-on, then we should be able to safely assume they're doing so because they're trying to set up a platform.sh project in DDEV. There's no way for them to easily clone a project directly from platform.sh without the cli. If they didn't use the CLI to clone the project that leaves us with the scenario of them cloning a project from an integration source where that project has an integration created. And in either case, the add-on should still be able to cheaply check for the existence of a file and use it if it's available.
If I remember correctly, that's a fail-safe if the Alternatively, what about starting a container with the CLI installed, and then using it to retrieve and configure all the necessary information from Platform.sh? This way you could re-use the cli's autocomplete abilities on projects. |
I don't agree. I would be using git, and this is gitignored. But that doesn't mean we can't encourage people to install and use the platform command to do the initial checkout.
I don't agree with this either. I imagine most people don't want their code hosted by Platform in the first place, so have it on github or gitlab. And it's easy to get the git URL and clone; it was the only way I'd done it until lately.
The web container already has the platform tool installed, and if they've done the global setup, it knows all the projects. But... unless the remote is as expected, autocomplete doesn't work either. I think if we just encourage people to check out with platform instead of git we'll be a step closer. |
In our case we use git (lab/hub/whatever) but we opted to commit Encouraging people to checkout from platform (instead of git) means asking them to change a lot of their workflows and tools. I feel this would be harder to achieve and harder to convince people. |
Another approach I can see would be to use |
The problem remains that it's not possible to get project:info predictably and reliably. |
@gilzow and I just talked, here's a strategy:
|
Upon installation you are requested to provide the project id:
Ideally the ID should be acquired from the existing platform config rather than asking the user to provide it.
It is my understand that the
platform project id
is available under.platform/local/project.yaml
, right?(I've only been to projects that were already configured with platform, so I might lack some knowledge here)
I'd love to hear other peoples thoughts on that though
Related: #7
The text was updated successfully, but these errors were encountered: