Autodesk / Autodesk/shore

False positive: shore save returns 200 instead of error on missing application

Open
#18 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
21
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### Pre Requisites

* [x] Put an X between the brackets on this line if you have done all of the following:
* Checked the FAQs on the message board for common solutions:
* Checked that your issue isn't already filed:

### Description

Original Author: @slonokot
When `shore save -vvv` is run against spinnaker for a pipeline name `Secrets stages tests` and application `infradevx` that doesn't exist (not `infradevex`) shore returns `200` HTTP code and no errors are reflected in the logs:

### Steps to Reproduce

```
shore save -vvv
DEBU[0000] Lazy Loading project path
DEBU[0000] Use `Getwd` (pwd) local path
INFO[0000] Render function started
DEBU[0000] GetProjectPath
DEBU[0000] Lazy Loading project path
DEBU[0000] Use `Getwd` (pwd) local path
DEBU[0000] GetProjectPath returned /test-secrets-pipeline
DEBU[0000] Args returned:
{\"application\":\"secrets-test\",\"example_value\":\"World\",\"pipeline\":\"secretstest-pipeline\"}
INFO[0000] calling Renderer.Render with projectPath /test-secrets-pipeline and renderArgs {\"application\":\"secrets-test\",\"example_value\":\"World\",\"pipeline\":\"secretstest-pipeline\"}
DEBU[0000] Renderer.Render returned successfully
INFO[0000] Calling Backend.SavePipeline
INFO[0001] Searching for Triggers with PipelineID needing replacement
INFO[0001] Searching for Stages with PipelineIDs needing replacement
INFO[0001] Pipeline Secrets stages tests found with id 5180d734-42de-443d-bebd-beab3214a6c1 in application infradevx
INFO[0003] Saved already existing pipeline with ID5180d734-42de-443d-bebd-beab3214a6c1
INFO[0003] Backend.SavePipeline returned
&{200 200 HTTP/1.1 1 1 map[Access-Control-Allow-Credentials:[true] Access-Control-Allow-Headers:[x-requested-with, content-type, authorization, X-RateLimit-App, X-Spinnaker-Priority] Access-Control-Allow-Methods:[POST, GET, OPTIONS, DELETE, PUT, PATCH] Access-Control-Allow-Origin:[*] Access-Control-Expose-Headers:[X-AUTH-REDIRECT-URL] Access-Control-Max-Age:[3600] Cache-Control:[no-cache, no-store, max-age=0, must-revalidate] Content-Length:[0] Date:[Sun, 29 Aug 2021 11:46:30 GMT] Expires:[0] Pragma:[no-cache] Strict-Transport-Security:[max-age=31536000 ; includeSubDomains] Vary:[Origin Access-Control-Request-Method Access-Control-Request-Headers] X-Content-Type-Options:[nosniff] X-Frame-Options:[DENY] X-Spinnaker-Request-Id:[51bebf4c-6246-4ae7-b744-b3b6db230ae7] X-Xss-Protection:[1; mode=block]] {} 0 [] false false map[] 0xc00011b800 0xc0000da6e0}
```

```
shore --version
0.0.8
```

**Expected behavior:**

**Actual behavior:**

**Reproduces how often:**

### Versions

### Additional Information

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with `shore save -vvv` using a nonexistent application, then trace the `Backend.SavePipeline` call and its handling of the Spinnaker response. Add or update coverage for the missing-application case so the command reports an error instead of treating the HTTP 200 response as a successful save.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.