add contextcheck linter exceptions

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
Tim Ramlot 2024-05-07 12:37:04 +02:00
parent de54201f69
commit 1248be8bba
No known key found for this signature in database
GPG Key ID: 47428728E0C2878D
8 changed files with 12 additions and 4 deletions

View File

@ -46,6 +46,7 @@ func NewACMESolverCommand(_ context.Context) *cobra.Command {
return nil return nil
}, },
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
runCtx := cmd.Context() runCtx := cmd.Context()
log := logf.FromContext(runCtx) log := logf.FromContext(runCtx)

View File

@ -100,6 +100,7 @@ servers and webhook servers.`,
return nil return nil
}, },
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), cainjectorConfig) return run(cmd.Context(), cainjectorConfig)
}, },

View File

@ -110,6 +110,7 @@ to renew certificates at an appropriate time before expiry.`,
return nil return nil
}, },
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), controllerConfig) return run(cmd.Context(), controllerConfig)
}, },

View File

@ -79,6 +79,7 @@ required webhooks are reachable by the K8S API server.`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return o.Complete() return o.Complete()
}, },
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return o.Run(cmd.Context(), cmd.OutOrStdout()) return o.Run(cmd.Context(), cmd.OutOrStdout())
}, },

View File

@ -107,6 +107,7 @@ functionality for cert-manager.`,
return nil return nil
}, },
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), webhookConfig) return run(cmd.Context(), webhookConfig)
}, },

View File

@ -66,6 +66,7 @@ func NewCommandStartWebhookServer(_ context.Context, groupName string, solvers .
cmd := &cobra.Command{ cmd := &cobra.Command{
Short: "Launch an ACME solver API server", Short: "Launch an ACME solver API server",
Long: "Launch an ACME solver API server", Long: "Launch an ACME solver API server",
// nolint:contextcheck // False positive
RunE: func(c *cobra.Command, args []string) error { RunE: func(c *cobra.Command, args []string) error {
runCtx := c.Context() runCtx := c.Context()

View File

@ -1065,13 +1065,13 @@ cKK5t8N1YDX5CV+01X3vvxpM3ciYuCY9y+lSegrIEI+izRyD7P9KaZlwMaYmsBZq
By("Updating the Certificate after having added an additional dnsName") By("Updating the Certificate after having added an additional dnsName")
newDNSName := e2eutil.RandomSubdomain(s.DomainSuffix) newDNSName := e2eutil.RandomSubdomain(s.DomainSuffix)
retry.RetryOnConflict(retry.DefaultRetry, func() error { retry.RetryOnConflict(retry.DefaultRetry, func() error {
err = f.CRClient.Get(context.Background(), types.NamespacedName{Name: testCertificate.Name, Namespace: testCertificate.Namespace}, testCertificate) err = f.CRClient.Get(ctx, types.NamespacedName{Name: testCertificate.Name, Namespace: testCertificate.Namespace}, testCertificate)
if err != nil { if err != nil {
return err return err
} }
testCertificate.Spec.DNSNames = append(testCertificate.Spec.DNSNames, newDNSName) testCertificate.Spec.DNSNames = append(testCertificate.Spec.DNSNames, newDNSName)
err = f.CRClient.Update(context.Background(), testCertificate) err = f.CRClient.Update(ctx, testCertificate)
if err != nil { if err != nil {
return err return err
} }

View File

@ -393,9 +393,11 @@ func (s *Suite) Define() {
// Create the request, and delete at the end of the test // Create the request, and delete at the end of the test
By("Creating a CertificateSigningRequest") By("Creating a CertificateSigningRequest")
Expect(f.CRClient.Create(ctx, kubeCSR)).NotTo(HaveOccurred()) Expect(f.CRClient.Create(ctx, kubeCSR)).NotTo(HaveOccurred())
defer func() {
// nolint: contextcheck // This is a cleanup context // nolint: contextcheck // This is a cleanup context
f.CRClient.Delete(context.TODO(), kubeCSR) defer func() {
cleanupCtx := context.Background()
f.CRClient.Delete(cleanupCtx, kubeCSR)
}() }()
// Approve the request for testing, so that cert-manager may sign the // Approve the request for testing, so that cert-manager may sign the