Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publish #9

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 4 additions & 72 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,69 +34,8 @@ parameters:
type: string
default: ""

executors:
openjdk-executor-17:
docker:
- image: cimg/openjdk:17.0

jobs:
build-and-push:
executor: openjdk-executor-17
steps:
- checkout
- setup_remote_docker
- run:
name: Build Jar
command: make build
- run:
name: Push to Docker Hub
command: |
# login dataproxy dockerhub registry
docker login -u ${DOCKER_DEPLOY_USERNAME} -p ${DOCKER_DEPLOY_TOKEN}
# login dataproxy aliyun registry
docker login -u ${ALIYUN_DOCKER_USERNAME} -p ${ALIYUN_DOCKER_PASSWORD} secretflow-registry.cn-hangzhou.cr.aliyuncs.com
CIRCLETAG=$(echo ${CIRCLE_TAG} | sed 's/v//')

BUILDER_EXISTS=$(
docker buildx inspect dataproxy_image_buildx >/dev/null 2>&1
echo $?
)

if [ "$BUILDER_EXISTS" -eq 0 ]; then
echo "existing buildx builder: dataproxy_image_buildx"
docker buildx use dataproxy_image_buildx
else
echo "creating new buildx builder: dataproxy_image_buildx"
docker buildx create --name dataproxy_image_buildx --use
fi

remote_image="secretflow-registry.cn-hangzhou.cr.aliyuncs.com/secretflow/dataproxy:latest"
docker buildx build \
--platform linux/arm64,linux/amd64 \
--tag "${remote_image}" \
-f ./build/Dockerfiles/dataproxy.Dockerfile . \
--push

remote_image="secretflow/dataproxy:latest"
docker buildx build \
--platform linux/arm64,linux/amd64 \
--tag "${remote_image}" \
-f ./build/Dockerfiles/dataproxy.Dockerfile . \
--push

remote_image="secretflow-registry.cn-hangzhou.cr.aliyuncs.com/secretflow/dataproxy:${CIRCLETAG}"
docker buildx build \
--platform linux/arm64,linux/amd64 \
--tag "${remote_image}" \
-f ./build/Dockerfiles/dataproxy.Dockerfile . \
--push

remote_image="secretflow/dataproxy:${CIRCLETAG}"
docker buildx build \
--platform linux/arm64,linux/amd64 \
--tag "${remote_image}" \
-f ./build/Dockerfiles/dataproxy.Dockerfile . \
--push
lint:
# Use machine executor for convenient data sharing between the host and docker-compose cluster
docker:
Expand All @@ -117,7 +56,9 @@ workflows:
when:
equal: [ "release", << pipeline.parameters.GHA_Event >> ]
jobs:
- build-and-push:
- continuation/continue:
configuration_path: .circleci/release-config.yml
# This is mandatory to trigger a pipeline when pushing a tag
filters:
tags:
only: /^v.*/
Expand All @@ -137,13 +78,4 @@ workflows:
.bazelrc sdk-build-and-run true
WORKSPACE sdk-build-and-run true
- lint
sdk-publish-workflow:
when:
equal: [ "release", << pipeline.parameters.GHA_Event >> ]
jobs:
- continuation/continue:
configuration_path: .circleci/release-config.yml
# This is mandatory to trigger a pipeline when pushing a tag
filters:
tags:
only: /^v.*/

73 changes: 69 additions & 4 deletions .circleci/release-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ executors:
macos:
xcode: 15.1.0
resource_class: macos.m1.large.gen1
openjdk-executor-17:
docker:
- image: cimg/openjdk:17.0

commands:
pip_publish:
Expand All @@ -66,7 +69,65 @@ commands:
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
linux_publish:
build-and-push:
executor: openjdk-executor-17
steps:
- checkout
- setup_remote_docker
- run:
name: Build Jar
command: make build
- run:
name: Push to Docker Hub
command: |
# login dataproxy dockerhub registry
docker login -u ${DOCKER_DEPLOY_USERNAME} -p ${DOCKER_DEPLOY_TOKEN}
# login dataproxy aliyun registry
docker login -u ${ALIYUN_DOCKER_USERNAME} -p ${ALIYUN_DOCKER_PASSWORD} secretflow-registry.cn-hangzhou.cr.aliyuncs.com
CIRCLETAG=$(echo ${CIRCLE_TAG} | sed 's/v//')

BUILDER_EXISTS=$(
docker buildx inspect dataproxy_image_buildx >/dev/null 2>&1
echo $?
)

if [ "$BUILDER_EXISTS" -eq 0 ]; then
echo "existing buildx builder: dataproxy_image_buildx"
docker buildx use dataproxy_image_buildx
else
echo "creating new buildx builder: dataproxy_image_buildx"
docker buildx create --name dataproxy_image_buildx --use
fi

remote_image="secretflow-registry.cn-hangzhou.cr.aliyuncs.com/secretflow/dataproxy:latest"
docker buildx build \
--platform linux/arm64,linux/amd64 \
--tag "${remote_image}" \
-f ./build/Dockerfiles/dataproxy.Dockerfile . \
--push

remote_image="secretflow/dataproxy:latest"
docker buildx build \
--platform linux/arm64,linux/amd64 \
--tag "${remote_image}" \
-f ./build/Dockerfiles/dataproxy.Dockerfile . \
--push

remote_image="secretflow-registry.cn-hangzhou.cr.aliyuncs.com/secretflow/dataproxy:${CIRCLETAG}"
docker buildx build \
--platform linux/arm64,linux/amd64 \
--tag "${remote_image}" \
-f ./build/Dockerfiles/dataproxy.Dockerfile . \
--push

remote_image="secretflow/dataproxy:${CIRCLETAG}"
docker buildx build \
--platform linux/arm64,linux/amd64 \
--tag "${remote_image}" \
-f ./build/Dockerfiles/dataproxy.Dockerfile . \
--push

linux_sdk_publish:
parameters:
python_ver:
type: string
Expand All @@ -78,7 +139,7 @@ jobs:
- pip_publish:
python_ver: << parameters.python_ver >>

macOS_publish:
macOS_sdk_publish:
parameters:
python_ver:
type: string
Expand Down Expand Up @@ -106,7 +167,7 @@ jobs:
workflows:
publish:
jobs:
- linux_publish:
- linux_sdk_publish:
matrix:
parameters:
python_ver: ["3.9", "3.10", "3.11"]
Expand All @@ -115,7 +176,7 @@ workflows:
filters:
tags:
only: /^v.*/
- macOS_publish:
- macOS_sdk_publish:
matrix:
parameters:
python_ver: ["3.9", "3.10", "3.11"]
Expand All @@ -124,3 +185,7 @@ workflows:
filters:
tags:
only: /^v.*/
- build-and-push:
filters:
tags:
only: /^v.*/
Loading