From bceae6697c0b851c239477f3a1e5629c7819580a Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:46:30 +0200 Subject: [PATCH 1/4] Remove duplication --- provision-contest/ansible/admin.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/provision-contest/ansible/admin.yml b/provision-contest/ansible/admin.yml index e847f41d..6c053faf 100644 --- a/provision-contest/ansible/admin.yml +++ b/provision-contest/ansible/admin.yml @@ -72,16 +72,14 @@ - name: Download offline repos when: WF_RESTRICTED_NETWORK + become: true + become_user: domjudge block: - name: Create working copy of the domjudge-scripts repo - become: true - become_user: domjudge # We use a different directory here to have one single 'upstream' and not have issues with it git: repo={{ dj_git_repo_scripts }} dest=/home/domjudge/domjudge-scripts-checkout version=main accept_hostkey=yes update=no - name: Create working copy of the contest repo - become: true - become_user: domjudge git: repo=git@cds:{{ CONTEST_REPO }} dest=/home/domjudge/{{ CONTEST_REPO }} version=master accept_hostkey=yes update=no - name: Copy custom CSS file for admin machines From 54b0fd872c4e53c0d7fd84c5f66a1462e6843fc3 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:48:36 +0200 Subject: [PATCH 2/4] Continue even when packages is not online yet --- provision-contest/ansible/admin.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/provision-contest/ansible/admin.yml b/provision-contest/ansible/admin.yml index 6c053faf..ae0b6594 100644 --- a/provision-contest/ansible/admin.yml +++ b/provision-contest/ansible/admin.yml @@ -80,7 +80,8 @@ git: repo={{ dj_git_repo_scripts }} dest=/home/domjudge/domjudge-scripts-checkout version=main accept_hostkey=yes update=no - name: Create working copy of the contest repo - git: repo=git@cds:{{ CONTEST_REPO }} dest=/home/domjudge/{{ CONTEST_REPO }} version=master accept_hostkey=yes update=no + ignore_errors: true + git: repo=git@packages:{{ CONTEST_REPO }} dest=/home/domjudge/{{ CONTEST_REPO }} version=master accept_hostkey=yes update=no - name: Copy custom CSS file for admin machines copy: From 20a389cecb67c8faafc300831289dd6b58a088fa Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:49:29 +0200 Subject: [PATCH 3/4] Move it to show the ignored error as last item. --- provision-contest/ansible/admin.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/provision-contest/ansible/admin.yml b/provision-contest/ansible/admin.yml index ae0b6594..7f5b67f8 100644 --- a/provision-contest/ansible/admin.yml +++ b/provision-contest/ansible/admin.yml @@ -70,19 +70,6 @@ set_fact: dj_git_repo_scripts: "{{ DJ_GIT_REPO_SCRIPTS_RESTRICTED if WF_RESTRICTED_NETWORK else DJ_GIT_REPO_SCRIPTS }}" - - name: Download offline repos - when: WF_RESTRICTED_NETWORK - become: true - become_user: domjudge - block: - - name: Create working copy of the domjudge-scripts repo - # We use a different directory here to have one single 'upstream' and not have issues with it - git: repo={{ dj_git_repo_scripts }} dest=/home/domjudge/domjudge-scripts-checkout version=main accept_hostkey=yes update=no - - - name: Create working copy of the contest repo - ignore_errors: true - git: repo=git@packages:{{ CONTEST_REPO }} dest=/home/domjudge/{{ CONTEST_REPO }} version=master accept_hostkey=yes update=no - - name: Copy custom CSS file for admin machines copy: src: admin-machine.css @@ -150,3 +137,17 @@ etype: user permissions: rwx state: present + + - name: Download offline repos + when: WF_RESTRICTED_NETWORK + become: true + become_user: domjudge + block: + - name: Create working copy of the domjudge-scripts repo + # We use a different directory here to have one single 'upstream' and not have issues with it + git: repo={{ dj_git_repo_scripts }} dest=/home/domjudge/domjudge-scripts-checkout version=main accept_hostkey=yes update=no + + - name: Create working copy of the contest repo + ignore_errors: true + git: repo=git@packages:{{ CONTEST_REPO }} dest=/home/domjudge/{{ CONTEST_REPO }} version=master accept_hostkey=yes update=no + From f01ab01333e2e724661b1597495786434fe0c04e Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:58:17 +0200 Subject: [PATCH 4/4] Add remotes The idea is to have 4 remotes, 1 which we can change if the other host gets up and the others to make sure we can still work on possible branches or rebase against them. --- provision-contest/ansible/admin.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/provision-contest/ansible/admin.yml b/provision-contest/ansible/admin.yml index 7f5b67f8..f36a6f78 100644 --- a/provision-contest/ansible/admin.yml +++ b/provision-contest/ansible/admin.yml @@ -143,6 +143,22 @@ become: true become_user: domjudge block: + - name: Add ccsadmin remote + git_config: + name: "remote.{{ item.remote }}.url" + value: "{{ item.url }}" + scope: local + repo: /home/domjudge/domjudge-checkout + loop: + - remote: origin + url: ansible@10.3.3.224:domjudge + - remote: github + url: git@github.com:DOMjudge/domjudge.git + - remote: sysops + url: domjudge@packages:domjudge.git + - remote: initial + url: ansible@domjudge-ccsadmin1:domjudge.git + - name: Create working copy of the domjudge-scripts repo # We use a different directory here to have one single 'upstream' and not have issues with it git: repo={{ dj_git_repo_scripts }} dest=/home/domjudge/domjudge-scripts-checkout version=main accept_hostkey=yes update=no