Skip to content

Commit b33042f

Browse files
committed
Doc: FBC one step process documentation
The documentation covers a process for releasing FBC bundles with single step. A couple of new files and modification of existing are now described in the doc that are required for the ones step. JIRA: ISV-5508 Signed-off-by: Ales Raszka <araszka@redhat.com>
1 parent be7c4de commit b33042f

File tree

9 files changed

+172
-23
lines changed

9 files changed

+172
-23
lines changed

.github/workflows/documentation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
mkdocs build
2525
- name: Deploy
2626
uses: peaceiris/actions-gh-pages@v4
27-
if: github.ref == 'refs/heads/main'
27+
# if: github.ref == 'refs/heads/main'
2828
with:
2929
github_token: ${{ secrets.GITHUB_TOKEN }}
3030
publish_dir: ./site

docs/img/fbc-auto-release-pr.png

85.2 KB
Loading

docs/users/contributing-via-pr.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
To submit an operator one has to do these steps
55

66
1. Fork project based on desired [Operator Repository](./pipelines_overview.md#operator-repositories)
7-
1. Place the operator in the target directory. [More info](./contributing-where-to.md)
7+
2. Place the operator in the target directory. [More info](./contributing-where-to.md)
88
- operators
9-
1. Configure `ci.yaml` file. [More info](./operator-ci-yaml.md)
9+
3. Configure `ci.yaml` file. [More info](./operator-ci-yaml.md)
1010
- Setup reviewers
1111
- Enable FBC mode
12-
1. Make a pull request with a new operator bundle or catalog changes
13-
1. Verify tests and fix problems, if possible
14-
1. Ask for help in the PR in case of problems
12+
- Add template to catalog mapping
13+
4. Configure the `release-config.yaml` file if you want to automatically release the operator to the OCP catalogs. [More info](./fcb_autorelease.md#release-configyaml)
14+
5. Make a pull request with a new operator bundle or catalog changes
15+
6. Verify tests and fix problems, if possible
16+
7. Ask for help in the PR in case of problems
1517

1618

1719
## Pull request

docs/users/contributing-where-to.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Once you have forked the upstream repo, you will require to add your Operator Bu
1515
│ │ │ └── tools.opdev.io_demoresources.yaml
1616
│ │ ├── metadata
1717
│ │ │ └── annotations.yaml
18+
│ │ ├── release-config.yaml
1819
│ │ └── tests
1920
│ │ └── scorecard
2021
│ │ └── config.yaml

docs/users/fbc_autorelease.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# File-Based Catalog - auto-release
2+
By the nature of the File-Based Catalog (FBC) mode, the release of operator is made of two steps.
3+
* The first step builds, test and release bundle image
4+
* The second step adds a bundle to OCP catalog and releases it
5+
6+
The second step can be now automated and user is no longer required to manually create a
7+
second PR with catalog changes. The release pipeline will take care of it.
8+
9+
The process will require an additional configuration in the `release-config.yaml` file.
10+
Once a PR with new bundle and `release-config.yaml` is merged, the release pipeline will
11+
open a new PR with catalog changes.
12+
13+
Example of such PR can be found [here](https://github.com/Allda/community-operators-pipeline-preprod/pull/20).
14+
The second PR is linked with it original PR and looks like [this](https://github.com/Allda/community-operators-pipeline-preprod/pull/25):
15+
16+
![Release info](../img/fbc-auto-release-pr.png)
17+
18+
## release-config.yaml
19+
20+
If you want your operators to be automatically released to the OCP catalogs in the FBC mode,
21+
you will need to configure the `release-config.yaml` file. The file should be placed
22+
into the bundle version directory, e.g. `operators/aqua/0.0.2/release-config.yaml`.
23+
24+
```
25+
tree operators/aqua
26+
.
27+
├── 0.0.2
28+
│   ├── release-config.yaml # This is the file
29+
│   ├── manifests
30+
│   └── metadata
31+
├── catalog-templates
32+
├── ci.yaml
33+
└── Makefile
34+
```
35+
Its content determines where exactly the bundle will be released in terms of
36+
the OCP version and the place in the update graph.
37+
38+
### Example
39+
40+
```yaml
41+
---
42+
catalog_templates:
43+
- template_name: basic.yaml
44+
channels: [my-channel]
45+
replaces: aqua.0.0.1
46+
- template_name: semver.yaml
47+
channels: [Fast, Stable]
48+
```
49+
The example above shows a release configuration where operator bundle is going to be
50+
released to the `my-channel` channel in the `basic.yaml` catalog template and to the
51+
`Fast` and `Stable` channels in the `semver.yaml` catalog template.
52+
53+
The `replaces` field is optional and it specifies the bundle that the new bundle
54+
replaces in the update graph.
55+
56+
### File structure
57+
The schema of the file is available here: [release-config.yaml schema](https://github.com/redhat-openshift-ecosystem/operator-pipelines/blob/main/operator-pipeline-images/operatorcert/schemas/release-config-schema.json).
58+
The schema is validated automatically in the pipeline and the PR will fail with explanations if the file is not valid.
59+
60+
Here is a summary of the file structure:
61+
62+
* The top-level key is `catalog_templates` which is a list of objects.
63+
* Each object has the following keys:
64+
* `template_name` - the name of the catalog template file in the `catalog-templates` directory.
65+
* `channels` - a list of channels where the bundle should be released.
66+
* In case of using `SemVer` a user can pick from allowed values: `Fast`, `Stable` and `Candidate`.
67+
* `replaces` - the bundle that the new bundle replaces in the update graph. (**Optional**, only for the basic templates)
68+
* `skips` - a list of bundles that should be skipped in the update graph. (**Optional**, only for the basic templates)
69+
* `skipRange` - a range of bundles that should be skipped in the update graph. (**Optional**, only for the basic templates)

docs/users/fbc_workflow.md

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,59 @@ File-based catalog templates serve as a simplified view of a catalog that can be
1818
by the user. The OPM currently supports 2 types of templates and it is up to the user which
1919
template the operator will be using.
2020
21-
* Basic template
22-
* SemVer template
21+
* Basic template - `olm.template.basic`
22+
* SemVer template - `olm.semver`
2323

2424
More information about each template can be found at [opm doc](https://olm.operatorframework.io/docs/reference/catalog-templates/).
2525

2626
The recommended template from the maintainability point of view is `SemVer`.
2727

28+
### FCB template mapping
29+
To be able to generate a catalog from templates a user needs to provide a mapping between
30+
template and catalog. The mapping is stored in the `ci.yaml` file. Based on your preference
31+
you can map a template to a catalog version with 1:N mapping or 1:1 mapping.
32+
33+
Here is an example of the `ci.yaml` file with single template rendering multiple catalogs (`1:N`):
34+
35+
```yaml
36+
---
37+
fbc:
38+
enabled: true
39+
catalog_mapping:
40+
- template_name: my-custom-semver-template.yaml # The name of the file inside ./catalog-templates directory
41+
catalogs_names: # a list of catalogs within the /catalogs directory
42+
- "v4.15"
43+
- "v4.16"
44+
- "v4.17"
45+
type: olm.semver
46+
- template_name: my-custom-basic-template.yaml # The name of the file inside catalog-templates directory
47+
catalogs_names:
48+
- "v4.12"
49+
- "v4.13"
50+
type: olm.template.basic
51+
```
52+
53+
And here is an example of the `ci.yaml` file with a single template rendering a single catalog (`1:1`):
54+
55+
```yaml
56+
---
57+
fbc:
58+
enabled: true
59+
catalog_mapping:
60+
- template_name: v4.14.yaml
61+
catalog_names: ["v4.14"]
62+
type: olm.template.basic
63+
- template_name: v4.15.yaml
64+
catalog_names: ["v4.15"]
65+
type: olm.template.basic
66+
- template_name: v4.16.yaml
67+
catalog_names: ["v4.16"]
68+
type: olm.template.basic
69+
- template_name: v4.17.yaml
70+
catalog_names: ["v4.17"]
71+
type: olm.template.basic
72+
```
73+
2874
## Generate catalogs using templates
2975
To generate a final catalog for an operator a user needs to execute different `opm`
3076
commands based on the template type. We as operator pipeline maintainers want
@@ -43,6 +89,7 @@ The right place for the Makefile is in the operator's root directory
4389
```
4490
.
4591
├── 0.0.1
92+
| ├── release-config.yaml
4693
│   ├── manifests
4794
│   └── metadata
4895
├── catalog-templates
@@ -51,8 +98,6 @@ The right place for the Makefile is in the operator's root directory
5198

5299
```
53100
54-
You can modify the Makefile based on your needs and use it to generate catalogs by running `make catalogs`.
55-
56101
> [!IMPORTANT]
57102
> In case an operator isn't shipped to all OCP catalog versions manually update `OCP_VERSIONS`
58103
> variable in the `Makefile` and include only versions supported by an operator.
@@ -83,6 +128,16 @@ catalogs
83128
```
84129

85130
### Adding new bundle to Catalog
131+
A new bundle can be added automatically to your templates and catalogs if you use
132+
the automated release feature. The process is described in the
133+
[fbc auto-release](./fbc_autorelease.md) documentation.
134+
135+
It is highly recommended to use the automated release feature as it simplifies the process
136+
from the user perspective.
137+
138+
However if you want to manually add a new bundle to the catalog follow the steps below.
139+
140+
86141
To add a bundle to the catalog you need to first submit the new version of the operator
87142
using traditional [PR workflow](./contributing-via-pr.md). The operator pipeline builds,
88143
tests, and releases the bundle into the registry. **At this point, the operator is not available

docs/users/operator-ci-yaml.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,29 @@ The `fbc.version_promotion_strategy` option defines the strategy for promoting t
4545
- `always` - the operator will be promoted to the next OCP version automatically
4646
- `review-needed` - the operator will be promoted to the next OCP version automatically, but the PR will be created and the reviewers will be asked to review the changes
4747

48+
### `fbc.catalog_mapping`
49+
The mapping serves as a link between catalog templates within the `./catalog-templates` directory and catalogs within the `./catalogs` directory.
50+
51+
For more details and structure visit the [FBC workflow page](./fbc_workflow.md#fcb-template-mapping).
52+
4853
### Example
4954
```yaml
5055
---
5156
fbc:
52-
enabled: true
53-
version_promotion_strategy: never
57+
enabled: true
58+
version_promotion_strategy: never
59+
catalog_mapping:
60+
- template_name: my-custom-semver-template.yaml # The name of the file inside ./catalog-templates directory
61+
catalogs_names: # a list of catalogs within the /catalogs directory
62+
- "v4.15"
63+
- "v4.16"
64+
- "v4.17"
65+
type: olm.semver
66+
- template_name: my-custom-basic-template.yaml # The name of the file inside catalog-templates directory
67+
catalogs_names:
68+
- "v4.12"
69+
- "v4.13"
70+
type: olm.template.basic
5471
```
5572
5673

docs/users/static_checks.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ The test is based on `operator-sdk bundle validate` command with `name=operatorh
5252
The test is based on `operator-sdk bundle validate` command with `suite=operatorframework` test suite [(link)](https://sdk.operatorframework.io/docs/cli/operator-sdk_bundle_validate/#operator-sdk-bundle-validate).
5353

5454
#### check_required_fields
55-
| Field name | Validation | Description |
56-
|------------|------------|------|
57-
| `spec.displayName` | `.{3,50}` | A string with 3 - 50 characters |
58-
| `spec.description` | `.{20,}` | A bundle description with at least 20 characters |
59-
| `spec.icon` | `media` | A valid base64 content with a supported media type (`{"base64data": <b64 content>, "mediatype": enum["image/png", "image/jpeg", "image/gif", "image/svg+xml"]}`) |
60-
| `spec.version` | `SemVer` | Valid semantic version |
61-
| `spec.maintainers` | | At least 1 maintainer contacts. Example: `{"name": "User 123", "email": "user@redhat.com"}` |
62-
| `spec.provider.name` | `.{3,}` | A string with at least 3 characters |
63-
| `spec.links` | | At least 1 link. Example: `{"name": "Documentation", "url": "https://redhat.com"}` |
55+
| Field name | Validation | Description |
56+
| -------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
57+
| `spec.displayName` | `.{3,50}` | A string with 3 - 50 characters |
58+
| `spec.description` | `.{20,}` | A bundle description with at least 20 characters |
59+
| `spec.icon` | `media` | A valid base64 content with a supported media type (`{"base64data": <b64 content>, "mediatype": enum["image/png", "image/jpeg", "image/gif", "image/svg+xml"]}`) |
60+
| `spec.version` | `SemVer` | Valid semantic version |
61+
| `spec.maintainers` | | At least 1 maintainer contacts. Example: `{"name": "User 123", "email": "user@redhat.com"}` |
62+
| `spec.provider.name` | `.{3,}` | A string with at least 3 characters |
63+
| `spec.links` | | At least 1 link. Example: `{"name": "Documentation", "url": "https://redhat.com"}` |
6464

6565
#### check_dangling_bundles
6666
The test prevents from releasing an operator and keeping any previous bundle dangling.
@@ -133,6 +133,10 @@ This check will ensure that all bundle images in the file based catalog for give
133133
operator catalog(s) use allowed image registry. Allowed registries are configured
134134
in `(repo_root)/config.yaml` under the key `allowed_bundle_registries`.
135135

136+
#### check_schema_bundle_release_config
137+
The test validates the `release-config.yaml` file against the schema. The schema
138+
the file including the schema is described [here](./fcb_autorelease.md#release-configyaml)
139+
136140
## Running tests locally
137141

138142
```bash

mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ nav:
1717
- "Before submitting your Operator": "users/contributing-prerequisites.md"
1818
- "Where to place operator": "users/contributing-where-to.md"
1919
- "Best practices": "users/best-practices.md"
20-
- "File base catalog onboarding": "users/fbc_onboarding.md"
21-
- "File base catalog workflow": "users/fbc_workflow.md"
20+
- "File based catalog onboarding": "users/fbc_onboarding.md"
21+
- "File based catalog workflow": "users/fbc_workflow.md"
22+
- "File based catalog auto-release": "users/fbc_autorelease.md"
2223
- "OKD/OpenShift Catalogs criteria and options": "users/packaging-required-criteria-ocp.md"
2324
- "Admin":
2425
- "Admin guide": "pipeline-admin-guide.md"

0 commit comments

Comments
 (0)