Skip to content

Commit

Permalink
fix: report correct error when task doesn't exist (knative#1915)
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <mvasek@redhat.com>
  • Loading branch information
matejvasek committed Sep 27, 2023
1 parent afb15a4 commit b68020a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/pipelines/tekton/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,14 @@ func deleteAllPipelineTemplates(f fn.Function) string {
}

func getTaskSpec(taskUrlTemplate string) (string, error) {
resp, err := http.Get(fmt.Sprintf(taskUrlTemplate, FuncRepoRef, FuncRepoBranchRef))
u := fmt.Sprintf(taskUrlTemplate, FuncRepoRef, FuncRepoBranchRef)
resp, err := http.Get(u)
if err != nil {
return "", err
}
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("cannot get task: %q bad http code: %d", u, resp.StatusCode)
}
defer resp.Body.Close()
var data map[string]any
dec := yaml.NewDecoder(resp.Body)
Expand Down

0 comments on commit b68020a

Please sign in to comment.