coreeng / corectl

CLI for the CECG Core Platform https://www.cecg.io/core-platform/
https://www.cecg.io/core-platform/
Apache License 2.0
1 stars 1 forks source link

export env variables required to run onboarded apps p2p makefile targets #27

Closed tombart closed 2 months ago

tombart commented 3 months ago

new functionality that allows to export required env variables required to execute onboarded apps p2p make targets issue: https://github.com/coreeng/project-platform-accelerator/issues/396. The command will print out export statements in new lines as:

export BASE_DOMAIN="gcp-dev.cecg.platform.cecg.io"                                 
export REPO_PATH="../tombart-app"                                                  
export REGION="europe-west2"                                                       
export REGISTRY="europe-west2-docker.pkg.dev/core-platform-efb3c84c/tenant/tomaszb"
export VERSION="53b9c85"                                                           
export TENANT_NAME="tomaszb" 

The user is expected to copy and paste in terminal.

Example run: corectl p2p export --tenant tomaszb --environment gcp-dev --repoPath ../tombart-app or corectl p2p export --tenant tomaszb --environment gcp-dev -- defaults to current dir or eval $(corectl p2p export --tenant tomaszb --environment gcp-dev --repoPath ../tombart-app) -- automatically add vars to current shell

There is quite a lot of duplication in the tool in both logic and code, however due to the size of this pr didn't do much cleanup. Probably better to tackle separately as sep tickets. Also p2p sync command is quite similar to this one, however not very extensible to be re-used. Would need to major refactoring which decided not to do as a part of this work.

tombart commented 2 months ago

I was under impression that this command will be using information from remote repository. I.e. if I do corectl p2p export -r <path_to_app> it will not ask me about tenant but will get it from repo variable TENANT_NAME

CleanShot 2024-08-13 at 11 26 53@2x

As for the environments (as there may be muliple existing per repo) we could make user choose, but only from the ones that exists in repo, i.e. gcp-prod, gcp-dev

CleanShot 2024-08-13 at 11 27 09@2x

As agreed with Tiago/Lukasz: