fix scheduling of build, add wait for build to finish

It's important is providin user and password and using `logon_type: s4u`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-06-16 10:49:25 +02:00
parent 678d490fb4
commit 34c8891282
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 36 additions and 14 deletions

View File

@ -45,17 +45,3 @@
src: 'build.sh.j2'
dest: '{{ beacon_node_build_script }}'
mode: 0750
- name: Schedule node builds
win_scheduled_task:
description: 'Daily rebuild of Nimbus beacon node binaries'
name: '{{ beacon_node_service_name }}-build'
#path: '{{ beacon_node_service_path }}'
actions:
- path: '{{ beacon_node_build_script }}'
triggers:
- type: 'daily'
start_boundary: '2021-01-01T01:00:00'
username: '{{ beacon_node_service_user_name }}'
state: 'present'
enabled: true

View File

@ -2,5 +2,6 @@
- import_tasks: checks.yml
- import_tasks: user.yml
- import_tasks: install.yml
- import_tasks: schedule.yml
- import_tasks: service.yml
- import_tasks: firewall.yml

35
tasks/schedule.yml Normal file
View File

@ -0,0 +1,35 @@
---
- name: Schedule and start node builds
win_scheduled_task:
description: 'Daily rebuild of Nimbus beacon node binaries'
name: '{{ beacon_node_service_name }}-build'
username: '{{ beacon_node_service_user_name }}'
password: '{{ beacon_node_service_user_pass }}'
logon_type: 's4u'
actions:
- path: 'C:/ProgramData/scoop/apps/git/current/bin/bash.exe'
arguments: '{{ beacon_node_build_script }}'
triggers:
- type: 'daily'
start_boundary: '2021-01-01T01:00:00'
# Also start it right away
- type: registration
state: 'present'
enabled: true
multiple_instances: 2 # Wait for running task
disallow_start_if_on_batteries: false
stop_if_going_on_batteries: false
- name: Wait for the node build to finish
win_scheduled_task_stat:
name: '{{ beacon_node_service_name }}-build'
register: task_stat
until: |
(
task_stat.state is defined and
task_stat.state.status != "TASK_STATE_RUNNING"
) or (
task_stat.task_exists == False
)
retries: 7
delay: 5