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

[SDK Stability] Add plugin-specific scaffolding test interface to decide if a plugin version should be updated or not #6738

Closed
itroyano opened this issue May 1, 2024 · 5 comments
Labels
area/testing Issue related to testing the operator-sdk and subcomponents help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Milestone

Comments

@itroyano
Copy link

itroyano commented May 1, 2024

Feature Request

Describe the problem you need a feature to resolve.

Currently a plugin can fail on basic scaffolding operator-sdk init --plugins=<plugin> returning 1 and/or creating no files, or fail partially creating an incomplete operator project which doesn't meet that specific plugin's requirements.

Describe the solution you'd like.

Add a mechanism in CI (e.g. on pull request) to test any current or future plugin for

  1. Basic scaffolding and exit code 0.
  2. Advanced / plugin-specific scaffolding to be implemented or delegated to be run by the plugin itself (?).

If a plugin passes both criteria - update its version in go.mod and continue to test other plugins and components.
otherwise reject the plugin version, keep the existing one, and continue to test other plugins and components.

Optionally - bot creates an issue in the repo of the plugin, so maintainers can take a look.

@itroyano itroyano changed the title [SDK Stability] Add plugin-specific CI scaffolding test interface to decide if a plugin version should be updated or not [SDK Stability] Add plugin-specific scaffolding test interface to decide if a plugin version should be updated or not May 1, 2024
@varshaprasad96
Copy link
Member

@itroyano Thanks for raising the issue. Some info on how this is done today:

When a new plugin is released (for ex. go/) and we would like to pull that into SDK, the developer:

  1. Creates a new branch and tries updating the go.mod.
  2. Updates the template for scaffolding plugin in cli.go -
    gov2Bundle, _ := plugin.NewBundleWithOptions(
  3. After which, the testdata (https://github.com/operator-framework/operator-sdk/tree/de40e5091cc33bbd08592aa1da0007d9bfad6eb9/testdata) is updated using make generate. During the updation of testdata, the operator-sdk command then calls in the new plugin version and scaffolds out the files using the operator-sdk <commands> (
    flag.StringVar(&binaryPath, "bin", testutils.BinaryName, "Binary path that should be used")
    flag.Parse()
    // Make the binary path absolute if pathed, for reproducibility and debugging purposes.
    if dir, _ := filepath.Split(binaryPath); dir != "" {
    tmp, err := filepath.Abs(binaryPath)
    if err != nil {
    log.Fatalf("Failed to make binary path %q absolute: %v", binaryPath, err)
    }
    binaryPath = tmp
    }
    wd, err := os.Getwd()
    if err != nil {
    log.Fatal(err)
    }
    // samplesPath is the path where all samples should be generated
    samplesPath := filepath.Join(wd, "testdata")
    log.Infof("writing sample directories under %s", samplesPath)
    log.Infof("creating Helm Memcached Sample")
    helm.GenerateMemcachedSamples(binaryPath, samplesPath)
    log.Infof("creating Go Memcached Sample with Webhooks")
    golang.GenerateMemcachedSamples(binaryPath, samplesPath)
    ).

With this change if there is any issue during scaffolding the tests do not pass, and CI errors. There is no automation here though, but we do catch scaffolding issues before merging anything.

This works well currently with Helm and Go plugins. But with ansible (recently moved out external plugin), generation of testdata gets a bit complicated since we scaffold the templates in the external repository: https://github.com/operator-framework/ansible-operator-plugins/blob/4e8c78d21b6017ab0a280e3d274d97edf50b8fc4/hack/generate/samples/ansible/generate.go#L107. The scaffolded operator is tested in the plugin repository for any plugin update (https://github.com/operator-framework/ansible-operator-plugins/blob/main/test/e2e/ansible/suite_test.go) before updating it in SDK.

Having improvements in testing external scaffolds would be helpful, however to do so we need to discuss on how we would like to split tests between the external plugin and SDK repos.

@acornett21 acornett21 added area/testing Issue related to testing the operator-sdk and subcomponents help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels May 7, 2024
@acornett21 acornett21 added this to the Backlog milestone May 7, 2024
@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 6, 2024
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 5, 2024
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this as completed Oct 6, 2024
Copy link

openshift-ci bot commented Oct 6, 2024

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Issue related to testing the operator-sdk and subcomponents help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

4 participants