Skip to content

Commit

Permalink
feat: add builder and runner multi arch packaging (#1773)
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Zhang <[email protected]>
  • Loading branch information
zzzhangqi authored Nov 1, 2023
1 parent bc37f89 commit 599a080
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 4 deletions.
39 changes: 35 additions & 4 deletions .github/scripts/push-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,41 @@ function push_arch_dind {
docker manifest push "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/rainbond:${RBD_VER/-release}-dind-allinone"
}

docker login "${DOMESTIC_NAME}" -u "$DOMESTIC_DOCKER_USERNAME" -p "$DOMESTIC_DOCKER_PASSWORD"
function push_arch_runner {
docker pull "$IMAGE_NAMESPACE/runner:${RBD_VER}" || exit 1
docker tag "$IMAGE_NAMESPACE/runner:${RBD_VER}" "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}-amd64"
docker push "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}-amd64"

docker pull "$IMAGE_NAMESPACE/runner:${RBD_VER}-arm64" || exit 1
docker tag "$IMAGE_NAMESPACE/runner:${RBD_VER}-arm64" "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}-arm64"
docker push "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}-arm64"

docker manifest rm "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}"
docker manifest create "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}" "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}-amd64" "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}-arm64"
docker manifest push "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/runner:${RBD_VER}"
}

function push_arch_builder {
docker pull "$IMAGE_NAMESPACE/builder:${RBD_VER}" || exit 1
docker tag "$IMAGE_NAMESPACE/builder:${RBD_VER}" "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}-amd64"
docker push "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}-amd64"

push_arch
docker pull "$IMAGE_NAMESPACE/builder:${RBD_VER}-arm64" || exit 1
docker tag "$IMAGE_NAMESPACE/builder:${RBD_VER}-arm64" "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}-arm64"
docker push "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}-arm64"

push_arch_allinone
docker manifest rm "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}"
docker manifest create "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}" "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}-amd64" "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}-arm64"
docker manifest push "$DOMESTIC_NAME/$DOMESTIC_NAMESPACE/builder:${RBD_VER}"
}

docker login "${DOMESTIC_NAME}" -u "$DOMESTIC_DOCKER_USERNAME" -p "$DOMESTIC_DOCKER_PASSWORD"

push_arch_dind
if [ "$1" = "builder-runner" ]; then
push_arch_runner
push_arch_builder
else
push_arch
push_arch_allinone
push_arch_dind
fi
55 changes: 55 additions & 0 deletions .github/workflows/bulider_runner_packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: builder runner packaging
on:
repository_dispatch:
types:
- runner-builder

env:
VERSION: ${{ github.event.client_payload.version }}

jobs:
build-runner:
runs-on: ${{ github.event.client_payload.os }}
environment: ${{ github.event.client_payload.environment }}
steps:
- name: Pull code and Build the Docker image
env:
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
git clone -b ${{ github.event.client_payload.branch }} ${{ github.event.client_payload.clone_url }}/runner.git
cd runner
chmod +x ./release.sh
./release.sh
build-builder:
runs-on: ${{ github.event.client_payload.os }}
environment: ${{ github.event.client_payload.environment }}
steps:
- name: Pull code and Build the Docker image
env:
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
git clone -b ${{ github.event.client_payload.branch }} ${{ github.event.client_payload.clone_url }}/builder.git
cd builder
chmod +x ./release.sh
./release.sh
push-arch:
if: github.event.client_payload.os == 'self-hosted'
needs: [build-runner,build-builder]
runs-on: ${{ github.event.client_payload.os }}
environment: release-arch
steps:
- uses: actions/checkout@v2
- name: push arch images
env:
RBD_VER: ${{ vars.RBD_VER }}
DOMESTIC_DOCKER_USERNAME: ${{ vars.DOMESTIC_DOCKER_USERNAME }}
DOMESTIC_DOCKER_PASSWORD: ${{ secrets.DOMESTIC_DOCKER_PASSWORD }}
PUSH_ARCH: ${{ vars.PUSH_ARCH }}
run: |
if [ $PUSH_ARCH == 'true' ];then
chmod +x .github/scripts/push-arch.sh && ./.github/scripts/push-arch.sh builder-runner
fi

0 comments on commit 599a080

Please sign in to comment.