Skip to content

Commit 193c5fe

Browse files
committed
Adds dumping of all API endpoints.
1 parent 37da598 commit 193c5fe

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

provision-contest/ansible/EOC/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,19 @@ The playbook has multiple tags:
6161
- `awards`: Verifies awards.json against the CDS and other CCS when configured.
6262
- `results.tsv`: Downloads results.tsv from DOMjudge and stores it in the repo.
6363
- `fetch`: Retrieves all files required by the EOC including results.tsv
64-
64+
- `dump`: Dumps all API endpoints, specifically:
65+
- accounts
66+
- awards
67+
- balloons
68+
- clarifications
69+
- problems
70+
- groups
71+
- judgements
72+
- languages
73+
- organizations
74+
- runs
75+
- scoreboard
76+
- teams
6577

6678
### Known limitations
6779
- The checks that verify whether the jsons are the same are *very* simple and I (Mart) have not yet found a reasonable way of actually checking them in a nice manner from ansible. Them matching would be a bigger red-flag than them having a difference. Still, the playbook fails when a difference is detected! To aid with (manual) verification the results of fetching the jsons is stored in `/tmp/[obj].[sys].json` with `[object]` either "awards" or "scoreboard" and `[sys]` either "dj", "cds", or "other".

provision-contest/ansible/EOC/main.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# Do this to prevent the dreaded issues with basic auth. Tedious but it works
1313
- name: Set DOMjudge basic auth fact
14-
tags: all, compare, scoreboard, awards, fetch
14+
tags: all, compare, scoreboard, awards, fetch, dump
1515
ansible.builtin.set_fact:
1616
dj_basic_auth: "Basic {{ (dj_username+':'+dj_password) | b64encode }}"
1717

@@ -166,6 +166,30 @@
166166
headers:
167167
Authorization: "{{ dj_basic_auth }}"
168168

169+
- name: "Fetch {{ item }}-endpoint from Dj"
170+
tags: all, fetch, dump
171+
ansible.builtin.uri:
172+
url: "{{ dj_url }}/{{ dj_url_api_suffix }}/contests/{{ contest }}/{{ item }}"
173+
return_content: yes
174+
method: GET
175+
creates: "{{ repo }}/{{ item }}.json"
176+
dest: "{{ repo }}/{{ item }}.json"
177+
headers:
178+
Authorization: "{{ dj_basic_auth }}"
179+
with_items:
180+
- accounts
181+
- awards
182+
- balloons
183+
- clarifications
184+
- problems
185+
- groups
186+
- judgements
187+
- languages
188+
- organizations
189+
- runs
190+
- scoreboard
191+
- teams
192+
169193
- name: "Store final standings (contest.zip)"
170194
tags: all, fetch
171195
ansible.builtin.uri:

0 commit comments

Comments
 (0)