Skip to content

Commit 4c229fb

Browse files
committed
docs: improve promote documentation
Signed-off-by: Mårten Svantesson <Marten.Svantesson@ticket.se>
1 parent 7216ce6 commit 4c229fb

File tree

2 files changed

+51
-11
lines changed

2 files changed

+51
-11
lines changed

content/en/v3/develop/environments/config.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ When you setup a [Remote Cluster](/v3/admin/guides/multi-cluster/) for `Staging`
3131

3232
Then when you import the remote cluster repository into the development environment (to setup the CI/CD on pull requests and enable promotion) the generated Pull Request will modify your `jx-requirements.yml` to add remote entries for the remote cluster.
3333

34-
e.g. after importing the remote `production` environment via [jx project import](/v3/develop/reference/jx/project/import) and the pull request merging it should look like:
34+
E.g. after importing the remote `production` environment via [jx project import](/v3/develop/reference/jx/project/import) and the pull request merging it should look like:
3535

3636
```yaml
3737
apiVersion: core.jenkins-x.io/v4beta1
@@ -50,9 +50,15 @@ spec:
5050

5151
## Custom environments per repository
5252

53-
If you wish to use different sets of environments for different microservices you can override the environments that are used for promotion by adding a `.jx/settings.yaml` with [this format](https://github.com/jenkins-x/jx-api/blob/master/docs/config.md#settings) which overrides settings found the development environments [jx-requirements.yml](https://github.com/jenkins-x/jx-api/blob/master/docs/config.md#requirements) file.
53+
If you wish to use different sets of environments for different microservices you can augment the environments that are
54+
used for promotion by adding a `.jx/settings.yaml` with [this format](https://github.
55+
com/jenkins-x/jx-api/blob/master/docs/config.md#settings) which is merged with settings for the development
56+
cluster repository's [jx-requirements.yml](https://github.com/jenkins-x/jx-api/blob/master/docs/config.
57+
md#requirements) file. If you want to override the environments instead of augment you can set
58+
`ignoreDevEnvironments: true`. By default the namespace name is the environment name prefixed with `jx-`.
5459

55-
e.g. add something like this to your `.jx/settings.yaml` in a repository to override which environment repositories are promoted to:
60+
E.g. add something like this to your `.jx/settings.yaml` in a repository to override which environment repositories
61+
are promoted to:
5662

5763
```yaml
5864
apiVersion: core.jenkins-x.io/v4beta1
@@ -64,9 +70,23 @@ spec:
6470
- key: my-staging
6571
owner: myowner
6672
repository: some-repo-name
73+
promotionStrategy: Auto
6774
- key: my-prod
6875
owner: myowner
69-
repository: some-other-repo-name
76+
repository: some-other-repo-name
77+
promotionStrategy: Manual
78+
```
79+
80+
If you instead want to disable promotion to an environment, say staging, you can do it with a `.jx/settings.yaml`
81+
looking like this:
82+
83+
```yaml
84+
apiVersion: core.jenkins-x.io/v4beta1
85+
kind: Settings
86+
spec:
87+
promoteEnvironments:
88+
- key: staging
89+
promotionStrategy: Never
7090
```
7191

7292
## Custom environments per group of repositories
@@ -77,7 +97,7 @@ The simplest way to do this is to use a separate git organisation (owner) per te
7797

7898
The added benefit of using separate git organisations is that already the [dashboard](/v3/develop/ui/dashboard/) supports filtering all pipelines by owner; so each team will get effectively their own separate UI for viewing pipelines. You can easily bookmark the dashboards view for a single owner / repository.
7999

80-
e.g. here's an example `.jx/gitops/source-config.yaml in the development cluster git repository:
100+
E.g. here's `.jx/gitops/source-config.yaml in the development cluster git repository:
81101

82102
```yaml
83103
apiVersion: gitops.jenkins-x.io/v1alpha1

content/en/v3/develop/environments/promotion/_index.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,45 @@ When changes are merged to the main branch in the Jenkins X pipeline catalog a n
1010

1111
## How it works
1212

13-
The release pipelines use the [jx promote --all](https://github.com/jenkins-x/jx-promote/blob/master/docs/cmd/jx-promote.md#jx-promote) command which creates Pull Requests on all Environments configured in your `jx-requirements.yml` file (see the [Configuration](/v3/develop/environments/config/))
13+
The release pipelines use the [jx promote --all](https://github.
14+
com/jenkins-x/jx-promote/blob/master/docs/cmd/jx-promote.md#jx-promote) command which creates Pull Requests on all
15+
Environments configured in your `jx-requirements.yml` file and possibly `.jx/gitops/source-config.yaml` or
16+
`.jx/settings.yaml` (see the [Configuration](/v3/develop/environments/config/)).
1417

15-
* every environment which is defined in `jx-requirements.yml` as `promotionStrategy` **Auto** or **Manual** is included in a Pull Request to promote the new version to that environment
18+
* every environment which is defined as `promotionStrategy` **Auto** or **Manual** is included in a Pull Request to promote the new version to that environment
1619

1720
* **Auto** means the Pull Request will automatically merge if its successful (the Pull Request pipeline succeeds)
1821

1922
* **Manual** means the Pull Request is a draft and won't automatically merge. i.e. the Pull Request needs to be manually approved (comment `/approve`) and taken off hold (comment `/hold cancel`).
2023

21-
* all local Environments in your `jx-requirements.yml` of the promotion kind **Auto** are promoted using a single Pull Request so that all the promotions automatically merge if the pull request pipeline validates successfully.
24+
* all local Environments of the promotion kind **Auto** are promoted using a single Pull Request so that all the promotions automatically merge if the pull request pipeline validates successfully.
2225

2326
* you can define multiple local or remote Environments for different system / integration testing environments.
2427

2528

26-
## Changing Promotion
29+
## Disable Promotion
2730

28-
If you want to disable promotion Pull Requests on an environment just remove the entry in `jx-requirements.yml` or configure the `promotionStrategy` to be **Never**
31+
If you want to disable promotion Pull Requests on an environment just remove the entry or configure the
32+
`promotionStrategy` to be **Never**.
2933

30-
If you want your application to promote to different environments to the defaults for your cluster you can always [modify your pipeline](/v3/develop/pipelines/#editing-pipelines) and change the promote step to use different [jx promote](https://github.com/jenkins-x/jx-promote/blob/master/docs/cmd/jx-promote.md#jx-promote) arguments; e.g. pass in the explicit environments or repositories you want to promote to in the pipeline step.
34+
## Reuse pull requests
3135

36+
By default a new pull request is created for each promotion. You can instead make existing open pull requests for
37+
promoting an application be reused.
38+
39+
Enabling reuse of pull requests for `jx promote` is done in `jx-requirements.yaml` by setting `reusePullRequest` to
40+
`true` for an environment. It can also be done in the same way when configuring environments others ways. See
41+
https://jenkins-x.io/v3/develop/environments/config/ for more details about configuring environments.
42+
43+
There are two main reasons why you would want to enable this:
44+
45+
To reduce conflicts: if a pull request is created before a previous pull request for upgrading the same application is
46+
merged there will be a conflict when the earlier pull request is merged. Since enabling reuse means that `jx
47+
promote` won't open more pull requests for an application this can't happen.
48+
49+
The other reason is if you make use of the functionality to propagate application changelogs to cluster
50+
repositories. This is described in the blog post
51+
[Improve your changelogs](/blog/2023/05/24/propagate-changelogs/#reuse-pull-requests).
3252

3353
## Synchronizing environments or namespaces
3454

0 commit comments

Comments
 (0)