Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse responses and errors better #2

Open
lispyclouds opened this issue May 30, 2019 · 1 comment
Open

Parse responses and errors better #2

lispyclouds opened this issue May 30, 2019 · 1 comment

Comments

@lispyclouds
Copy link
Member

No description provided.

@TimoKramer
Copy link
Member

in case of a schema-error there should be a better error message:
actual:

./target/default+uberjar/wendy pipeline create -c docs/build_planned.toml                                                               ~/projects/wendy
{:failed? true, :reason "\"{\\\"schema\\\":\\\"{:steps [{:cmd java.lang.String, #schema.core.OptionalKey{:k :needs_resource} java.lang.String, #schema.core.OptionalKey{:k :produces_artifact} {:name java.lang.String, :path java.lang.String, :store java.lang.String}}], :image java.lang.String, #schema.core.OptionalKey{:k :vars} {clojure.lang.Keyword java.lang.String}, #schema.core.OptionalKey{:k :resources} [{:name java.lang.String, :params {clojure.lang.Keyword java.lang.String}, :type (enum \\\\\\\"external\\\\\\\"), :provider java.lang.String}]}\\\",\\\"errors\\\":{\\\"steps\\\":[{\\\"needs-resource\\\":\\\"disallowed-key\\\",\\\"produces-artifact\\\":\\\"disallowed-key\\\"}],\\\"resources\\\":[{\\\"params\\\":\\\"missing-required-key\\\",\\\"type\\\":\\\"(not (#{\\\\\\\"external\\\\\\\"} \\\\\\\"artifact\\\\\\\"))\\\"}]},\\\"type\\\":\\\"compojure.api.exception/request-validation\\\",\\\"coercion\\\":\\\"schema\\\",\\\"value\\\":{\\\"steps\\\":[{\\\"needs-resource\\\":\\\"my-jar\\\",\\\"cmd\\\":\\\"make deb-package\\\",\\\"produces-artifact\\\":{\\\"path\\\":\\\"bob.deb\\\",\\\"name\\\":\\\"dev-installer\\\"}}],\\\"image\\\":\\\"debian:latest\\\",\\\"resources\\\":[{\\\"name\\\":\\\"my-jar\\\",\\\"type\\\":\\\"artifact\\\",\\\"provider\\\":\\\"dev.build-and-push\\\"}]},\\\"in\\\":[\\\"request\\\",\\\"body-params\\\"]}\"", :status 400}
{:failed? true, :reason "\"{\\\"schema\\\":\\\"{:steps [{:cmd java.lang.String, #schema.core.OptionalKey{:k :needs_resource} java.lang.String, #schema.core.OptionalKey{:k :produces_artifact} {:name java.lang.String, :path java.lang.String, :store java.lang.String}}], :image java.lang.String, #schema.core.OptionalKey{:k :vars} {clojure.lang.Keyword java.lang.String}, #schema.core.OptionalKey{:k :resources} [{:name java.lang.String, :params {clojure.lang.Keyword java.lang.String}, :type (enum \\\\\\\"external\\\\\\\"), :provider java.lang.String}]}\\\",\\\"errors\\\":{\\\"steps\\\":[{\\\"cmd\\\":\\\"missing-required-key\\\",\\\"in-parallel\\\":\\\"disallowed-key\\\"}],\\\"env\\\":\\\"disallowed-key\\\"},\\\"type\\\":\\\"compojure.api.exception/request-validation\\\",\\\"coercion\\\":\\\"schema\\\",\\\"value\\\":{\\\"steps\\\":[{\\\"in-parallel\\\":[{\\\"needs-resource\\\":\\\"my-source-code\\\",\\\"cmd\\\":\\\"lein uberjar\\\",\\\"produces-artifact\\\":{\\\"path\\\":\\\"target/bob-standalone.jar\\\",\\\"name\\\":\\\"jar\\\"}},{\\\"needs-resource\\\":\\\"my-source-code\\\",\\\"cmd\\\":\\\"lein deploy clojars\\\"}]}],\\\"env\\\":[{\\\"password\\\":\\\"test\\\",\\\"user\\\":\\\"test\\\"}],\\\"image\\\":\\\"clojure:latest\\\",\\\"resources\\\":[{\\\"name\\\":\\\"my-source\\\",\\\"params\\\":{\\\"url\\\":\\\"https://github.com/bob-cd/bob.git\\\",\\\"branch\\\":\\\"master\\\"},\\\"type\\\":\\\"external\\\",\\\"provider\\\":\\\"git\\\"}]},\\\"in\\\":[\\\"request\\\",\\\"body-params\\\"]}\"", :status 400}
{:failed? true, :reason "\"{\\\"schema\\\":\\\"{:steps [{:cmd java.lang.String, #schema.core.OptionalKey{:k :needs_resource} java.lang.String, #schema.core.OptionalKey{:k :produces_artifact} {:name java.lang.String, :path java.lang.String, :store java.lang.String}}], :image java.lang.String, #schema.core.OptionalKey{:k :vars} {clojure.lang.Keyword java.lang.String}, #schema.core.OptionalKey{:k :resources} [{:name java.lang.String, :params {clojure.lang.Keyword java.lang.String}, :type (enum \\\\\\\"external\\\\\\\"), :provider java.lang.String}]}\\\",\\\"errors\\\":{\\\"steps\\\":[{\\\"cmd\\\":\\\"missing-required-key\\\",\\\"in-parallel\\\":\\\"disallowed-key\\\"}]},\\\"type\\\":\\\"compojure.api.exception/request-validation\\\",\\\"coercion\\\":\\\"schema\\\",\\\"value\\\":{\\\"steps\\\":[{\\\"in-parallel\\\":[{\\\"needs-resource\\\":\\\"my-source-code\\\",\\\"cmd\\\":\\\"lein test :unit\\\"},{\\\"needs-resource\\\":\\\"my-source-code\\\",\\\"cmd\\\":\\\"lein test :integration\\\"}]}],\\\"image\\\":\\\"clojure:latest\\\",\\\"resources\\\":[{\\\"name\\\":\\\"my-source\\\",\\\"params\\\":{\\\"url\\\":\\\"https://github.com/bob-cd/bob.git\\\",\\\"branch\\\":\\\"master\\\"},\\\"type\\\":\\\"external\\\",\\\"provider\\\":\\\"git\\\"}]},\\\"in\\\":[\\\"request\\\",\\\"body-params\\\"]}\"", :status 400}
{:failed? true, :reason "\"{\\\"schema\\\":\\\"{:steps [{:cmd java.lang.String, #schema.core.OptionalKey{:k :needs_resource} java.lang.String, #schema.core.OptionalKey{:k :produces_artifact} {:name java.lang.String, :path java.lang.String, :store java.lang.String}}], :image java.lang.String, #schema.core.OptionalKey{:k :vars} {clojure.lang.Keyword java.lang.String}, #schema.core.OptionalKey{:k :resources} [{:name java.lang.String, :params {clojure.lang.Keyword java.lang.String}, :type (enum \\\\\\\"external\\\\\\\"), :provider java.lang.String}]}\\\",\\\"errors\\\":{\\\"steps\\\":[{\\\"cmd\\\":\\\"missing-required-key\\\",\\\"in-parallel\\\":\\\"disallowed-key\\\"},null],\\\"resources\\\":[{\\\"params\\\":\\\"missing-required-key\\\",\\\"type\\\":\\\"(not (#{\\\\\\\"external\\\\\\\"} \\\\\\\"artifact\\\\\\\"))\\\"},{\\\"params\\\":\\\"missing-required-key\\\",\\\"type\\\":\\\"(not (#{\\\\\\\"external\\\\\\\"} \\\\\\\"artifact\\\\\\\"))\\\"}]},\\\"type\\\":\\\"compojure.api.exception/request-validation\\\",\\\"coercion\\\":\\\"schema\\\",\\\"value\\\":{\\\"steps\\\":[{\\\"in-parallel\\\":[{\\\"needs-resource\\\":\\\"my-sign\\\",\\\"cmd\\\":\\\"scp [email protected] *.sig\\\"},{\\\"needs-resource\\\":\\\"my-jar\\\",\\\"cmd\\\":\\\"scp [email protected] *.jar\\\"}]},{\\\"cmd\\\":\\\"ansible deploy prod\\\"}],\\\"image\\\":\\\"ansible:latest\\\",\\\"resources\\\":[{\\\"name\\\":\\\"my-jar\\\",\\\"type\\\":\\\"artifact\\\",\\\"provider\\\":\\\"dev.build-and-push\\\"},{\\\"name\\\":\\\"my-sign\\\",\\\"type\\\":\\\"artifact\\\",\\\"provider\\\":\\\"stable.sign\\\"}]},\\\"in\\\":[\\\"request\\\",\\\"body-params\\\"]}\"", :status 400}
{:failed? true, :reason "\"{\\\"schema\\\":\\\"{:steps [{:cmd java.lang.String, #schema.core.OptionalKey{:k :needs_resource} java.lang.String, #schema.core.OptionalKey{:k :produces_artifact} {:name java.lang.String, :path java.lang.String, :store java.lang.String}}], :image java.lang.String, #schema.core.OptionalKey{:k :vars} {clojure.lang.Keyword java.lang.String}, #schema.core.OptionalKey{:k :resources} [{:name java.lang.String, :params {clojure.lang.Keyword java.lang.String}, :type (enum \\\\\\\"external\\\\\\\"), :provider java.lang.String}]}\\\",\\\"errors\\\":{\\\"steps\\\":[{\\\"needs-resource\\\":\\\"disallowed-key\\\",\\\"produces-artifact\\\":\\\"disallowed-key\\\"}],\\\"resources\\\":[{\\\"params\\\":\\\"missing-required-key\\\",\\\"type\\\":\\\"(not (#{\\\\\\\"external\\\\\\\"} \\\\\\\"artifact\\\\\\\"))\\\"}]},\\\"type\\\":\\\"compojure.api.exception/request-validation\\\",\\\"coercion\\\":\\\"schema\\\",\\\"value\\\":{\\\"steps\\\":[{\\\"needs-resource\\\":\\\"my-jar\\\",\\\"cmd\\\":\\\"gpg --output bob.sig --sign bob-standalone.jar\\\",\\\"produces-artifact\\\":{\\\"path\\\":\\\"bob.sig\\\",\\\"name\\\":\\\"my-sign\\\"}}],\\\"image\\\":\\\"debian:latest\\\",\\\"resources\\\":[{\\\"name\\\":\\\"my-jar\\\",\\\"type\\\":\\\"artifact\\\",\\\"provider\\\":\\\"dev.build-and-push\\\"}]},\\\"in\\\":[\\\"request\\\",\\\"body-params\\\"]}\"", :status 400}

should be in this case:

{errors: [{needs-resource: disallowed-key}, {produces-artifact: disallowed-key}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants