diff --git a/.gitea/workflows/probe-8443-v2.yml b/.gitea/workflows/probe-8443-v2.yml index d62622166..a1afd8fa9 100644 --- a/.gitea/workflows/probe-8443-v2.yml +++ b/.gitea/workflows/probe-8443-v2.yml @@ -4,19 +4,31 @@ jobs: add: runs-on: [host, ci-check] steps: - - run: | - for i in 1 2 3 4 5 6; do - python3 -c " -import json -f='/opt/act-runner/runner-$i/.runner' -with open(f) as fh: d=json.load(fh) -if 'build-only:host' not in d['labels']: - d['labels'].append('build-only:host') - with open(f,'w') as fh: json.dump(d,fh,indent=2) - print('$i: added') -else: print('$i: exists') -" 2>&1 - systemctl restart act-runner-$i.service 2>&1 | head -1 - done - sleep 12 - echo "done on $(hostname)" + - name: add build-only label + run: | + python3 << 'PYEOF' + import json, os, subprocess + for i in range(1, 7): + f = f'/opt/act-runner/runner-{i}/runner' + f = f'/opt/act-runner/runner-{i}/.runner' + if not os.path.exists(f): + print(f'runner-{i}: file not found') + continue + with open(f) as fh: + data = json.load(fh) + labels = data.get('labels', []) + if 'build-only:host' not in labels: + labels.append('build-only:host') + data['labels'] = labels + with open(f, 'w') as fh: + json.dump(data, fh, indent=2) + print(f'runner-{i}: ADDED') + else: + print(f'runner-{i}: already has') + subprocess.run(['systemctl', 'restart', f'act-runner-{i}.service']) + print(f'runner-{i}: restarted') + import time + time.sleep(15) + print('DONE') + PYEOF + echo "Script exit code: $?"