Hide Forgot
Description of problem: oc process does not emit a non-zero exit code when the template contains an invalid label value Version-Release number of selected component (if applicable): oc v1.1.6 kubernetes v1.2.0-36-g4a3f9c5 How reproducible: Always Steps to Reproduce: 1. Download https://raw.githubusercontent.com/openshift-qe/v3- testfiles/master/build/ruby22rhel7-template-sti.json 2. Modify the very last 'labels' line (line 479) with an invalid value, like: "label!!": "value1" 3. run oc process on that file: oc process -f ruby22rhel7-template-sti.json error processing the template "ruby-helloworld-sample": Template "ruby-helloworld-sample" is invalid: labels: Invalid value: "label!!": must be a qualified name (at most 63 characters, matching regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]), with an optional DNS subdomain prefix (at most 253 characters, matching regex [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*) and slash (/): e.g. "MyName" or "example.com/MyName" { "kind": "List", "apiVersion": "v1", "metadata": {}, "items": null } [21:42:50] INFO> Exit Status: 0 4. Check the exit status: echo $? Actual results: The command returns a zero exit code, even after failure Expected results: A non-zero exit code Additional info:
pretty sure Steve is already fixing this here: https://github.com/openshift/origin/pull/8049
Tested today on master, seems to work as desired: $ oc version oc v1.4.0-alpha.0+33f3e8f kubernetes v1.4.0+776c994 features: Basic-Auth Server https://10.13.137.202:8443 openshift v1.4.0-alpha.0 kubernetes v1.4.0-beta.3+d19513f $ wget https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/build/ruby22rhel7-template-sti.json $ vim ruby22rhel7-template-sti.json # add "label!!": "value1" to the last JSON stanza as described above $ oc process -f ruby22rhel7-template-sti.json error: error processing the template "ruby-helloworld-sample": Template "ruby-helloworld-sample" is invalid: labels: Invalid value: "label!!": name part must match the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or 'my.name' or '123-abc') $ echo $? 1
Verified with: $ oc version oc v1.3.0 kubernetes v1.3.0+52492b4 oc v1.4.0-alpha.0+43d24b2 kubernetes v1.4.0+776c994 $ oc process -f ruby22rhel7-template-sti.json error: error processing the template "ruby-helloworld-sample": Template "ruby-helloworld-sample" is invalid: labels: Invalid value: "label!!!": name part must match the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or 'my.name' or '123-abc') $ echo $? 1