Apply cookiecutter commit sources in a certain order
If both COOKIECUTTER_REF_CHANGE and COOKIECUTTER_TAG are defined,
then COOKIECUTTER_REF_CHANGE does not take effect
Apply commit sources in the following order:
1. COOKIECUTTER_TEMPLATE_COMMIT, if defined
2. else, COOKIECUTTER_REF_CHANGE if defined,
3. else, COOKIECUTTER_TAG if defined.
Change-Id: I7ed4c3073091bd7604bc106e924c71bca1c7113d
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 9084609..4f0801e 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -345,11 +345,9 @@
{%- endif %}
{%- if COOKIECUTTER_TEMPLATE_COMMIT != '' %}
echo "COOKIECUTTER_TEMPLATE_COMMIT={{ COOKIECUTTER_TEMPLATE_COMMIT }}"
- {%- endif %}
- {%- if COOKIECUTTER_REF_CHANGE != '' %}
+ {%- elif COOKIECUTTER_REF_CHANGE != '' %}
echo "COOKIECUTTER_REF_CHANGE={{ COOKIECUTTER_REF_CHANGE }}"
- {%- endif %}
- {%- if COOKIECUTTER_TAG != '' %}
+ {%- elif COOKIECUTTER_TAG != '' %}
echo "COOKIECUTTER_TAG={{ COOKIECUTTER_TAG }}"
{%- endif %}
echo "SALT_MODELS_SYSTEM_REPOSITORY={{ SALT_MODELS_SYSTEM_REPOSITORY }}"
@@ -376,15 +374,11 @@
pushd /tmp/cookiecutter-templates
git checkout {{ COOKIECUTTER_TEMPLATE_COMMIT }}
popd
- {%- endif %}
-
- {%- if COOKIECUTTER_REF_CHANGE != '' %}
+ {%- elif COOKIECUTTER_REF_CHANGE != '' %}
pushd /tmp/cookiecutter-templates
git fetch {{ COOKIECUTTER_TEMPLATES_REPOSITORY }} {{ COOKIECUTTER_REF_CHANGE }} && git checkout FETCH_HEAD
popd
- {%- endif %}
-
- {%- if COOKIECUTTER_TAG != '' %}
+ {%- elif COOKIECUTTER_TAG != '' %}
pushd /tmp/cookiecutter-templates
git fetch --all --tags --prune
git checkout tags/{{ COOKIECUTTER_TAG }}