infra-role-beacon-node-windows/tasks/build.yml

47 lines
1.5 KiB
YAML
Raw Normal View History

---
- name: Create build script
win_template:
src: 'build.sh.j2'
dest: '{{ beacon_node_service_path }}\build.sh'
mode: 0750
- name: Schedule and start node builds
win_scheduled_task:
description: 'Daily rebuild of Nimbus beacon node binaries'
name: '{{ beacon_node_build_service_name }}'
username: SYSTEM
actions:
- path: 'C:\ProgramData\scoop\apps\git\current\bin\bash.exe'
arguments: '-c "./build.sh > logs\build.log 2>&1"'
working_directory: '{{ beacon_node_service_path }}'
triggers:
- type: '{{ beacon_node_build_frequency }}'
start_boundary: '{{ ansible_date_time.date }}T{{ beacon_node_build_start_time }}'
state: 'present'
enabled: true
multiple_instances: 2 # Wait for running task
start_when_available: true
disallow_start_if_on_batteries: false
stop_if_going_on_batteries: false
- 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
win_shell: 'Start-ScheduledTask -TaskName {{ beacon_node_build_service_name }}'
when: not beacon_node_exe.stat.exists
- name: Wait for the node build to finish (SLOW)
win_scheduled_task_stat:
name: '{{ beacon_node_build_service_name }}'
when: not beacon_node_exe.stat.exists
register: task_stat
until: |
task_stat.state is defined and
task_stat.state.status != "TASK_STATE_RUNNING"
retries: 60 # 1 hour total
delay: 60 # seconds