summaryrefslogtreecommitdiffstats
path: root/roles/openshift_version
diff options
context:
space:
mode:
authorSteve Milner <smilner@redhat.com>2017-03-13 14:08:13 -0400
committerSteve Milner <smilner@redhat.com>2017-04-03 09:27:57 -0400
commite9c87e2c135f54862905d4677ebf97551bfa1a6e (patch)
tree46c8eb3ed1e669b0a456fba977564e563cf55c47 /roles/openshift_version
parent3aa41e54b072dde8597db7fd0fc997dfc2002cf1 (diff)
downloadopenshift-e9c87e2c135f54862905d4677ebf97551bfa1a6e.tar.gz
openshift-e9c87e2c135f54862905d4677ebf97551bfa1a6e.tar.bz2
openshift-e9c87e2c135f54862905d4677ebf97551bfa1a6e.tar.xz
openshift-e9c87e2c135f54862905d4677ebf97551bfa1a6e.zip
Verify openshift_image_tag is valid during openshift_version main
- origin examples: v1.2.3, v1.2.3-alpha, v1.2.3-beta.1, v1.5.0-rc.0 - openshift-enterprise examples: v3.5, v3.5.3, v3.5.3.4, v3.5.3.4-1
Diffstat (limited to 'roles/openshift_version')
-rw-r--r--roles/openshift_version/tasks/main.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml
index 4de36ad1b..ef1783244 100644
--- a/roles/openshift_version/tasks/main.yml
+++ b/roles/openshift_version/tasks/main.yml
@@ -26,6 +26,37 @@
openshift_release: "{{ openshift_release | string }}"
when: openshift_release is defined
+# Verify that the image tag is in a valid format
+- block:
+
+ # Verifies that when the deployment type is origin the version:
+ # - starts with a v
+ # - Has 3 integers seperated by dots
+ # It also allows for optional trailing data which:
+ # - must start with a dash
+ # - may contain numbers, letters, dashes and dots.
+ - assert:
+ that:
+ - "{{ openshift_image_tag|match('(^v?\\d+\\.\\d+\\.\\d+(-[\\w\\-\\.]*)?$)') }}"
+ msg: "openshift_image_tag must be in the format v#.#.#[-optional.#]. Examples: v1.2.3, v3.5.1-alpha.1"
+ when: openshift.common.deployment_type == 'origin'
+
+ # Verifies that when the deployment type is openshift-enterprise the version:
+ # - starts with a v
+ # - Has at least 2 integers seperated by dots
+ # It also allows for optional trailing data which:
+ # - must start with a dash
+ # - may contain numbers
+ - assert:
+ that:
+ - "{{ openshift_image_tag|match('(^v\\d+\\.\\d+[\\.\\d+]*(-\\d+)?$)') }}"
+ msg: "openshift_image_tag must be in the format v#.#[.#[.#]]. Examples: v1.2, v3.4.1, v3.5.1.3, v1.2-1, v1.2.3-4"
+ when: openshift.common.deployment_type == 'openshift-enterprise'
+
+ when:
+ - openshift_image_tag is defined
+ - openshift_image_tag != "latest"
+
# Add a v to the start of the openshift_image_tag if one was not provided
- set_fact:
openshift_image_tag: "{{ 'v' + openshift_image_tag }}"