-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mirror correctly images from docker.io to quay
This commit fixes the references to container images hosted in docker.io that might hit limit-rate issues.
- Loading branch information
Showing
22 changed files
with
141 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
# This job will mirror some container | ||
# images from docker.io to quay.io | ||
name: quay_mirror | ||
on: | ||
# Run the mirror every week | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
jobs: | ||
build: | ||
if: github.repository_owner == 'Kubeinit' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [3.9] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
sudo apt update -y | ||
sudo apt install jq -y | ||
sudo apt-get install skopeo | ||
- name: Mirror to quay | ||
run: | | ||
chmod +x ./ci/container_sync.sh | ||
sudo QUAY_BOT_USER=${{ secrets.QUAY_BOT_USER }} \ | ||
QUAY_BOT_KEY=${{ secrets.QUAY_BOT_KEY }} \ | ||
./ci/container_sync.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
############################################################################# | ||
# # | ||
# Copyright kubeinit contributors. # | ||
# # | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may # | ||
# not use this file except in compliance with the License. You may obtain # | ||
# a copy of the License at: # | ||
# # | ||
# http://www.apache.org/licenses/LICENSE-2.0 # | ||
# # | ||
# Unless required by applicable law or agreed to in writing, software # | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # | ||
# License for the specific language governing permissions and limitations # | ||
# under the License. # | ||
# # | ||
############################################################################# | ||
|
||
# NOTE: | ||
# If there is the need of adding more container images | ||
# to quay.io/kubeinit, then: | ||
# - Make sure the repository is already created | ||
# and the visibility is public, for example that | ||
# https://quay.io/repository/kubeinit/haproxy exists. | ||
# - Make sure the bot (kubeinit+sync) have write access | ||
# to that repository. | ||
|
||
if [ -z "$QUAY_BOT_USER" ]; then | ||
echo "QUAY_BOT_USER is not set"; | ||
exit 1; | ||
fi | ||
|
||
if [ -z "$QUAY_BOT_KEY" ]; then | ||
echo "QUAY_BOT_KEY is not set"; | ||
exit 1; | ||
fi | ||
|
||
user=$QUAY_BOT_USER | ||
token=$QUAY_BOT_KEY | ||
|
||
skopeo login quay.io -u$user -p$token | ||
|
||
# Add here all the images to be syncronized to the main | ||
# quay organization in Kubeinit | ||
declare -a container_images=( | ||
"library haproxy 2.3" | ||
"library registry 2" | ||
"library httpd 2.4" | ||
"library nginx latest" | ||
"library debian 11" | ||
"library ubuntu focal" | ||
"library ubuntu jammy" | ||
"internetsystemsconsortium bind9 9.18" | ||
"sonatype nexus3 3.30.0" | ||
) | ||
|
||
retry() { | ||
local -r -i max_attempts="$1"; shift | ||
local -r cmd="$@" | ||
local -i attempt_num=1 | ||
until $cmd; do | ||
if ((attempt_num==max_attempts)) | ||
then | ||
echo "Attempt $attempt_num failed and there are no more attempts left!" | ||
return 1 | ||
else | ||
echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..." | ||
sleep $((attempt_num++)) | ||
fi | ||
done | ||
} | ||
|
||
for image in "${container_images[@]}"; do | ||
read -a strarr <<< "$image" | ||
namespace=${strarr[0]} | ||
container=${strarr[1]} | ||
tag=${strarr[2]} | ||
|
||
copy="skopeo copy docker://docker.io/$namespace/$container:$tag docker://quay.io/kubeinit/$container:$tag" | ||
retry 5 $copy | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters