feat: combine build-k8s-images and push-k8s-images
Some checks failed
Build kubernetes images / build-images (push) Failing after 1m32s

This commit is contained in:
Александр Степченко 2024-04-05 16:54:18 +03:00
parent 31725ede8a
commit 89420ba75d
4 changed files with 65 additions and 97 deletions

View File

@ -4,14 +4,13 @@ on:
branches:
- test-gitea-actions
paths:
- ".gitea/**"
- ".gitea/workflows/build-k8s-images.yaml"
- "org/k8s/kube-apiserver/**"
- "org/k8s/kube-controller-manager/**"
- "org/k8s/kube-scheduler/**"
- "org/k8s/kube-proxy/**"
- "tags.toml"
- "build-k8s-images.sh"
- "push-k8s-images.sh"
- "k8s-images.sh"
schedule:
- cron: "30 3 1 * *"
@ -33,10 +32,10 @@ jobs:
uses: actions/checkout@v3
- name: Log into gitea.basealt.ru
run: podman login -u stepchenkoas -p "${{ secrets.ACTIONS_TOKEN }}" gitea.basealt.ru
# - name: Build docker images for p10 (kube-apiserver, kube-controller-manager, kube-scheduler, kube-proxy)
# run: ${{ gitea.workspace }}/build-k8s-images.sh gitea.basealt.ru k8s-p10 p10
# - name: Push docker images for p10 to gitea.basealt.ru
# run: ${{ gitea.workspace }}/push-k8s-images.sh gitea.basealt.ru k8s-p10 p10
- name: Build docker images for p10 (kube-apiserver, kube-controller-manager, kube-scheduler, kube-proxy)
run: ${{ gitea.workspace }}/build-k8s-images.sh gitea.basealt.ru k8s-p10 p10
- name: Push docker images for p10 to gitea.basealt.ru
run: ${{ gitea.workspace }}/push-k8s-images.sh gitea.basealt.ru k8s-p10 p10
- name: Build docker images for sisyphus (kube-apiserver, kube-controller-manager, kube-scheduler, kube-proxy)
run: ${{ gitea.workspace }}/build-k8s-images.sh gitea.basealt.ru k8s-sisyphus sisyphus
- name: Push docker images for sisyphus to gitea.basealt.ru

View File

@ -1,45 +0,0 @@
#!/usr/bin/env sh
set -xeuo pipefail
function usage() {
echo "usage:"
echo "$0 <REGISTRY> <ORGANIZATION> <BRANCH>"
}
if test "$#" -lt 3; then
usage
exit 1
fi
REGISTRY=${1:-"gitea.basealt.ru"}
ORGANIZATION=${2:-"k8s-sisyphus"}
BRANCH=${3:-"sisyphus"}
shift 3
function build() {
./build.py \
--branches $BRANCH \
--latest $BRANCH \
--registry $REGISTRY \
--overwrite-organization $ORGANIZATION \
--images k8s/kube-apiserver k8s/kube-controller-manager k8s/kube-scheduler k8s/kube-proxy \
--tags tags.toml \
--skip-stages push \
"$@"
}
if test "$BRANCH" == "p10"; then
build
exit 0
fi
for version in 1.22.17 1.23.17 1.24.17 1.25.16 1.26.14 1.27.11 1.28.7; do
sed -i "s/kubernetes.*-/kubernetes${version::4}-/g" org/k8s/kube-*/*
sed -i "s/sisyphus = \[ \"v.*\" \]/sisyphus = \[ \"v$version\" \]/g" tags.toml
build "$@"
done

59
k8s-images.sh Executable file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env sh
set -xeuo pipefail
function print_help() {
cat <<EOF
usage:
$0 (build | push) <REGISTRY> <ORGANIZATION> <BRANCH>
EOF
}
if [ "$#" -lt 4 ]; then
print_help
exit 1
fi
COMMAND=$1
REGISTRY=${2:-"gitea.basealt.ru"}
ORGANIZATION=${3:-"k8s-sisyphus"}
BRANCH=${4:-"sisyphus"}
shift 4
[ "$COMMAND" == 'build' ] || [ "$COMMAND" == 'push' ] || exit 1
function build() {
./build.py \
--branches $BRANCH \
--latest $BRANCH \
--registry $REGISTRY \
--overwrite-organization $ORGANIZATION \
--images k8s/kube-apiserver k8s/kube-controller-manager k8s/kube-scheduler k8s/kube-proxy \
--tags tags.toml \
--skip-stages push \
"$@"
}
function push() {
./build.py \
--branches $BRANCH \
--latest $BRANCH \
--registry $REGISTRY \
--overwrite-organization $ORGANIZATION \
--images k8s/kube-apiserver k8s/kube-controller-manager k8s/kube-scheduler k8s/kube-proxy \
--tags tags.toml \
--stages push \
"$@"
}
for version in 1.26.14 1.27.12 1.28.8; do
sed -i "s/kubernetes.*-/kubernetes${version::4}-/g" org/k8s/kube-*/*
sed -i "s/$BRANCH = \[ \"v.*\" \]/$BRANCH = \[ \"v$version\" \]/g" tags.toml
if [ "$COMMAND" == 'build' ]; then
build "$@"
elif [ "$COMMAND" == 'push' ]; then
push "$@"
fi
done

View File

@ -1,45 +0,0 @@
#!/usr/bin/env sh
set -xeuo pipefail
function usage() {
echo "usage:"
echo "$0 <REGISTRY> <ORGANIZATION> <BRANCH>"
}
if test "$#" -lt 3; then
usage
exit 1
fi
REGISTRY=${1:-"gitea.basealt.ru"}
ORGANIZATION=${2:-"k8s-sisyphus"}
BRANCH=${3:-"sisyphus"}
shift 3
function push() {
./build.py \
--branches $BRANCH \
--latest $BRANCH \
--registry $REGISTRY \
--overwrite-organization $ORGANIZATION \
--images k8s/kube-apiserver k8s/kube-controller-manager k8s/kube-scheduler k8s/kube-proxy \
--tags tags.toml \
--stages push \
"$@"
}
if test "$BRANCH" == "p10"; then
push
exit 0
fi
for version in 1.22.17 1.23.17 1.24.17 1.25.16 1.26.14 1.27.11 1.28.7; do
sed -i "s/kubernetes.*-/kubernetes${version::4}-/g" org/k8s/kube-*/*
sed -i "s/sisyphus = \[ \"v.*\" \]/sisyphus = \[ \"v$version\" \]/g" tags.toml
push "$@"
done