Skip to content

Commit d5761da

Browse files
committed
INF-526 Add mirror job and update the workflow values
1 parent c528bf4 commit d5761da

File tree

2 files changed

+53
-12
lines changed

2 files changed

+53
-12
lines changed

.github/workflows/01-build-then-test.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ jobs:
133133
needs:
134134
- start-runner-test_branch
135135
container:
136-
image: ghcr.io/fews-net/inf/docker:latest
136+
image: ghcr.io/american-institutes-for-research/actions-cli:latest
137137
credentials:
138138
username: ${{ github.repository_owner }}
139-
password: ${{ secrets.GHCR_PAT }}
139+
password: ${{ secrets.CR_PAT }}
140140
defaults:
141141
run:
142142
shell: ash --noprofile --norc -eo pipefail {0} # Fail on any non-zero exit code, even in piped commands
@@ -167,7 +167,7 @@ jobs:
167167
uses: docker/login-action@v3
168168
with:
169169
username: ${{ secrets.DOCKER_HUB_USERNAME }}
170-
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
170+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
171171
- name: "Pull previous images to speed up builds"
172172
run: |
173173
for SERVICE in ${BUILD_IMAGES}; do (docker pull ${CI_REGISTRY_IMAGE}/${SERVICE}:edge | grep -i -e 'Pulling from' -e Digest -e Status -e Error) || true; done
@@ -276,10 +276,10 @@ jobs:
276276
needs:
277277
- start-runner-test_keepdb
278278
container:
279-
image: ghcr.io/fews-net/inf/docker:latest
279+
image: ghcr.io/american-institutes-for-research/actions-cli:latest
280280
credentials:
281281
username: ${{ github.repository_owner }}
282-
password: ${{ secrets.GHCR_PAT }}
282+
password: ${{ secrets.CR_PAT }}
283283
defaults:
284284
run:
285285
shell: ash --noprofile --norc -eo pipefail {0} # Fail on any non-zero exit code, even in piped commands
@@ -310,7 +310,7 @@ jobs:
310310
uses: docker/login-action@v3
311311
with:
312312
username: ${{ secrets.DOCKER_HUB_USERNAME }}
313-
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
313+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
314314
- name: "Pull previous images to speed up builds"
315315
run: |
316316
for SERVICE in ${BUILD_IMAGES}; do (docker pull ${CI_REGISTRY_IMAGE}/${SERVICE}:edge | grep -i -e 'Pulling from' -e Digest -e Status -e Error) || true; done
@@ -401,10 +401,10 @@ jobs:
401401
needs:
402402
- start-runner-test_main
403403
container:
404-
image: ghcr.io/fews-net/inf/docker:latest
404+
image: ghcr.io/american-institutes-for-research/actions-cli:latest
405405
credentials:
406406
username: ${{ github.repository_owner }}
407-
password: ${{ secrets.GHCR_PAT }}
407+
password: ${{ secrets.CR_PAT }}
408408
defaults:
409409
run:
410410
shell: ash --noprofile --norc -eo pipefail {0} # Fail on any non-zero exit code, even in piped commands
@@ -435,7 +435,7 @@ jobs:
435435
uses: docker/login-action@v3
436436
with:
437437
username: ${{ secrets.DOCKER_HUB_USERNAME }}
438-
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
438+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
439439
- name: "Pull previous images to speed up builds"
440440
run: |
441441
echo Using registry image ${CI_REGISTRY_IMAGE}
@@ -529,10 +529,10 @@ jobs:
529529
needs:
530530
- start-runner-test_tag
531531
container:
532-
image: ghcr.io/fews-net/inf/docker:latest
532+
image: ghcr.io/american-institutes-for-research/actions-cli:latest
533533
credentials:
534534
username: ${{ github.repository_owner }}
535-
password: ${{ secrets.GHCR_PAT }}
535+
password: ${{ secrets.CR_PAT }}
536536
defaults:
537537
run:
538538
shell: ash --noprofile --norc -eo pipefail {0} # Fail on any non-zero exit code, even in piped commands
@@ -563,7 +563,7 @@ jobs:
563563
uses: docker/login-action@v3
564564
with:
565565
username: ${{ secrets.DOCKER_HUB_USERNAME }}
566-
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
566+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
567567
- uses: "actions/checkout@v4"
568568
with:
569569
ssh-key: ${{ secrets.GIT_SSH_PRIVATE_KEY }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Mirror to FDW
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- "main"
10+
tags:
11+
- "*"
12+
13+
jobs:
14+
mirror:
15+
runs-on: [ fewsnet ]
16+
# run in container to avoid file permission issues like EACCES: permission denied
17+
container: "python:3.12"
18+
steps:
19+
- uses: "actions/checkout@v4"
20+
with:
21+
# we don't want the current commit only,
22+
# but also previous commits in case those haven't been synced
23+
fetch-depth: 0
24+
25+
# since we are running this on the runner controller (like lint), action/checkout
26+
# will not create a new repo for subsequent runs. This lead to
27+
# error: remote mirror already exists.
28+
# We will just remove the remote here if it already exists, so mirror-action works
29+
- name: Remove existing remote
30+
run: |
31+
# seems to be necessary to run git commands
32+
git config --global --add safe.directory /__w/FEWSNET-HEA-Database-Development/FEWSNET-HEA-Database-Development
33+
git remote remove mirror || echo "No remote 'mirror' existed"
34+
35+
- uses: yesolutions/[email protected]
36+
with:
37+
REMOTE: "ssh://[email protected]/FEWS-NET/HEA-Database-Development.git"
38+
GIT_SSH_PRIVATE_KEY: ${{ secrets.FDW_GIT_SSH_PRIVATE_KEY }}
39+
# @TODO: change this to secrets.GIT_SSH_KNOWN_HOSTS
40+
GIT_SSH_NO_VERIFY_HOST: "true"
41+
PUSH_ALL_REFS: "false"

0 commit comments

Comments
 (0)