Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Orquesta task retry #450

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions actions/workflows/create_vm_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ input:
- distro
vars:
- check_cname_count: 0
- wait_for_password_iteration_count: 0
- wait_for_winrm_count: 0
- ec2_instance_password: ""
- ec2_instance_id:
- ec2_instance_user_data: "<powershell>\n# download the script\n(New-Object System.Net.WebClient).DownloadFile('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1', './ConfigureRemotingForAnsible.ps1')\n# execute the script\n./ConfigureRemotingForAnsible.ps1\n</powershell>"
Expand Down Expand Up @@ -104,7 +102,10 @@ tasks:
wait_for_password_data:
# Note: AWS EC2 says it may take up to 15 minutes for password data to become
# available
delay: 60
retry:
delay: 60
when: <% (failed() or result().result[0]["PasswordData"].isEmpty()) %>
count: 15
action: aws.ec2_get_password_data
input:
InstanceId: <% ctx().ec2_instance_id %>
Expand All @@ -114,16 +115,9 @@ tasks:
- ec2_instance_password_data: <% result().result[0]["PasswordData"] %>
do:
- decrypt_password_data
- when: <% failed() and (ctx().wait_for_password_iteration_count >= 15) %>
- when: <% failed() %>
do:
- destroy_vm_on_failure
- when: <%
(failed() or result().result[0]["PasswordData"].isEmpty()) and
(ctx().wait_for_password_iteration_count < 15) %>
publish:
- wait_for_password_iteration_count: <% ctx().wait_for_password_iteration_count + 1 %>
do:
- wait_for_password_data
decrypt_password_data:
action: st2cd.aws_decrypt_password_data
input:
Expand All @@ -139,7 +133,9 @@ tasks:
do:
- destroy_vm_on_failure
wait_for_winrm:
delay: 60
retry:
delay: 60
count: 5
action: windows.wait_for_winrm
input:
host: <% ctx().ec2_instance_private_ip %>
Expand All @@ -153,14 +149,9 @@ tasks:
- when: <% succeeded() %>
do:
- add_tags
- when: <% failed() and (ctx().wait_for_winrm_count >= 5) %>
- when: <% failed() %>
do:
- destroy_vm_on_failure
- when: <% failed() and (ctx().wait_for_winrm_count < 5) %>
publish:
- wait_for_winrm_count: <% ctx().wait_for_winrm_count + 1 %>
do:
- wait_for_winrm
add_tags:
action: aws.ec2_create_tags
input:
Expand Down
12 changes: 4 additions & 8 deletions actions/workflows/destroy_vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ input:
- used_dns: false
- used_id: false
vars:
- volume_to_delete_iteration_count: 0
- notify_channel: '#thunderdome'
- notify_failure_channel: '#opstown'
tasks:
Expand Down Expand Up @@ -128,7 +127,9 @@ tasks:
- notify_delete_cname_failure
- delete_volumes
delete_volumes:
delay: 120
retry:
delay: 120
count: 10
with: volume in <% ctx().volumes %>
action: aws.ec2_delete_volume
input:
Expand All @@ -137,14 +138,9 @@ tasks:
- when: <% succeeded() %>
do:
- notify_success
- when: <% failed() and (ctx().volume_to_delete_iteration_count >= 10) %>
- when: <% failed() %>
do:
- notify_delete_volumes_failure
- when: <% failed() and (ctx().volume_to_delete_iteration_count < 10) %>
publish:
- volume_to_delete_iteration_count: <% ctx().volume_to_delete_iteration_count + 1 %>
do:
- delete_volumes

notify_success:
action: slack.chat.postMessage
Expand Down