Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement opm alpha render-veneer semver #948

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

grokspawn
Copy link
Contributor

@grokspawn grokspawn commented Apr 25, 2022

NOTE: Updated comments/docs from yesterday's peer review.

Signed-off-by: Jordan Keister jordan@nimblewidget.com

Description of the change:
Implements a "SemVer" Veneer rendering capability, to illustrate the potential benefits of the use of veneer as entry points into the FBC ecosystem.

Since a veneer is identified as an input schema which may be processed to generate a valid FBC, we can define a semver veneer as a schema which uses channel conventions to facilitate the auto-generation of channels along semver delimiters.

Please see the README.md for complete description.

Motivation for the change:
Illustrate a possible effort-saving work flow for operator authors to use to facilitate migration to FBC.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 25, 2022
@grokspawn grokspawn changed the title [WIP] implement opm alpha render-veneer semver, prior art from https://github.com/joelan… [WIP] implement opm alpha render-veneer semver Apr 25, 2022
@codecov
Copy link

codecov bot commented Apr 26, 2022

Codecov Report

Merging #948 (d252a64) into master (0899512) will increase coverage by 0.12%.
The diff coverage is 58.79%.

❗ Current head d252a64 differs from pull request most recent head 6ff7571. Consider uploading reports for the commit 6ff7571 to get more accurate results

@@            Coverage Diff             @@
##           master     #948      +/-   ##
==========================================
+ Coverage   52.48%   52.61%   +0.12%     
==========================================
  Files         103      104       +1     
  Lines        9240     9422     +182     
==========================================
+ Hits         4850     4957     +107     
- Misses       3468     3535      +67     
- Partials      922      930       +8     
Impacted Files Coverage Δ
alpha/veneer/semver/semver.go 58.79% <58.79%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0899512...6ff7571. Read the comment docs.

@grokspawn grokspawn force-pushed the grokspawn-semver-veneer-cmd branch from 9e66aeb to aa860cd Compare May 9, 2022 12:51
@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 9, 2022
@grokspawn grokspawn force-pushed the grokspawn-semver-veneer-cmd branch from aa860cd to eaa241a Compare May 9, 2022 13:31
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 9, 2022
grokspawn added a commit that referenced this pull request May 10, 2022
Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
@grokspawn grokspawn force-pushed the grokspawn-semver-veneer-cmd branch from c98281d to f1500b5 Compare May 10, 2022 13:14
@grokspawn grokspawn changed the title [WIP] implement opm alpha render-veneer semver implement opm alpha render-veneer semver May 10, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 10, 2022
@grokspawn grokspawn requested review from njhale and anik120 May 10, 2022 13:34
@grokspawn
Copy link
Contributor Author

grokspawn commented May 11, 2022

preview comments:

  • - default to skip patch, with hidden flag for replaces approach
  • - pull package names from olm.package -> name
  • - set default-channel in package based on the highest stable > fast > candidate channel available
  • - limit veneer to one valid bundle name (i.e. bundles of both foo and bar type generate error, while bundles of only foo are OK)
  • - get versions of bundles from the bundle renders, as olm.bundle -> properties -> olm.package -> version
  • - channel names should only include significant digits (e.g. major channel stable-v0 contains all 0.. bundles
  • - minor channels need to include a replace value from the head of the previously-versioned channel (e.g. stable-v1.1.0 should replace stable-v1.0.0 -- without crossing major version boundaries)
  • - try reverting go.mod to see if we can eliminate go.mod/go.sum/vendor changes from this PR.

later review comments:

  • - major channels should have replaces steps across minor version transitions

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 11, 2022
@grokspawn grokspawn changed the title implement opm alpha render-veneer semver [WIP] implement opm alpha render-veneer semver May 11, 2022
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 11, 2022
@grokspawn grokspawn force-pushed the grokspawn-semver-veneer-cmd branch 2 times, most recently from 14c98db to 063997d Compare May 11, 2022 19:13
@joelanford
Copy link
Member

channels need to include a replace value from the head of the previously-versioned channel

this is true

(e.g. stable-v1 should replace stable-v0 -- if defined)

but this isn't. we shouldn't include that replaces value if we're crossing over a major version number transition.


So only minor version channels will have these channel cross-over replaces edges.

@joelanford
Copy link
Member

joelanford commented May 11, 2022

should we error out if the necessary channel hasn't been generated because user did not supply any v0 bundles?

No, there should only be edges that connect to actual bundles listed in the veneer. If the veneer contains some v1.1 bundles, but no v1.0 bundles, then the leaf nodes of that v1.1 channels will all be skips and there will be no replace to a previous v1.0 bundle (because there isn't one).

@grokspawn grokspawn force-pushed the grokspawn-semver-veneer-cmd branch 4 times, most recently from 93bf7e8 to 26f502b Compare June 17, 2022 21:15
@grokspawn grokspawn force-pushed the grokspawn-semver-veneer-cmd branch from 26f502b to 3962fc8 Compare June 22, 2022 17:17
Copy link
Member

@awgreene awgreene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, no major functional changes requested. Great work!

alpha/veneer/semver/README.md Outdated Show resolved Hide resolved
alpha/veneer/semver/README.md Outdated Show resolved Hide resolved
alpha/veneer/semver/README.md Outdated Show resolved Hide resolved
alpha/veneer/semver/README.md Outdated Show resolved Hide resolved
alpha/veneer/semver/README.md Outdated Show resolved Hide resolved
alpha/veneer/semver/semver.go Outdated Show resolved Hide resolved
alpha/veneer/semver/semver.go Show resolved Hide resolved
alpha/veneer/semver/semver.go Show resolved Hide resolved
alpha/veneer/semver/semver.go Show resolved Hide resolved
alpha/veneer/semver/semver_test.go Show resolved Hide resolved
@grokspawn grokspawn force-pushed the grokspawn-semver-veneer-cmd branch 2 times, most recently from cfd56bb to 6569f5d Compare June 22, 2022 21:53
@grokspawn grokspawn requested a review from awgreene June 22, 2022 22:00
@awgreene
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 22, 2022
Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
Signed-off-by: Ankita Thomas <ankithom@redhat.com>
@grokspawn grokspawn force-pushed the grokspawn-semver-veneer-cmd branch from 6569f5d to 6ff7571 Compare June 23, 2022 14:20
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 23, 2022
Copy link
Member

@awgreene awgreene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 23, 2022
Copy link
Member

@dinhxuanvu dinhxuanvu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 23, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ankitathomas, awgreene, dinhxuanvu, grokspawn

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 23, 2022
@grokspawn grokspawn merged commit 1e6c7a7 into master Jun 23, 2022
Copy link
Contributor

@tylerslaton tylerslaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had some left-over comments after this got merged. Not blocking at all so we can address later if we feel the need.

/lgtm

Comment on lines +26 to +54
// IO structs -- BEGIN
type semverVeneerBundleEntry struct {
Image string `json:"image,omitempty"`
}

type candidateBundles struct {
Bundles []semverVeneerBundleEntry `json:"bundles,omitempty"`
}
type fastBundles struct {
Bundles []semverVeneerBundleEntry `json:"bundles,omitempty"`
}
type stableBundles struct {
Bundles []semverVeneerBundleEntry `json:"bundles,omitempty"`
}

type semverVeneer struct {
Schema string `json:"schema"`
GenerateMajorChannels bool `json:"generateMajorChannels,omitempty"`
GenerateMinorChannels bool `json:"generateMinorChannels,omitempty"`
AvoidSkipPatch bool `json:"avoidSkipPatch,omitempty"`
Candidate candidateBundles `json:"candidate,omitempty"`
Fast fastBundles `json:"fast,omitempty"`
Stable stableBundles `json:"stable,omitempty"`

pkg string `json:"-"` // the derived package name
defaultChannel string `json:"-"` // detected "most stable" channel head
}

// IO structs -- END
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd personally like to see an individual comment describing each of these struct but understand that may not be a shared opinion. My thought here is that it makes it easier for maintainers to come through later and understand how these structs are used faster.


// channel "kinds", restricted in this iteration to just these
const (
candidateChannelName string = "candidate"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can definitely be followed-up since this is an alpha command, but it is relatively trivial to add configurable channels for this so we have both these defaults and consumer-defined ones. Have thought about making a flag that we iterate over for these in a follow-up? The flag type can even be of type map[string]int like you define on line 64 making these feel pretty natural.

Copy link
Contributor Author

@grokspawn grokspawn Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of this particular veneer was to focus on and encourage the candidate < fast < stable channel set as a MVP which endorses/encourages our internal practice. "Guidelines and guardrails" is how I like to refer to it.

It wouldn't be hard, but it was counter to our goals at this stage.

We can iterate into a variant or leave it as an exercise for the operator author who needs it. Early feedback will help guide us.

alpha/veneer/semver/semver.go Show resolved Hide resolved
@grokspawn grokspawn deleted the grokspawn-semver-veneer-cmd branch June 23, 2022 18:57
@joelanford joelanford mentioned this pull request Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants