Skip to content

Commit 807f3a2

Browse files
committed
cicd: update docker push
1 parent 6b6c5ae commit 807f3a2

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

.cicd/deploy.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,21 @@ git_prod() {
6363
# Push built images to quay.io
6464
docker_push() {
6565
echo ${FUNCNAME[0]}
66+
echo "$quaybot_password" | docker login quay.io -u "$quaybot_username" --password-stdin
67+
branch_tag="branch_${branch}"
68+
if [ "${branch}" = "master" ]
69+
then
70+
branch_tag="branch_production"
71+
docker tag "quay.io/wikipedialibrary/twlight:local" "quay.io/wikipedialibrary/twlight:${branch_tag}"
72+
docker tag "quay.io/wikipedialibrary/twlight_syslog:local" "quay.io/wikipedialibrary/twlight_syslog:${branch_tag}"
73+
fi
6674
declare -a repositories=("twlight" "twlight_syslog")
6775
for repo in "${repositories[@]}"
6876
do
6977
docker push quay.io/wikipedialibrary/${repo}:commit_${commit}
70-
docker push quay.io/wikipedialibrary/${repo}:branch_${branch}
78+
docker push quay.io/wikipedialibrary/${repo}:${branch_tag}
7179
done
80+
docker logout quay.io
7281
}
7382

7483
if [ "${event_name}" = "push" ] && [ -n "${twlight_missing_migrations:-}" ]
@@ -102,15 +111,7 @@ then
102111
echo "pushed to production"
103112
fi
104113
# Push built images to quay.io
105-
# login if we have container registry credentials
106-
if [ -n "${quaybot_username}" ] && [ -n "${quaybot_password}" ]
107-
then
108-
echo "$quaybot_password" | docker login quay.io -u "$cr_username" --password-stdin
109-
docker_push
110-
docker logout quay.io
111-
else
112-
docker_push
113-
fi
114+
docker_push
114115
fi
115116
fi
116117
fi

.github/workflows/cicd.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ jobs:
1515
with:
1616
persist-credentials: false
1717
fetch-depth: 0
18-
- uses: docker/login-action@v2
19-
with:
20-
registry: quay.io
21-
username: ${{ secrets.QUAYBOT_USERNAME }}
22-
password: ${{ secrets.QUAYBOT_PASSWORD }}
2318
- name: build & run
2419
run: >
2520
sudo .cicd/build.sh
@@ -45,6 +40,8 @@ jobs:
4540
${GITHUB_EVENT_NAME}
4641
${GITHUB_REPOSITORY}
4742
${{ secrets.WIKIBOT_TOKEN }}
43+
${{ secrets.QUAYBOT_USERNAME }}
44+
${{ secrets.QUAYBOT_PASSWORD }}
4845
- name: cleanup
4946
if: always()
5047
run: sudo chown -R ${USER}:${USER} .

0 commit comments

Comments
 (0)