From 231fc8303c25da35dea851565bb1889d0422b590 Mon Sep 17 00:00:00 2001 From: Sidhartha Premkumar Date: Apr 22 2020 13:22:32 +0000 Subject: Assert required vars at start of role --- diff --git a/roles/c3i/defaults/main.yml b/roles/c3i/defaults/main.yml index ef9bb07..17a5021 100644 --- a/roles/c3i/defaults/main.yml +++ b/roles/c3i/defaults/main.yml @@ -2,7 +2,7 @@ # defaults file for c3i # Name of component -c3i_component: +# c3i_component: # List of images for promotion workflow c3i_images_for_promotion: @@ -32,9 +32,9 @@ c3i_integration_test_custom_parameters: [] # Email address for notification c3i_mail_address: # Path to Jenkinsfile snippet for premerge and postmerge workflow -c3i_build_and_test_snippet: +# c3i_build_and_test_snippet: # Path to Jenkinsfile snippet for integration tests used by promotion workflow -c3i_integration_test_snippet: +# c3i_integration_test_snippet: # list of flags in semaphore to allow prod promotion c3i_semaphore_custom_flags: [] diff --git a/roles/c3i/tasks/main.yml b/roles/c3i/tasks/main.yml index 47e7cc5..8f894bb 100644 --- a/roles/c3i/tasks/main.yml +++ b/roles/c3i/tasks/main.yml @@ -1,6 +1,15 @@ --- - name: C3I Tasks/Main block: + - name: Check that mandatory variables for C3I-Library are defined + assert: + that: + - "{{ item }} is defined" + fail_msg: "{{ item }} must be defined" + with_items: + - c3i_component + - c3i_build_and_test_snippet + - c3i_integration_test_snippet - name: Including jobs include_tasks: proceed.yml with_filetree: ../templates/jobs