From 9e2b0cda9db20c5c1281f85d5f1cb3b45c975e44 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Wed, 8 Nov 2023 14:11:02 -0800 Subject: [PATCH] openshift: validate when applying objects 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 --- roles/openshift/object/tasks/main.yml | 2 +- roles/openshift/project/tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/openshift/object/tasks/main.yml b/roles/openshift/object/tasks/main.yml index 0ed198e306..28a0487753 100644 --- a/roles/openshift/object/tasks/main.yml +++ b/roles/openshift/object/tasks/main.yml @@ -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 diff --git a/roles/openshift/project/tasks/main.yml b/roles/openshift/project/tasks/main.yml index 8e84ea53b5..fbcec21777 100644 --- a/roles/openshift/project/tasks/main.yml +++ b/roles/openshift/project/tasks/main.yml @@ -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