#293 Get and set architectures.
Merged by ralph. Opened by ralph.
get-and-set-architectures  into  master

Download 293.patch

This fixes a bug we ran into today as a part of multi-arch migrations.

First, describing the bug:

When building an image, OSBS looks at the architectures set in koji on the
'build' tag associated with the koji target of the requested build. This is
fine, normally. When a set of builds is ready to "go multi-arch", we just
start adding architectures to their build tag and suddenly, new builds produce
multiarch images.

When freshmaker comes along, it tries to rebuild based on the last shipped
image and reuses the parent image and the koji target of the last shipped
image. Now, the last shipped image's parent is single-arch (from a few months
ago), but the koji target now has a koji tag that specifies multiple
architectures. OSBS fails our build because it cannot build a multiarch build
on a single arch parent.

The fix here is to look up the architectures produced by the last-shipped build
and simply copy those into our request for the new build (just like we do with
the scm url and koji target). The architectures of the last-shipped build are
pulled from the manifest list api in the registry associated with koji.

There is a corresponding change in OSBS that allows Freshmaker to supply the
list of architectures which should be used for the new build here:
https://github.com/release-engineering/koji-containerbuild/pull/99

We're going from 1 to N architectures now, but in the future we'll make moves
again to go from N to N+1 architectures which warrants the complexity
introduced in this change.

This could use some additional test cases, but I'm out of steam for the night. Will revisit tomorrow to add those.

There's also:

'arm64': 'aarch64'

Would it be simpler to iterate over the archives of type image (I think) in Koji to figure out which arches? The benefit is that you won't need to query the registry.

One thing to note is that this change must be deployed after the corresponding osbs changes. Otherwise, all Freshmaker builds will fail with "arch-override is only allowed for scratch builds".

Will add. Thanks! metaxor may need this fix too.

Yes, but folks online last night all seemed to agreed that parsing the archive filenames was unsatisfactory.

Another approach would be to pull the metadata.json file from brew with all of the content generator data. It would have some relevant info.

I'm inclined to proceed with this approach (unless you see something scary in here w.r.t. a quay migration).

1 new commit added

  • Add arm64.

1 new commit added

  • Feature flag: disable arch overrides by default.

One thing to note is that this change must be deployed after the corresponding osbs changes.

I added a feature flag for it in 3e9a70d.

(unless you see something scary in here w.r.t. a quay migration)

Nope! Looks good as is. Staying away from metadata.json is actually a good idea :)

1 new commit added

  • Add tests for architecture discovery.

OK - tests are added. This is ready for "final" review.

The feature flag has been added, so we can merge and deploy this before OSBS's arch_override feature is in place.

:thumbsup:

As usual, loved the explanation of the PR :)

Thanks guys!

Pull-Request has been merged by ralph

Metadata