You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(create-preview/delete-preview)!: introduce new create-pr-preview and delete-pr-preview commands and refactor old create-preview and delete-preview to use different approach create-pr-preview: handles deployment of preview env and chatops (comments in the pr) create-preview: only handled deployment of the preview env delete-pr-preview: deletes deployment of preview env which was created with create-pr-preview command delete-preview: deletes deployment of preview env which was created with create-preview command BREAKING CHANGE: if you used create-preview you now need to switch to create-pr-preview, if you used delete-preview you now need to switch to delete-pr-preview command
The `create-pr-preview` command can be used to create a preview environment in your *deployment config repository* for a pull request of your *app repository*. You can later easily delete this preview with the [`delete-pr-preview` command](/gitopscli/commands/delete-pr-preview/).
4
+
5
+
You need to provide some additional configuration files in your repositories for this command to work.
6
+
7
+
## Configuration
8
+
### Preview Templates
9
+
10
+
Your *deployment config repository* needs to contain a `.preview-templates` folder with the deployment configuration templates for every application you want to use this command for.
11
+
12
+
For example you have to provide `.preview-templates/app-xy` for your app `app-xy`. The `create-pr-preview` command simply copies this directory to the root of the repository. Only image tag and route host will be replaced in the preview version of the deployment.
13
+
14
+
```
15
+
deployment-config-repo/
16
+
├── .preview-templates
17
+
│ └── app-xy
18
+
│ ├── values.yaml
19
+
│ └── some-more-config-files-or-folders
20
+
├── app-xy-production
21
+
├── app-xy-staging
22
+
├── app-xy-test
23
+
└── app-xy-c7003101-preview <- This is how a created preview looks like
24
+
├── values.yaml <- image tag and route host are replaced in this one
25
+
└── some-more-config-files-or-folders
26
+
```
27
+
28
+
!!! info "Currently you have to specify image tag and route host in a `values.yaml` file. We are working on making this configurable in the future."
29
+
30
+
### .gitops.config.yaml
31
+
32
+
Make sure that your *app repository* contains a `.gitops.config.yaml` file. This file provides all information to
33
+
34
+
1. find the *deployment config repository*
35
+
2. locate the preview template for your app
36
+
3. replace image tag and route host in the template
37
+
38
+
```yaml
39
+
deploymentConfig:
40
+
# The organisation name of your deployment repo
41
+
org: deployments
42
+
# The repostiory name of your deployment repo
43
+
repository: deployment-config-repo
44
+
# The name of the application (name of the folder in `.preview-templates`)
45
+
applicationName: app-xy
46
+
47
+
previewConfig:
48
+
route:
49
+
host:
50
+
# Your router host
51
+
# {SHA256_8CHAR_BRANCH_HASH} gets replaced by a shortened hash of your feature branch name
Copy file name to clipboardExpand all lines: docs/commands/create-preview.md
+9-17Lines changed: 9 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# create-preview
2
2
3
-
The `create-preview` command can be used to create a preview environment in your *deployment config repository* for a pull request in you*app repository*. You can later easily delete this preview with the [`delete-preview` command](/gitopscli/commands/delete-preview/).
3
+
The `create-preview` command can be used to create a preview environment in your *deployment config repository* for a commit hash of your*app repository*. You can later easily delete this preview with the [`delete-preview` command](/gitopscli/commands/delete-preview/).
4
4
5
5
You need to provide some additional configuration files in your repositories for this command to work.
6
6
@@ -48,12 +48,12 @@ previewConfig:
48
48
route:
49
49
host:
50
50
# Your router host
51
-
# {SHA256_8CHAR_BRANCH_HASH} gets replaced by a shortened hash of your feature branch name
51
+
# {SHA256_8CHAR_BRANCH_HASH} gets replaced by a shortened hash of your preview_id
The `delete-pr-preview` command can be used to delete a preview previously created with the [`create-pr-preview` command](/gitopscli/commands/create-pr-preview/). Please refer to `create-pr-preview` documentation for the needed configuration files.
0 commit comments