rhd-gitops-example / services

Intra-Git repository promotions for GitOps.
Apache License 2.0
7 stars 8 forks source link

Update `promote` for modified repo structure #72

Closed mnuttall closed 4 years ago

mnuttall commented 4 years ago

odo pipeline init creates GitOps repos that use a modified version of the gitops repository spec, as per https://github.com/rhd-gitops-example/manifest-documentation. See for example https://github.com/bigkevmcd/gitops/.

In order to support multiple environments, a path /environments/environment-name/ is added to the top of the directory structure.

Currently we use

services promote --from [path] --to [git url] --service [name] 

This means, copy [name]/config/* to /services/[name]/base/config/* in the [git url] repo via a PR. In the new case, the target path is /environment/[environment-name]/services/[service-name]/base/config/* and the question is, How do we determine [environment-name] when preparing the pull request, if the [service-name] subdirectory does not exist?

Under this issue implement option 2 and either implement option 1 or raise a follow-on issue to do so.

Also update our example projects (gitops-exampl-dev and -staging) to conform to the new format.

Also update our sample code and documentation.

a-roberts commented 4 years ago

I'll take a look at this one, using https://github.com/bigkevmcd/gitops/ as a reference.

I'll update https://github.com/rhd-gitops-example/gitops-example-dev and https://github.com/rhd-gitops-example/gitops-example-staging.

a-roberts commented 4 years ago

Added the flag (in the most basic sense, not doing anything but printing its value!) and the next piece of work is to get the directory structures matching up and making the necessary adjustments to the promote commands (for both local to remote and remote to remote repositories), will work with @mnuttall on getting this part right

I'll work on the updated structure over at https://github.com/a-roberts/gitops-example-dev and https://github.com/a-roberts/gitops-example-staging as well.

a-roberts commented 4 years ago

I have

We could add another command line arg, --env env-name
We could say, ‘if /environment contains only one subdirectory, use it’

implemented now, working on tests and idyllic repository structure next.