diego-torres
2018-08-27 2af3f3b12419e09a9c0bde67378d104941c7569e
fix deploy wait state
- Reorder pause, cancel and deploy instructions
- ignore cancelled rolling configs from the project list
- https://github.com/redhat-gpe/bxms_process_automation_foundations/issues/31
- https://github.com/redhat-gpe/bxms_process_automation_foundations/issues/28
2 files modified
21 ■■■■ changed files
ansible/roles/ocp-workload-bxms-pam/tasks/wait_for_deploy.yml 5 ●●●●● patch | view | raw | blame | history
ansible/roles/ocp-workload-bxms-pam/tasks/workload.yml 16 ●●●● patch | view | raw | blame | history
ansible/roles/ocp-workload-bxms-pam/tasks/wait_for_deploy.yml
@@ -6,7 +6,7 @@
#
# Manual Test to determine list of unready replication controllers :
#  1) install jp :  https://github.com/jmespath/jp
#  2) oc get rc -o json | jp 'items[?  (status.readyReplicas == ""|| status.readyReplicas == `0`) ].metadata.annotations."openshift.io/deployment-config.name"'
#  2) oc get rc -o json | jp 'items[?  (status.readyReplicas == ""|| status.readyReplicas == `0`) ].metadata.annotations[? "openshift.io/deployment.cancelled"=='true']."openshift.io/deployment-config.name"'
#
- name: "Wait for following deployments to become ready: {{pod_to_wait}}"
  command: 'oc get rc -o json -n "{{ ocp_project }}"'
@@ -14,7 +14,8 @@
  changed_when: false
  retries: "{{ deploy_status_retries }}"
  delay: "{{ deploy_status_delay }}"
  until: 'rc_state.stdout |from_json |json_query(''items[?  (status.readyReplicas == ""|| status.readyReplicas == `0`) ].metadata.annotations."openshift.io/deployment-config.name"'') |intersect(pod_to_wait) |length == 0'
# dtorresf: Ignore "cancelled" deployments
  until: "rc_state.stdout | from_json | json_query('items[?  (status.readyReplicas == \"\"|| status.readyReplicas == `0`) ].metadata.annotations[? \"openshift.io/deployment.cancelled\"==''true''].\"openshift.io/deployment-config.name\"') | intersect(pod_to_wait) | length == 0"
#  Documentation pertaining to jq syntax:
#    - http://jmespath.org/tutorial.html
ansible/roles/ocp-workload-bxms-pam/tasks/workload.yml
@@ -49,14 +49,6 @@
      -p KIE_SERVER_HTTPS_SECRET={{kserver_app_secret}} \
      -n {{ocp_project}} > /tmp/{{guid}}/gpte-pam-lab.txt
- name: resume {{app_name}}-rhpamcentr
  shell: oc rollout resume dc/{{app_name}}-rhpamcentr -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - "{{app_name}}-rhpamcentr"
# Do not cancel, just pause, it will be modified next.
- name: pause {{app_name}}-rhpamcentr
  shell: oc rollout pause dc/{{app_name}}-rhpamcentr -n {{ocp_project}}
@@ -69,6 +61,14 @@
- name: cancel {{app_name}}-kieserver initial rollout
  shell: oc rollout cancel dc/{{app_name}}-kieserver -n {{ocp_project}}
- name: resume {{app_name}}-rhpamcentr
  shell: oc rollout resume dc/{{app_name}}-rhpamcentr -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - "{{app_name}}-rhpamcentr"
- name: resume {{app_name}}-kieserver
  shell: oc deploy --latest dc/{{app_name}}-kieserver -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml