-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.Denotes an issue or PR that has aged beyond stale and will be auto-closed.needs discussion
Milestone
Description
As a follow up of #3912
Description
IMO we could to do:
By("replacing scorecard-test image to use the dev tag")
const scorecardImage :="quay.io/operator-framework/scorecard-test:master"
const scorecardImageReplace :="quay.io/operator-framework/scorecard-test:dev"a
err = testutils.ReplaceInAllFilesFromTree(filepath.Join(tc.Dir, "bundle"), scorecardImage,scorecardImageReplace)
Expect(err).NotTo(HaveOccurred())
err = testutils.ReplaceInAllFilesFromTree(filepath.Join(tc.Dir, "config", "scorecard"), scorecardImage, scorecardImageReplace)
Expect(err).NotTo(HaveOccurred())
// ReplaceInAllFiles replaces all instances of old with new in the files of a directory and its subdirectories.
func ReplaceInAllFilesFromTree(projectPath, old, new string) error {
err := filepath.Walk(projectPath,
func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() {
ReplaceInFile(path, old, new)
}
return nil
})
if err != nil {
return err
}
return nil
}
Reasons/Motivation
The above code will ensure that we are always replacing ALL places. Note that in the future we will build the bundle before in the samples and then, we will do this replace just for the e2e tests.
Also, note that it is very easy we add new scaffolds and just forget that we need to replace the images. So, I think it is better we add the func that will replace ALL in a tree as suggested above for we do not end up by mistake in this situation.
Metadata
Metadata
Assignees
Labels
lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.Denotes an issue or PR that has aged beyond stale and will be auto-closed.needs discussion