Skip to content

Analysis Template Web Provider Succeeds Irrespective Of SuccessCondition/FailureCondition When Response Body is Null Or Not JSON #4535

@satyamsareen007

Description

@satyamsareen007

Checklist:

  • I've included steps to reproduce the bug.
  • I've included the version of argo rollouts.

Describe the bug

Analysis Template Web Provider Succeeds Irrespective Of SuccessCondition/FailureCondition When Response Body is Null Or Not JSON

I think this is the line in code that returns success upon not finding the correct JSON
https://github.com/argoproj/argo-rollouts/blob/master/metricproviders/webmetric/webmetric.go#L135

	err = json.Unmarshal(bodyBytes, &data)
	if err != nil {
		// non JSON body return as string
		return string(bodyBytes), v1alpha1.AnalysisPhaseSuccessful, nil
	}

To Reproduce

We have the following AnalysisTemplate that hits the health endpoint of our service. The health endpoint is a very basic health check; it returns a 200 response code with no body. The successCondition is set to compare the result with a value, in our case fail123 to fail the AnalysisTemplate purposely, but it succeeds irrespective of what we have in the successCondition.

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: <template-name>
  namespace: <namespace>
spec:
  metrics:
  - name: ingester-canary-experiment-health
    successCondition: result == 'fail123'
    provider:
      web:
        url: "http://<service-endpoint>/health"
        timeoutSeconds: 20

Expected behavior

The AnalysisTemplate should have failed if successCondition doesn't match.

Screenshots

Version

1.8.3

Logs

Nothing suspicious in the logs


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions