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

Support disable profile bundle based on Arch #504

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

Vincent056
Copy link

Add support to disable profilebundle creation based on architecture. Disable rhcos4 on ppc64le and s390x

arch := goruntime.GOARCH
archProducts, hasArch := disableProductPerArch[arch]
// build a map of disabled products for this arch
disabledProducts := make(map[string]bool)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of building a separate map, I wonder if we can reuse the getValidPlatform function by implementing the goruntime.GOARCH check there. Maybe something like:

func getValidPlatform(p string) PlatformType {
        arch := goruntime.GOARCH
	switch {
	case strings.EqualFold(p, string(PlatformOpenShift)) && (arch == "ppc64le") :
		return PlatformOpenShiftOnPower
	case strings.EqualFold(p, string(PlatformOpenShift)) && (arch == "s390x") :
		return PlatformOpenShiftOnZ
	case strings.EqualFold(p, string(PlatformOpenShift)):
		return PlatformOpenShift
	case strings.EqualFold(p, string(PlatformEKS)):
		return PlatformEKS
	case strings.EqualFold(p, string(PlatformHyperShift)):
		return PlatformHyperShift
	case strings.EqualFold(p, string(PlatformGeneric)):
		return PlatformGeneric
	default:
		return PlatformUnknown
	}
}

Then we'd have somthing like:

defaultProductsPerPlatform = map[PlatformType][]string{
	PlatformOpenShift: {
		"rhcos4",
		"ocp4",
	},
        PlatformOpenShiftOnPower: {
		"ocp4",
	},
        PlatformOpenShiftOnZ: {
		"ocp4",
	},

Then we continue to have a single mapping for default product support.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of having disableProductPerArch to work as a filter, will we have other platforms supported on P/Z in the future?

Copy link
Member

@yuumasato yuumasato Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I also appreciate about the Lance's suggestion is the increased flexibility.
It also allows us to add/enable arch specific products, not only remove/disable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense, just updated it

@rhmdnd rhmdnd requested review from yuumasato and removed request for mrogers950 April 16, 2024 17:13
Add support to disable profilebundle creation based on architecture. Disable rhcos4 on ppc64le and s390x
Copy link

openshift-ci bot commented Apr 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhmdnd, Vincent056

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 3caabdd into ComplianceAsCode:master Apr 17, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants