2021-06-16 08:49:25 +00:00
|
|
|
---
|
2021-07-22 15:03:59 +00:00
|
|
|
- name: Create build script
|
|
|
|
win_template:
|
|
|
|
src: 'build.sh.j2'
|
|
|
|
dest: '{{ beacon_node_service_path }}\build.sh'
|
|
|
|
mode: 0750
|
|
|
|
|
2021-06-16 08:49:25 +00:00
|
|
|
- name: Schedule and start node builds
|
|
|
|
win_scheduled_task:
|
|
|
|
description: 'Daily rebuild of Nimbus beacon node binaries'
|
2021-09-29 13:15:33 +00:00
|
|
|
name: '{{ beacon_node_build_service_name }}'
|
2021-06-16 13:30:04 +00:00
|
|
|
username: SYSTEM
|
2021-06-16 08:49:25 +00:00
|
|
|
actions:
|
2021-07-22 14:06:59 +00:00
|
|
|
- path: 'C:\ProgramData\scoop\apps\git\current\bin\bash.exe'
|
2021-07-22 15:03:59 +00:00
|
|
|
arguments: '-c "./build.sh > build.log 2>&1"'
|
2021-06-16 13:30:04 +00:00
|
|
|
working_directory: '{{ beacon_node_service_path }}'
|
2021-06-16 08:49:25 +00:00
|
|
|
triggers:
|
2021-07-19 07:33:35 +00:00
|
|
|
- type: '{{ beacon_node_build_frequency }}'
|
|
|
|
start_boundary: '{{ ansible_date_time.date }}T{{ beacon_node_build_start_time }}'
|
2021-06-16 08:49:25 +00:00
|
|
|
state: 'present'
|
|
|
|
enabled: true
|
|
|
|
multiple_instances: 2 # Wait for running task
|
2021-06-17 11:20:52 +00:00
|
|
|
start_when_available: true
|
2021-06-16 08:49:25 +00:00
|
|
|
disallow_start_if_on_batteries: false
|
|
|
|
stop_if_going_on_batteries: false
|
|
|
|
|
2021-06-17 11:20:52 +00:00
|
|
|
- name: Check if binary exists
|
|
|
|
win_stat:
|
|
|
|
path: '{{ beacon_node_service_exe }}'
|
|
|
|
register: beacon_node_exe
|
|
|
|
|
|
|
|
# Start it right away so we have the binary to run.
|
|
|
|
- name: Start the new scheduled task
|
2021-09-29 13:15:33 +00:00
|
|
|
win_shell: 'Start-ScheduledTask -TaskName {{ beacon_node_build_service_name }}'
|
2021-06-17 11:20:52 +00:00
|
|
|
when: not beacon_node_exe.stat.exists
|
|
|
|
|
2021-06-16 13:39:24 +00:00
|
|
|
- name: Wait for the node build to finish (SLOW)
|
2021-06-16 08:49:25 +00:00
|
|
|
win_scheduled_task_stat:
|
2021-09-29 13:15:33 +00:00
|
|
|
name: '{{ beacon_node_build_service_name }}'
|
2021-06-17 11:20:52 +00:00
|
|
|
when: not beacon_node_exe.stat.exists
|
2021-06-16 13:39:24 +00:00
|
|
|
register: task_stat
|
|
|
|
until: |
|
2021-06-17 11:20:52 +00:00
|
|
|
task_stat.state is defined and
|
|
|
|
task_stat.state.status != "TASK_STATE_RUNNING"
|
2021-06-17 12:12:06 +00:00
|
|
|
retries: 60 # 1 hour total
|
|
|
|
delay: 60 # seconds
|