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

add extra registries #1364

Merged
merged 3 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ jobs:
with:
node-version: '14'
- name: Docker login
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin
run: ${{ github.workspace }}/scripts/docker-login.sh
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_PASSWORD: "${{ secrets.DOCKER_PASSWORD }}"
DOCKER_USER: "${{ secrets.DOCKER_USER }}"
EXTRA_DOCKER_LOGINS: "${{ secrets.EXTRA_DOCKER_LOGINS }}"
- name: build changed
id: build_changed
uses: yehiyam/deploy-to-k8s@master
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
prNumber: ${{ github.event.deployment.payload.prNumber }}
branchName: ${{ github.event.ref }}
env:
EXTRA_PRIVATE_REGISTRIES: "${{ secrets.EXTRA_PRIVATE_REGISTRIES }}"

- uses: actions/upload-artifact@v2
with:
name: values.yaml
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ jobs:
scripts/runTestAndBuild.sh
fi
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_PASSWORD: "${{ secrets.DOCKER_PASSWORD }}"
DOCKER_USER: "${{ secrets.DOCKER_USER }}"
EXTRA_DOCKER_LOGINS: "${{ secrets.EXTRA_DOCKER_LOGINS }}"
EXTRA_PRIVATE_REGISTRIES: "${{ secrets.EXTRA_PRIVATE_REGISTRIES }}"
- name: trigger
if: env.CHANGED
id: trigger
Expand Down
15 changes: 6 additions & 9 deletions core/algorithm-builder/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,15 @@ then
BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}/"
fi
docker build -t ${TAG_VER} --build-arg BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}" -f ./dockerfile/Dockerfile .
if [ "${TRAVIS_PULL_REQUEST:-"false"}" == "false" ] || [ -z "${TRAVIS_PULL_REQUEST}" ]; then
TAG_CUR="${IMAGE_NAME}:latest"
docker tag ${TAG_VER} "${TAG_CUR}"
fi

if [ -v PRIVATE_REGISTRY ]
then
echo docker push ${TAG_VER}
docker push ${TAG_VER}
if [[ -v TAG_CUR ]]; then
echo docker push ${TAG_CUR}
docker push ${TAG_CUR}
fi
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
7 changes: 6 additions & 1 deletion core/algorithm-debug/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ then
echo docker push ${TAG_VER}
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
7 changes: 6 additions & 1 deletion core/algorithm-gateway/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ then
echo docker push ${TAG_VER}
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
7 changes: 6 additions & 1 deletion core/algorithm-operator/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ then
echo docker push ${TAG_VER}
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
14 changes: 6 additions & 8 deletions core/algorithm-queue/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ then
BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}/"
fi
docker build -t ${TAG_VER} --build-arg BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}" -f ./dockerfile/Dockerfile .
if [ "${TRAVIS_PULL_REQUEST:-"false"}" == "false" ] || [ -z "${TRAVIS_PULL_REQUEST}" ]; then
TAG_CUR="${IMAGE_NAME}:latest"
docker tag ${TAG_VER} "${TAG_CUR}"
fi

if [ -v PRIVATE_REGISTRY ]
then
echo docker push ${TAG_VER}
docker push ${TAG_VER}
if [[ -v TAG_CUR ]]; then
echo docker push ${TAG_CUR}
docker push ${TAG_CUR}
fi
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
6 changes: 6 additions & 0 deletions core/api-server/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ then
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
6 changes: 6 additions & 0 deletions core/datasources-service/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ then
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
6 changes: 6 additions & 0 deletions core/gc-service/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ then
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
6 changes: 6 additions & 0 deletions core/pipeline-driver-queue/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ then
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
14 changes: 6 additions & 8 deletions core/pipeline-driver/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ then
BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}/"
fi
docker build -t ${TAG_VER} --build-arg BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}" -f ./dockerfile/Dockerfile .
if [ "${TRAVIS_PULL_REQUEST:-"false"}" == "false" ] || [ -z "${TRAVIS_PULL_REQUEST}" ]; then
TAG_CUR="${IMAGE_NAME}:latest"
docker tag ${TAG_VER} "${TAG_CUR}"
fi

if [ -v PRIVATE_REGISTRY ]
then
echo docker push ${TAG_VER}
docker push ${TAG_VER}
if [[ -v TAG_CUR ]]; then
echo docker push ${TAG_CUR}
docker push ${TAG_CUR}
fi
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
14 changes: 6 additions & 8 deletions core/resource-manager/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ then
BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}/"
fi
docker build -t ${TAG_VER} --build-arg BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}" -f ./dockerfile/Dockerfile .
if [ "${TRAVIS_PULL_REQUEST:-"false"}" == "false" ] || [ -z "${TRAVIS_PULL_REQUEST}" ]; then
TAG_CUR="${IMAGE_NAME}:latest"
docker tag ${TAG_VER} "${TAG_CUR}"
fi

if [ -v PRIVATE_REGISTRY ]
then
echo docker push ${TAG_VER}
docker push ${TAG_VER}
if [[ -v TAG_CUR ]]; then
echo docker push ${TAG_CUR}
docker push ${TAG_CUR}
fi
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
6 changes: 6 additions & 0 deletions core/task-executor/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ then
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
14 changes: 6 additions & 8 deletions core/trigger-service/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ then
BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}/"
fi
docker build -t ${TAG_VER} --build-arg BASE_PRIVATE_REGISTRY="${BASE_PRIVATE_REGISTRY}" -f ./dockerfile/Dockerfile .
if [ "${TRAVIS_PULL_REQUEST:-"false"}" == "false" ] || [ -z "${TRAVIS_PULL_REQUEST}" ]; then
TAG_CUR="${IMAGE_NAME}:latest"
docker tag ${TAG_VER} "${TAG_CUR}"
fi

if [ -v PRIVATE_REGISTRY ]
then
echo docker push ${TAG_VER}
docker push ${TAG_VER}
if [[ -v TAG_CUR ]]; then
echo docker push ${TAG_CUR}
docker push ${TAG_CUR}
fi
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done
7 changes: 7 additions & 0 deletions core/worker/dockerfile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ then
docker push ${TAG_VER}
fi

for EXTRA_REGISTRY in $EXTRA_PRIVATE_REGISTRIES; do
EXTRA_TAG="${EXTRA_REGISTRY}/${REPO_NAME}:${VERSION}"
echo pushing also to ${EXTRA_TAG}
docker tag ${TAG_VER} ${EXTRA_TAG}
docker push ${EXTRA_TAG}
done

6 changes: 5 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash
set -xo pipefail
echo ${DOCKER_PASSWORD} | docker login --username yehiyam --password-stdin
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
$DIR/docker-login.sh
# add more registries (space delimited) (in CI env for instance)
# export EXTRA_PRIVATE_REGISTRIES="ghcr.io/kube-hpc"
export EXTRA_PRIVATE_REGISTRIES=${EXTRA_PRIVATE_REGISTRIES}
echo ${CHANGED}
for REPO in ${CHANGED}
do
Expand Down
8 changes: 8 additions & 0 deletions scripts/docker-login.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo login to docker.io
echo ${DOCKER_PASSWORD} | docker login --username ${DOCKER_USER} --password-stdin
# set extra docker credentials in EXTRA_DOCKER_LOGINS env. format: registry::username::password (space delimited)
for EXTRA_LOGIN in $EXTRA_DOCKER_LOGINS; do
args=(${EXTRA_LOGIN//::/ })
echo login to ${args[0]}
echo ${args[2]} | docker login ${args[0]} --username ${args[1]} --password-stdin
done