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

adding a new container policy for konflux pipeline execution #1247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

acornett21
Copy link
Contributor

@acornett21 acornett21 commented Feb 27, 2025

Motivation

Today, for konflux all policies are ran and since the introduction of the Red Hat trademark violation policies, we have been unable to ship a new image to be used in konflux. This means they are missing out on some bugfixes and performance enhancements.

Changes

  • Introduce a new konflux sub command ie preflight check konflux . This cmd builds out the proper Options to be used in/by the engine.
  • Add a new PolicyKonflux and corresponding container policy with matching tests.
  • Revert HasRequiredLabelsCheck to only check for required labels.
  • Add HasProhibitedLabelsCheck to check for Red Hat Trademark violations within a containers labels, and exclude this from the PolicyKonflux.
  • Update ResolveSubmitter to also look for konflux flag so a NoopSubmitter is returned even if a user tried to provide a pyixs component/key and the konflux env.

@acornett21 acornett21 added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 27, 2025
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 27, 2025
@openshift-ci openshift-ci bot requested review from jomkz and skattoju February 27, 2025 17:02
Copy link

openshift-ci bot commented Feb 27, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: acornett21

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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 27, 2025
@coveralls
Copy link

coveralls commented Feb 27, 2025

Coverage Status

coverage: 84.507% (+0.1%) from 84.376%
when pulling 2421ae2 on acornett21:konflux_cmd
into 1adc582 on redhat-openshift-ecosystem:main.

@dcibot
Copy link

dcibot commented Feb 27, 2025

@acornett21 acornett21 added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 27, 2025
@acornett21 acornett21 changed the title adding a new konflux cmd and a new container policy for konflux adding a new container policy for konflux pipeline execution Mar 6, 2025
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 6, 2025
@dcibot
Copy link

dcibot commented Mar 6, 2025

Copy link
Contributor

@bcrochet bcrochet left a comment

Choose a reason for hiding this comment

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

Responses to some of the todos, and a suggestion about shared code.

@@ -38,6 +38,7 @@ func printChecks(w io.Writer) {
"automatically applied for container checks if preflight determines a scratch exception flag has been added to your Red Hat Connect project"))
fmt.Fprintln(w, formattedPolicyBlock("Container Scratch (Root) Exception", engine.ScratchRootContainerPolicy(context.TODO()),
"automatically applied for container checks if preflight determines scratch and root exception flags have both been added to your Red Hat Connect project"))
// todo-adam should we add konflux here?
Copy link
Contributor

Choose a reason for hiding this comment

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

My gut says no, but I'm open to the idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My gut said no as well, we'll let others chime in.

@dcibot
Copy link

dcibot commented Mar 12, 2025

@dcibot
Copy link

dcibot commented Mar 12, 2025

@acornett21 acornett21 force-pushed the konflux_cmd branch 2 times, most recently from 0af9585 to c381cfa Compare March 12, 2025 20:29
@dcibot
Copy link

dcibot commented Mar 12, 2025

Copy link
Contributor

@komish komish left a comment

Choose a reason for hiding this comment

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

Comments left in-line.

@@ -0,0 +1,9 @@
package container
Copy link
Contributor

Choose a reason for hiding this comment

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

This file seems extraneous. If you want this to be a library function that can be re-used by both "prohibited" and "required" label checks, might be better to move this to another package. Here, it feels like cruft.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bcrochet suggested this, so that it's easier to find, since I had originally kept it in the original labels check.

Copy link
Contributor

Choose a reason for hiding this comment

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

Feels a bit unnecessary to me, but if you want to keep it as a library function, that's fine. Just put it in some internal/... directory vs. here.

I'll defer to @bcrochet here, though, to decide if leaving this here is fine.


var _ check.Check = &HasProhibitedLabelsCheck{}

type HasProhibitedLabelsCheck struct{}
Copy link
Contributor

Choose a reason for hiding this comment

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

This naming is unclear to me. This check asserts that labels don't have prohibited value, which today translates into trademark violations. This check does not check that given label keys are missing, as the name might suggest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has always been a problem with our naming, I can change it to HasNoProhibitedLabelsCheck

Copy link
Contributor

Choose a reason for hiding this comment

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

Eh. I didn't catch that this was the old name. I don't love it, given what it's doing now, but I suppose I can't say much given the old name was basically this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Up to you how you want to handle this.

@dcibot
Copy link

dcibot commented Mar 14, 2025

@dcibot
Copy link

dcibot commented Mar 14, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants