Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple remotes #172

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions provision-contest/ansible/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +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
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
copy:
src: admin-machine.css
Expand Down Expand Up @@ -151,3 +137,33 @@
etype: user
permissions: rwx
state: present

- name: Download offline repos
when: WF_RESTRICTED_NETWORK
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right order?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order does not matter for yaml, I checked and this does create those remotes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which one is the default remote?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We first clone first so that would be the origin, the idea is to change the origin when another host comes available.

I verified on a VM and origin is the still default even after the other remotes get added.

- remote: origin
url: [email protected]:domjudge
- remote: github
url: [email protected]:DOMjudge/domjudge.git
- remote: sysops
url: domjudge@packages:domjudge.git
- remote: initial
url: ansible@domjudge-ccsadmin1:domjudge.git

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference with origin?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One gets switched if the other git hosts get online, the other stays stable.


- 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

Loading