diff --git a/.gitea/workflows/build-k8s-images.yaml b/.gitea/workflows/build-k8s-images.yaml index a52c4c3..f8b5cfd 100644 --- a/.gitea/workflows/build-k8s-images.yaml +++ b/.gitea/workflows/build-k8s-images.yaml @@ -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 diff --git a/build-k8s-images.sh b/build-k8s-images.sh deleted file mode 100755 index 1f9fb1d..0000000 --- a/build-k8s-images.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env sh - -set -xeuo pipefail - -function usage() { - echo "usage:" - echo "$0 " -} - -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 diff --git a/k8s-images.sh b/k8s-images.sh new file mode 100755 index 0000000..cf7c7ed --- /dev/null +++ b/k8s-images.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env sh + +set -xeuo pipefail + +function print_help() { + cat < +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 diff --git a/push-k8s-images.sh b/push-k8s-images.sh deleted file mode 100755 index 35ee3fb..0000000 --- a/push-k8s-images.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env sh - -set -xeuo pipefail - -function usage() { - echo "usage:" - echo "$0 " -} - -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