Skip to content

Commit 07dd870

Browse files
committed
Test ansible scripts with default linter
We first ignore all errors and fix those in separate commits.
1 parent f5bf666 commit 07dd870

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

.github/linting.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/bash
2+
3+
set -euxo pipefail
4+
5+
# shellcheck disable=SC2044
6+
for book in $(find ./ -maxdepth 1 -name "*.yml"); do
7+
if [ "$book" != "./handlers.yml" ]; then
8+
ansible-lint "$book" -x braces,line-length
9+
fi
10+
done
11+
# shellcheck disable=SC2044
12+
for dir in $(find ./roles -maxdepth 1 -type d); do
13+
ansible-lint "$dir" -x braces,line-length
14+
done

.github/workflows/ansible-linting.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Test contest deployment (ansible scripts) [PIP]
2+
3+
on: [push,pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repo
10+
uses: actions/checkout@v2
11+
- name: Install ansible lint tools
12+
run: sudo apt update; sudo pip install ansible-lint
13+
- name: Lint the different scripts
14+
run: |
15+
set -eux
16+
ansible-lint --version
17+
ansible-lint .
18+
working-directory: icpc-wf/ansible
19+
- name: Lint the different scripts (Via the script)
20+
run: ../../.github/linting.sh
21+
working-directory: icpc-wf/ansible
22+

icpc-wf/ansible/.ansible-lint

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
parseable: true
2+
skip_list:
3+
- no-handler # TODO: this might break existing playbooks
4+
- 503 # TODO: this might break existing playbooks
5+
- meta-no-info # We don't publish to galaxy (yet)
6+
- 701 # We don't publish to galaxy (yet)
7+
- fqcn-builtins # I see no benefit as we dont use custom roles
8+
- 204 # The long line should be re-evaluated
9+
use_default_rules: true
10+
verbosity: 1

icpc-wf/ansible/judgehost.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@
4141
tags: prometheus_target_all
4242
when: GRAFANA_MONITORING
4343
pre_tasks:
44+
- name: Get current services
45+
service_facts:
4446
- name: Disable all cores
4547
service:
4648
name="domjudge-judgedaemon@{{item}}"
4749
state=stopped
4850
with_sequence: start=0 end={{ ansible_processor_vcpus }} format=domjudge-judgedaemon@%1x
51+
when: '"[email protected]" in services'
4952
tasks:
5053
- name: add autostart shortcuts
5154
template:

0 commit comments

Comments
 (0)