#1601 openshift: validate when applying objects
Closed 6 months ago by kevin. Opened 7 months ago by kevin.
Unknown source validate-openshift-apply  into  main

@@ -14,5 +14,5 @@

    register: object_file

  

  - name: Call `oc apply` on the copied file

-   shell: oc -n {{os_app}} apply -f /etc/openshift_apps/{{os_app}}/{{objectname}}

+   shell: oc -n {{os_app}} apply --validate=strict -f /etc/openshift_apps/{{os_app}}/{{objectname}}

    when: object_template.changed or object_template_fullpath.changed or object_file.changed

@@ -19,7 +19,7 @@

      dest=/etc/openshift_apps/{{app}}/project.yml

  

  - name: Create project

-   shell: oc apply -f /etc/openshift_apps/{{app}}/project.yml

+   shell: oc apply -f --validate=strict /etc/openshift_apps/{{app}}/project.yml

    when: "'not found' in project_exists.stderr"

  

  - name: deployer.yml

Right now if there's a yml thats indented incorrectly, but parts of it
are fine, oc apply will apply those parts that are valid and just ignore
the rest. So, lets add a --validate=strict to have it reject these
entirely, so we know they have something wrong in them and we can fix
it, rather than being confused that they didn't apply anything.

Signed-off-by: Kevin Fenzi kevin@scrye.com

Pull-Request has been closed by kevin

6 months ago