Skip to content

Commit

Permalink
semver template: update examples to use lower camel case
Browse files Browse the repository at this point in the history
changes to the way we unmarshal meta blobs dictate that (at least the
meta) fields use lower camel case for their keys. This PR updates
examples and tests to use all lower camel case keys. Thankfully,
the demo gifs in the semver template README already use lower camel case
so there is no need to regenerate them.

Signed-off-by: Joe Lanford <[email protected]>
  • Loading branch information
joelanford committed May 16, 2023
1 parent 5254b0c commit 5f2e380
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 42 deletions.
12 changes: 6 additions & 6 deletions alpha/template/composite/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,12 @@ func TestSemverBuilder(t *testing.T) {
}

const semverYaml = `---
Schema: olm.semver
GenerateMajorChannels: true
GenerateMinorChannels: true
Stable:
Bundles:
- Image: quay.io/olmtest/webhook-operator-bundle:0.0.3
schema: olm.semver
generateMajorChannels: true
generateMinorChannels: true
stable:
bundles:
- image: quay.io/olmtest/webhook-operator-bundle:0.0.3
`

const semverBuiltFbcYaml = `---
Expand Down
70 changes: 34 additions & 36 deletions alpha/template/semver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,42 @@ The `semver template` must have:
The resulting FBC must clearly indicate how generated channels relate to template entities

### Schema Anatomy
For convenience and simplicity, this template currently supports hard-coded channel names `Candidate`, `Fast`, and `Stable`, in order of increasing channel stability. We leverage this relationship to calculate the default channel for the package.
For convenience and simplicity, this template currently supports hard-coded channel names `candidate`, `fast`, and `stable`, in order of increasing channel stability. We leverage this relationship to calculate the default channel for the package.

`GenerateMajorChannels` and `GenerateMinorChannels` dictate whether this template will generate X-stream or Y-stream channels (attributes can be set independently). If omitted, only minor (Y-stream) channels will be generated.
`generateMajorChannels` and `generateMinorChannels` dictate whether this template will generate X-stream or Y-stream channels (attributes can be set independently). If omitted, only minor (Y-stream) channels will be generated.

Under each channel are a list of bundle image references which contribute to that channel.

With the following (hypothetical) example we define a mock bundle which has 11 versions, represented across each of the channel types:
```yaml
Schema: olm.semver
GenerateMajorChannels: true
GenerateMinorChannels: true
Candidate:
Bundles:
- Image: quay.io/foo/olm:testoperator.v0.1.0
- Image: quay.io/foo/olm:testoperator.v0.1.1
- Image: quay.io/foo/olm:testoperator.v0.1.2
- Image: quay.io/foo/olm:testoperator.v0.1.3
- Image: quay.io/foo/olm:testoperator.v0.2.0
- Image: quay.io/foo/olm:testoperator.v0.2.1
- Image: quay.io/foo/olm:testoperator.v0.2.2
- Image: quay.io/foo/olm:testoperator.v0.3.0
- Image: quay.io/foo/olm:testoperator.v1.0.0
- Image: quay.io/foo/olm:testoperator.v1.0.1
- Image: quay.io/foo/olm:testoperator.v1.1.0
Fast:
Bundles:
- Image: quay.io/foo/olm:testoperator.v0.2.1
- Image: quay.io/foo/olm:testoperator.v0.2.2
- Image: quay.io/foo/olm:testoperator.v0.3.0
- Image: quay.io/foo/olm:testoperator.v1.0.1
- Image: quay.io/foo/olm:testoperator.v1.1.0
Stable:
Bundles:
- Image: quay.io/foo/olm:testoperator.v1.0.1
schema: olm.semver
generateMajorChannels: true
generateMinorChannels: true
candidate:
bundles:
- image: quay.io/foo/olm:testoperator.v0.1.0
- image: quay.io/foo/olm:testoperator.v0.1.1
- image: quay.io/foo/olm:testoperator.v0.1.2
- image: quay.io/foo/olm:testoperator.v0.1.3
- image: quay.io/foo/olm:testoperator.v0.2.0
- image: quay.io/foo/olm:testoperator.v0.2.1
- image: quay.io/foo/olm:testoperator.v0.2.2
- image: quay.io/foo/olm:testoperator.v0.3.0
- image: quay.io/foo/olm:testoperator.v1.0.0
- image: quay.io/foo/olm:testoperator.v1.0.1
- image: quay.io/foo/olm:testoperator.v1.1.0
fast:
bundles:
- image: quay.io/foo/olm:testoperator.v0.2.1
- image: quay.io/foo/olm:testoperator.v0.2.2
- image: quay.io/foo/olm:testoperator.v0.3.0
- image: quay.io/foo/olm:testoperator.v1.0.1
- image: quay.io/foo/olm:testoperator.v1.1.0
stable:
bundles:
- image: quay.io/foo/olm:testoperator.v1.0.1
```
In this example, `Candidate` has the entire version range of bundles, `Fast` has a mix of older and more-recent versions, and `Stable` channel only has a single published entry.
In this example, `candidate` has the entire version range of bundles, `fast` has a mix of older and more-recent versions, and `stable` channel only has a single published entry.

### CLI Tool Usage
```
Expand Down Expand Up @@ -85,7 +85,7 @@ Note that if the command is called without a file argument and nothing passed in
the command will hang indefinitely. Either a file argument or file information passed
in on standard input is required by the command.
With the template attribute `GenerateMajorChannels: true` resulting major channels from the command are (filtering out `olm.bundle` content):
With the template attribute `generateMajorChannels: true` resulting major channels from the command are (filtering out `olm.bundle` content):
```yaml
---
defaultChannel: stable-v1
Expand Down Expand Up @@ -165,10 +165,10 @@ package: testoperator
schema: olm.channel
```

We generated a channel for each template channel entity corresponding to each of the 0.\#.\#, 1.\#.\# major version ranges with skips to the head of the highest semver in a channel. We also generated a replaces edge to traverse across minor version transitions within each major channel. Finally, we generated an `olm.package` object, setting as default the most-stable channel head we created. This process will prefer `Stable` channel over `Fast`, over `Candidate` and then a higher bundle version over a lower version.
We generated a channel for each template channel entity corresponding to each of the 0.\#.\#, 1.\#.\# major version ranges with skips to the head of the highest semver in a channel. We also generated a replaces edge to traverse across minor version transitions within each major channel. Finally, we generated an `olm.package` object, setting as default the most-stable channel head we created. This process will prefer `stable` channel over `fast`, over `candidate` and then a higher bundle version over a lower version.
(Please note that the naming of the generated channels indicates the digits of significance for that channel. For example, `fast-v1` is a decomposed channel of the `fast` type which contains only major versions of contributing bundles matching `v1`.)

For contrast, with the template attribute `GenerateMinorChannels: true` and running the command again (again skipping rendered bundle image output) we get a bunch more channels:
For contrast, with the template attribute `generateMinorChannels: true` and running the command again (again skipping rendered bundle image output) we get a bunch more channels:
```yaml
---
defaultChannel: stable-v1.0
Expand Down Expand Up @@ -278,9 +278,7 @@ Here, a channel is generated for each template channel which differs by minor ve
### DEMOS

#### Major Channel Generation
![`GenerateMajorChannels`](./major-version-demo.gif)
![`generateMajorChannels`](./major-version-demo.gif)

#### Minor Channel Generation
![`GenerateMinorChannels`](./minor-version-demo.gif)


![`generateMinorChannels`](./minor-version-demo.gif)

0 comments on commit 5f2e380

Please sign in to comment.