diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7c48ee8f..1da2420f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -73,6 +73,8 @@ jobs: run: make deps # Ensure that generated files were committed. + # It can help us determine, that the code is in the intermediate state, which should not be tested. + # Thus, heavy jobs like creating a kind cluster and testing / linting will be skipped. - name: Verify run: make verify diff --git a/connector/openshift/openshift.go b/connector/openshift/openshift.go index d0585b11..99d1b5b2 100644 --- a/connector/openshift/openshift.go +++ b/connector/openshift/openshift.go @@ -82,11 +82,11 @@ func (c *Config) OpenWithHTTPClient(id string, logger log.Logger, httpClient *http.Client, ) (conn connector.Connector, err error) { ctx, cancel := context.WithCancel(context.Background()) + defer cancel() wellKnownURL := strings.TrimSuffix(c.Issuer, "/") + wellKnownURLPath req, err := http.NewRequest(http.MethodGet, wellKnownURL, nil) if err != nil { - cancel() return nil, fmt.Errorf("failed to create a request to OpenShift endpoint %w", err) } @@ -110,14 +110,12 @@ func (c *Config) OpenWithHTTPClient(id string, logger log.Logger, resp, err := openshiftConnector.httpClient.Do(req.WithContext(ctx)) if err != nil { - cancel() return nil, fmt.Errorf("failed to query OpenShift endpoint %w", err) } defer resp.Body.Close() if err := json.NewDecoder(resp.Body).Decode(&metadata); err != nil { - cancel() return nil, fmt.Errorf("discovery through endpoint %s failed to decode body: %w", wellKnownURL, err) }