|
1 | 1 | # sync-apps |
| 2 | + |
| 3 | +The `sync-apps` command can be used to keep a *root config repository* in sync with several *app config repositories*. You can use this command if your config repositories are structured in the following (opinionated) way: |
| 4 | + |
| 5 | +## Repository Structure |
| 6 | + |
| 7 | +### App Config Repositories |
| 8 | + |
| 9 | +You have `1..n` config repositories for the deployment configurations of your applications (e.g. one per team). Every *app config repository* can contain `0..n` directories (e.g. containing [Helm](https://helm.sh/) charts). Directories starting with a dot will be ignored. Example: |
| 10 | + |
| 11 | +``` |
| 12 | +team-1-app-config-repo/ |
| 13 | +├── .this-will-be-ignored |
| 14 | +├── app-xy-production |
| 15 | +├── app-xy-staging |
| 16 | +└── app-xy-test |
| 17 | +``` |
| 18 | + |
| 19 | +### Root Config Repository |
| 20 | + |
| 21 | +The *root config repository* acts as a single entrypoint for your GitOps continous delivery tool (e.g. [Argo CD](https://argoproj.github.io/argo-cd/)). Here you define all applications in your cluster and link to the *app config repositories* with their deployment configurations. It is structured in the following way: |
| 22 | + |
| 23 | +``` |
| 24 | +root-config-repo/ |
| 25 | +├── apps |
| 26 | +│ ├── team-a.yaml |
| 27 | +│ └── team-b.yaml |
| 28 | +└── bootstrap |
| 29 | + └── values.yaml |
| 30 | +``` |
| 31 | + |
| 32 | +**bootstrap/values.yaml** |
| 33 | +```yaml |
| 34 | +bootstrap: |
| 35 | + - name: team-a # <- every entry links to a YAML file in the `apps/` directory |
| 36 | + - name: team-b |
| 37 | +``` |
| 38 | +
|
| 39 | +**apps/team-a.yaml** |
| 40 | +```yaml |
| 41 | +repository: https://github.com/company-deployments/team-1-app-config-repo.git # link to your apps root repository |
| 42 | + |
| 43 | +# The applications that are synced by the `sync-app` command: |
| 44 | +applications: |
| 45 | + app-xy-production: # <- every entry corresponds to a directory in the apps root repository |
| 46 | + app-xy-staging: |
| 47 | + app-xy-test: |
| 48 | +``` |
| 49 | +
|
| 50 | +## Example |
| 51 | +
|
| 52 | +```bash |
| 53 | +gitopscli sync-apps \ |
| 54 | + --git-provider-url github \ |
| 55 | + --username $GIT_USERNAME \ |
| 56 | + --password $GIT_PASSWORD \ |
| 57 | + --git-user "GitOps CLI" \ |
| 58 | + --git-email "gitopscli@baloise.dev" \ |
| 59 | + --organisation "company-deployments" \ |
| 60 | + --repository-name "team-1-app-config-repo" \ |
| 61 | + --root-organisation "company-deployments" \ |
| 62 | + --root-repository-name "root-config-repo" |
| 63 | +``` |
| 64 | + |
| 65 | +## Usage |
2 | 66 | ``` |
3 | 67 | usage: gitopscli sync-apps [-h] --username USERNAME --password PASSWORD |
4 | 68 | [--git-user GIT_USER] [--git-email GIT_EMAIL] |
@@ -28,20 +92,7 @@ optional arguments: |
28 | 92 | -v [VERBOSE], --verbose [VERBOSE] |
29 | 93 | Verbose exception logging |
30 | 94 | --root-organisation ROOT_ORGANISATION |
31 | | - Apps config repository organisation |
32 | | - --root-repository-name ROOT_REPOSITORY_NAME |
33 | 95 | Root config repository organisation |
34 | | -``` |
35 | | - |
36 | | -## Example |
37 | | -```bash |
38 | | -gitopscli sync-apps --git-provider-url https://bitbucket.baloise.dev \ |
39 | | ---username $GIT_USERNAME \ |
40 | | ---password $GIT_PASSWORD \ |
41 | | ---git-user "GitOpsCLI" \ |
42 | | ---git-email "gitopscli@baloise.dev" \ |
43 | | ---organisation "my-team" \ |
44 | | ---repository-name "my-app" \ |
45 | | ---root-organisation "deployment" \ |
46 | | ---root-repository-name "apps-root-config" |
| 96 | + --root-repository-name ROOT_REPOSITORY_NAME |
| 97 | + Root config repository name |
47 | 98 | ``` |
0 commit comments