{"id":5701,"date":"2015-11-03T12:43:25","date_gmt":"2015-11-03T11:43:25","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/hayek\/jochen\/wp\/blog-en\/?p=5701"},"modified":"2015-11-03T12:43:25","modified_gmt":"2015-11-03T11:43:25","slug":"jenkins-build-execute-shell-exit-codes","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2015\/11\/03\/jenkins-build-execute-shell-exit-codes\/","title":{"rendered":"Jenkins: Build \/ &#8220;Execute shell&#8221; \/ exit codes &#8230;"},"content":{"rendered":"<p>\t\t\t\tFrom the help section of &#8220;Execute Shell&#8221;:<\/p>\n<blockquote><p>By default, the shell will be invoked with the &#8220;<span style=\"text-decoration: underline\">-ex<\/span>&#8221; option. So all of the commands are printed before being executed, and the build is considered a failure if any of the commands exits with a non-zero exit code. Again, add the\u00a0<tt>#!\/bin\/...<\/tt> line to change this behavior.<\/p><\/blockquote>\n<p>Funny, &#8220;<span style=\"text-decoration: underline\">set -e<\/span>&#8221; (&#8220;exit immediately if &#8230; exits with a non-zero status&#8221;) is being applied, just as it is\u00a0with good old &#8220;make&#8221;.<\/p>\n<p>There are pros and cons for that. But in the end I can seriously not live with it, because I can&#8217;t have a single file or directory test, that (<span style=\"text-decoration: underline\">expectedly<\/span>!) exits non-zero.<\/p>\n<p>Another funny aspect (the bash man page says):<\/p>\n<blockquote><p>Subshells spawned to execute command substitution inherit the value of the <span style=\"text-decoration: underline\">-e<\/span> option from the parent shell. When not in <span style=\"text-decoration: underline\">posix mode<\/span>, bash <strong>clears<\/strong> the <span style=\"text-decoration: underline\">-e<\/span> option in such subshells.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>From the help section of &#8220;Execute Shell&#8221;: By default, the shell will be invoked with the &#8220;-ex&#8221; option. So all of the commands are printed before being executed, and the build is considered a failure if any of the commands exits with a non-zero exit code. Again, add the\u00a0#!\/bin\/&#8230; line to change this behavior. Funny, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[666],"tags":[],"class_list":["post-5701","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-1tX","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/5701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=5701"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/5701\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=5701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=5701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=5701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}