Giter VIP home page Giter VIP logo

Comments (1)

varshaprasad96 avatar varshaprasad96 commented on May 20, 2024

@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.

from operator-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.