Skip to content

Commit 58c7296

Browse files
Improve sync-apps doc
1 parent 87d901c commit 58c7296

2 files changed

Lines changed: 68 additions & 17 deletions

File tree

docs/commands/sync-apps.md

Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,68 @@
11
# 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
266
```
367
usage: gitopscli sync-apps [-h] --username USERNAME --password PASSWORD
468
[--git-user GIT_USER] [--git-email GIT_EMAIL]
@@ -28,20 +92,7 @@ optional arguments:
2892
-v [VERBOSE], --verbose [VERBOSE]
2993
Verbose exception logging
3094
--root-organisation ROOT_ORGANISATION
31-
Apps config repository organisation
32-
--root-repository-name ROOT_REPOSITORY_NAME
3395
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
4798
```

gitopscli/cliparser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def __add_sync_apps_command_parser(subparsers):
5353
)
5454
__add_git_parser_args(sync_apps_p)
5555
__add_verbose_parser(sync_apps_p)
56-
sync_apps_p.add_argument("--root-organisation", help="Apps config repository organisation", required=True)
57-
sync_apps_p.add_argument("--root-repository-name", help="Root config repository organisation", required=True)
56+
sync_apps_p.add_argument("--root-organisation", help="Root config repository organisation", required=True)
57+
sync_apps_p.add_argument("--root-repository-name", help="Root config repository name", required=True)
5858

5959

6060
def __add_pr_comment_command_parser(subparsers):

0 commit comments

Comments
 (0)