-
Notifications
You must be signed in to change notification settings - Fork 4.8k
OCPBUGS-61465: Updated openshift-tests images to utilize mapped images from external binary #30873
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -511,7 +511,7 @@ func (b *TestBinary) RunTests(ctx context.Context, timeout time.Duration, env [] | |||||||||||||||||||||||||||||||||
| return results | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| func (b *TestBinary) ListImages(ctx context.Context) (ImageSet, error) { | ||||||||||||||||||||||||||||||||||
| func (b *TestBinary) ListImages(ctx context.Context) ([]extension.Image, error) { | ||||||||||||||||||||||||||||||||||
| start := time.Now() | ||||||||||||||||||||||||||||||||||
| binName := filepath.Base(b.binaryPath) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
@@ -522,23 +522,14 @@ func (b *TestBinary) ListImages(ctx context.Context) (ImageSet, error) { | |||||||||||||||||||||||||||||||||
| return nil, fmt.Errorf("failed running '%s list': %w\nOutput: %s", b.binaryPath, err, output) | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| var images []Image | ||||||||||||||||||||||||||||||||||
| var images []extension.Image | ||||||||||||||||||||||||||||||||||
| err = json.Unmarshal(output, &images) | ||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||
| return nil, err | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| result := make(ImageSet, len(images)) | ||||||||||||||||||||||||||||||||||
| for _, image := range images { | ||||||||||||||||||||||||||||||||||
| imageConfig := k8simage.Config{} | ||||||||||||||||||||||||||||||||||
| imageConfig.SetName(image.Name) | ||||||||||||||||||||||||||||||||||
| imageConfig.SetVersion(image.Version) | ||||||||||||||||||||||||||||||||||
| imageConfig.SetRegistry(image.Registry) | ||||||||||||||||||||||||||||||||||
| result[k8simage.ImageID(image.Index)] = imageConfig | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| logrus.Infof("Listed %d test images for %q in %v", len(images), binName, time.Since(start)) | ||||||||||||||||||||||||||||||||||
| return result, nil | ||||||||||||||||||||||||||||||||||
| return images, nil | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // ExtractAllTestBinaries determines the optimal release payload to use, and extracts all the external | ||||||||||||||||||||||||||||||||||
|
|
@@ -727,9 +718,9 @@ func (binaries TestBinaries) Info(ctx context.Context, parallelism int) ([]*Exte | |||||||||||||||||||||||||||||||||
| return infos, nil | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| func (binaries TestBinaries) ListImages(ctx context.Context, parallelism int) ([]ImageSet, error) { | ||||||||||||||||||||||||||||||||||
| func (binaries TestBinaries) ListImages(ctx context.Context, parallelism int) ([]extension.Image, error) { | ||||||||||||||||||||||||||||||||||
| var ( | ||||||||||||||||||||||||||||||||||
| allImages []ImageSet | ||||||||||||||||||||||||||||||||||
| allImages []extension.Image | ||||||||||||||||||||||||||||||||||
| mu sync.Mutex | ||||||||||||||||||||||||||||||||||
| wg sync.WaitGroup | ||||||||||||||||||||||||||||||||||
| errCh = make(chan error, len(binaries)) | ||||||||||||||||||||||||||||||||||
|
|
@@ -765,12 +756,12 @@ func (binaries TestBinaries) ListImages(ctx context.Context, parallelism int) ([ | |||||||||||||||||||||||||||||||||
| continue // Skip self - only external binaries need to be queried for images | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| imageConfig, err := binary.ListImages(ctx) | ||||||||||||||||||||||||||||||||||
| images, err := binary.ListImages(ctx) | ||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||
| errCh <- err | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| mu.Lock() | ||||||||||||||||||||||||||||||||||
| allImages = append(allImages, imageConfig) | ||||||||||||||||||||||||||||||||||
| allImages = append(allImages, images...) | ||||||||||||||||||||||||||||||||||
| mu.Unlock() | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+759
to
765
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing When Note: The same pattern exists at Line 824-826 in Proposed fix images, err := binary.ListImages(ctx)
if err != nil {
errCh <- err
+ continue
}
mu.Lock()
allImages = append(allImages, images...)
mu.Unlock()📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential index mismatch between
defaultImageSetsandupdatedImageSets.When
image.Mappedisnil(Line 202), the image is added todefaultImageSetsbut not toupdatedImageSets. This creates a size mismatch between the two slices.Later at Lines 270-272, the code iterates over
updatedImageSetsusing indexiand accessesdefaultImageSets[i][imageID]:If
defaultImageSetshas more entries thanupdatedImageSets(because some images lackMappeddata), accessingdefaultImageSets[i]won't correspond to the correct original image forupdatedImageSets[i].Consider either:
updatedImageSets(using the original config as a fallback whenMappedis nil), orProposed fix: Always populate updatedImageSets
// Only add to default and mapped if original image passes exceptions if !imageMatchesExceptions(origImageConfig, exceptions) { defaultImageSets = append(defaultImageSets, initialSet) if image.Mapped != nil { mappedSet := extensions.ImageSet{ imageID: convertImageToImageConfig(*image.Mapped), } updatedImageSets = append(updatedImageSets, mappedSet) + } else { + // Use original config as fallback when no mapping exists + updatedImageSets = append(updatedImageSets, initialSet) } }🤖 Prompt for AI Agents