Skip to content

Commit 1609bf5

Browse files
[release-4.1] fix: sync image to aliyuns repo (#4283)
fix: sync image to aliyuns repo Signed-off-by: joyceliu <[email protected]> Co-authored-by: liujian <[email protected]>
1 parent d7ed68c commit 1609bf5

File tree

2 files changed

+59
-26
lines changed

2 files changed

+59
-26
lines changed

.github/workflows/release.yml

+50-13
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,67 @@ on:
55
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
66
name: Build Release
77

8-
env:
9-
# TODO: Change variable to your image's name.
10-
IMAGE_NAME: ks-console
11-
IMAGE_REPO: kubesphere
12-
138
jobs:
14-
release-linux-amd64:
9+
release:
1510
runs-on: ubuntu-latest
1611
if: github.repository == 'kubesphere/console'
1712
steps:
1813
- uses: actions/checkout@v2
1914

15+
- name: Login to Aliyun
16+
uses: docker/login-action@v3
17+
with:
18+
registry: registry.cn-beijing.aliyuncs.com
19+
username: ${{ secrets.ALIYUNCS_USERNAME }}
20+
password: ${{ secrets.ALIYUNCS_PASSWORD }}
21+
22+
- name: Login to DOCKER
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
27+
2028
- name: Set up QEMU
21-
uses: docker/setup-qemu-action@v1
29+
uses: docker/setup-qemu-action@v3
2230
with:
2331
platforms: all
2432

2533
- name: Set up Docker buildx
26-
uses: docker/setup-buildx-action@v1
34+
uses: docker/setup-buildx-action@v3
2735

28-
- name: Log into registry
29-
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
36+
- name: Chose Registry by tag
37+
id: chose_registry
38+
run: |
39+
if [[ ${GITHUB_REF#refs/*/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
40+
echo "env=prod" >> "$GITHUB_OUTPUT"
41+
else
42+
echo "env=dev" >> "$GITHUB_OUTPUT"
43+
fi
44+
echo "tag=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"
3045
31-
- name: Push image
46+
- name: Generate output dir
3247
run: |
33-
TAG=${GITHUB_REF#refs/*/} REPO=$IMAGE_REPO make container-cross-push
34-
echo "Push $IMAGE success!"
48+
make container-cross
49+
50+
- name: Build and push ks-console images
51+
uses: docker/build-push-action@v6
52+
if: steps.chose_registry.outputs.env == 'prod'
53+
with:
54+
context: ${{ github.workspace }}
55+
file: build/Dockerfile.dapper
56+
platforms: linux/amd64,linux/arm64
57+
push: true
58+
tags: |
59+
docker.io/kubesphere/ks-console:${{ steps.chose_registry.outputs.tag }}
60+
registry.cn-beijing.aliyuncs.com/kubesphereio/ks-console:${{ steps.chose_registry.outputs.tag }}
61+
62+
- name: Build and push ks-console dev images
63+
uses: docker/build-push-action@v6
64+
if: steps.chose_registry.outputs.env == 'dev'
65+
with:
66+
context: ${{ github.workspace }}
67+
file: build/Dockerfile.dapper
68+
platforms: linux/amd64,linux/arm64
69+
push: true
70+
tags: |
71+
docker.io/kubespheredev/ks-console:${{ steps.chose_registry.outputs.tag }}

hack/docker_build_multiarch.sh

+9-13
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@ set -o pipefail
55

66
TAG=${TAG:-latest}
77
REPO=${REPO:-kubespheredev}
8-
PUSH=${PUSH:-}
8+
DRY_RUN=${DRY_RUN:-false}
99

1010
# support other container tools. e.g. podman
1111
CONTAINER_CLI=${CONTAINER_CLI:-docker}
1212
CONTAINER_BUILDER=${CONTAINER_BUILDER:-"buildx build"}
1313

14-
# If set, just building, no pushing
15-
if [[ -z "${DRY_RUN:-}" ]]; then
16-
PUSH="--push"
17-
fi
18-
1914
## supported platforms
2015
PLATFORMS=linux/amd64,linux/arm64
2116

@@ -39,10 +34,11 @@ mv "$PROJECT_DIR"/server/locales \
3934
"$PROJECT_DIR"/server/sample \
4035
"$PROJECT_DIR"/server/configs "$PROJECT_DIR"/out/server/
4136

42-
# shellcheck disable=SC2086 # inteneded splitting of CONTAINER_BUILDER
43-
${CONTAINER_CLI} ${CONTAINER_BUILDER} \
44-
--platform ${PLATFORMS} \
45-
${PUSH} \
46-
-f build/Dockerfile.dapper \
47-
-t "${REPO}"/ks-console:"${TAG}" .
48-
37+
if [ "$DRY_RUN" = "false" ]; then
38+
# shellcheck disable=SC2086 # inteneded splitting of CONTAINER_BUILDER
39+
${CONTAINER_CLI} ${CONTAINER_BUILDER} \
40+
--platform ${PLATFORMS} \
41+
--push \
42+
-f build/Dockerfile.dapper \
43+
-t "${REPO}"/ks-console:"${TAG}" .
44+
fi

0 commit comments

Comments
 (0)