-
Notifications
You must be signed in to change notification settings - Fork 38
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
PLNSRVCE-431: Adds annotation to allow skipping the generation of PaC resources #57
PLNSRVCE-431: Adds annotation to allow skipping the generation of PaC resources #57
Conversation
When a Component is created, the build-service checks for the related Git repository to create/update the resources in the .tekton folder if needed. Skipping it is necessary in cases of repositories in which we want to manage the pipelines-as-code configuration manually. Signed-off-by: Bruno Pimentel <bpimente@redhat.com>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: brunoapimentel The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
just a coule of minor items @brunoapimentel
@@ -63,6 +63,8 @@ const ( | |||
|
|||
PartOfLabelName = "app.kubernetes.io/part-of" | |||
PartOfAppStudioLabelValue = "appstudio" | |||
|
|||
skipPacResourceGenerationAnnotation = "skip-pipelines-as-code-resource-generation" |
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.
skipPacResourceGenerationAnnotation = "skip-pipelines-as-code-resource-generation" | |
skipPacResourceGenerationAnnotation = "com.redhat.appstudio/skip-pipelines-as-code-resource-generation" |
it is better to qualify labels / annotations with a group designation ... my suggestion reuses the group used for the initial build annotation
bundle := gitopsprepare.PrepareGitopsConfig(ctx, r.NonCachingClient, component).BuildBundle | ||
mrUrl, err := ConfigureRepositoryForPaC(component, pacSecret.Data, webhookTargetUrl, webhookSecretString, bundle) | ||
if err != nil { | ||
log.Error(err, "failed to setup repository for Pipelines as Code") |
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.
I've noticed recently in jvm-build-service that with our default level of logging, controller runtime will log the generation of the event in the pod log as well; so you'll end up with essentially duplicate logs with this one ^^ and the event below.
Either in a manual bringup, or investigating the build-service logs collected in the artifacts of the e2e test, you should confirm if that is the case with build-service, and if so, just go with the event here.
@mmorhun FYI
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.
Yes, I can confirm, that events are logged as well and we have duplicates in logs (my mistake before).
@@ -104,7 +104,7 @@ func deleteApplication(resourceKey types.NamespacedName) { | |||
} | |||
|
|||
// createComponent creates sample component resource and verifies it was properly created | |||
func createComponentForPaCBuild(componentLookupKey types.NamespacedName) { | |||
func createComponentForPaCBuild(componentLookupKey types.NamespacedName, skipPacResourceGeneration bool) { |
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.
I wouldn't go with a parameter here because we need it only in one test. Please recreate component in the test itself as it was done in other specific cases.
@@ -757,4 +757,42 @@ var _ = Describe("Component initial build controller", func() { | |||
deleteComponentInitialPipelineRuns(componentKey) | |||
}) | |||
}) | |||
|
|||
Context("Test skipping of Pipelines as Code resources generation", func() { |
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.
Does it make sense to have a separate Context for this test?
@brunoapimentel: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
In order to migrate the components in the infra-deployments repository to use HAS Application/Component CRs, we need to avoid having the build-service spamming PRs for each time a new Component is created when a new cluster is bootrstraped.
This PR allows this behavior to be skipped in case an annotation is set in the related Component CR.