#64 [PVHEALTH-132] Assert required vars at start of role
Merged 4 years ago by mkovarik. Opened 4 years ago by sidpremkumar.
sidpremkumar/c3i-library assert-req-vars  into  master

file modified
+3 -3
@@ -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 @@ 

  # 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: []

@@ -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

Assert that required variables are set at the start of the role

c3i_component is in defaults so it is always defined, you should comment it in defaults.

Also c3i_build_and_test_snippet and c3i_integration_test_snippet are required

rebased onto 9df0b84fe8bc34d9c6a75b1639aa4c96130e9aef

4 years ago

rebased onto 231fc83

4 years ago

Pull-Request has been merged by mkovarik

4 years ago