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

ci(chore): build arm binary in release and docker #14969

Merged
merged 6 commits into from
Feb 4, 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
8 changes: 7 additions & 1 deletion ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ services:
volumes:
- ..:/risingwave

release-env:
release-env-x86:
# build binaries on a earlier Linux distribution (therefore with earlier version GLIBC)
# See https://github.com/risingwavelabs/risingwave/issues/4556 for more details.
#
Expand All @@ -132,6 +132,12 @@ services:
volumes:
- ..:/mnt

release-env-arm:
image: quay.io/pypa/manylinux2014_aarch64
working_dir: /mnt
volumes:
- ..:/mnt

elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
Expand Down
50 changes: 31 additions & 19 deletions ci/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,30 @@
set -euo pipefail

REPO_ROOT=${PWD}
ARCH="$(uname -m)"

echo "--- Check env"
if [ "${BUILDKITE_SOURCE}" != "schedule" ] && [ "${BUILDKITE_SOURCE}" != "webhook" ] && [[ -z "${BINARY_NAME+x}" ]]; then
exit 0
fi

echo "--- Install aws cli"
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
curl "https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip && ./aws/install && mv /usr/local/bin/aws /bin/aws

echo "--- Install lld"
# The lld in the CentOS 7 repository is too old and contains a bug that causes a linker error.
# So we install a newer version here. (17.0.6, latest version at the time of writing)
# It is manually built in the same environent and uploaded to S3.
aws s3 cp s3://ci-deps-dist/llvm-lld-manylinux2014_x86_64.tar.gz .
tar -zxvf llvm-lld-manylinux2014_x86_64.tar.gz --directory=/usr/local
aws s3 cp s3://ci-deps-dist/llvm-lld-manylinux2014_${ARCH}.tar.gz .
tar -zxvf llvm-lld-manylinux2014_${ARCH}.tar.gz --directory=/usr/local
ld.lld --version

echo "--- Install dependencies for openssl"
yum install -y perl-core

echo "--- Install java and maven"
yum install -y java-11-openjdk java-11-openjdk-devel wget python3 cyrus-sasl-devel
yum install -y java-11-openjdk java-11-openjdk-devel wget python3 python3-devel cyrus-sasl-devel
pip3 install toml-cli
wget https://ci-deps-dist.s3.amazonaws.com/apache-maven-3.9.3-bin.tar.gz && tar -zxvf apache-maven-3.9.3-bin.tar.gz
export PATH="${REPO_ROOT}/apache-maven-3.9.3/bin:$PATH"
Expand All @@ -40,8 +41,13 @@ source ci/scripts/common.sh
unset RUSTC_WRAPPER # disable sccache

echo "--- Install protoc3"
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
unzip -o protoc-3.15.8-linux-x86_64.zip -d protoc
PROTOC_ARCH=${ARCH}
if [ ${ARCH} == "aarch64" ]; then
# shellcheck disable=SC1068
PROTOC_ARCH="aarch_64"
fi
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-${PROTOC_ARCH}.zip
unzip -o protoc-3.15.8-linux-${PROTOC_ARCH}.zip -d protoc
mv ./protoc/bin/protoc /usr/local/bin/
mv ./protoc/include/* /usr/local/include/

Expand All @@ -63,11 +69,11 @@ cd target/release && chmod +x risingwave risectl

echo "--- Upload nightly binary to s3"
if [ "${BUILDKITE_SOURCE}" == "schedule" ]; then
tar -czvf risingwave-"$(date '+%Y%m%d')"-x86_64-unknown-linux.tar.gz risingwave
aws s3 cp risingwave-"$(date '+%Y%m%d')"-x86_64-unknown-linux.tar.gz s3://risingwave-nightly-pre-built-binary
tar -czvf risingwave-"$(date '+%Y%m%d')"-${ARCH}-unknown-linux.tar.gz risingwave
aws s3 cp risingwave-"$(date '+%Y%m%d')"-${ARCH}-unknown-linux.tar.gz s3://risingwave-nightly-pre-built-binary
elif [[ -n "${BINARY_NAME+x}" ]]; then
tar -czvf risingwave-${BINARY_NAME}-x86_64-unknown-linux.tar.gz risingwave
aws s3 cp risingwave-${BINARY_NAME}-x86_64-unknown-linux.tar.gz s3://risingwave-nightly-pre-built-binary
tar -czvf risingwave-${BINARY_NAME}-${ARCH}-unknown-linux.tar.gz risingwave
aws s3 cp risingwave-${BINARY_NAME}-${ARCH}-unknown-linux.tar.gz s3://risingwave-nightly-pre-built-binary
fi

echo "--- Build connector node"
Expand All @@ -88,23 +94,29 @@ if [[ -n "${BUILDKITE_TAG}" ]]; then
dnf install -y gh

echo "--- Release create"
gh release create "${BUILDKITE_TAG}" --notes "release ${BUILDKITE_TAG}" -d -p
response=$(gh api repos/risingwavelabs/risingwave/releases/tags/${BUILDKITE_TAG} 2>&1)
if [[ $response == *"Not Found"* ]]; then
echo "Tag ${BUILDKITE_TAG} does not exist. Creating release..."
gh release create "${BUILDKITE_TAG}" --notes "release ${BUILDKITE_TAG}" -d -p
else
echo "Tag ${BUILDKITE_TAG} already exists. Skipping release creation."
fi

echo "--- Release upload risingwave asset"
tar -czvf risingwave-"${BUILDKITE_TAG}"-x86_64-unknown-linux.tar.gz risingwave
gh release upload "${BUILDKITE_TAG}" risingwave-"${BUILDKITE_TAG}"-x86_64-unknown-linux.tar.gz
tar -czvf risingwave-"${BUILDKITE_TAG}"-${ARCH}-unknown-linux.tar.gz risingwave
gh release upload "${BUILDKITE_TAG}" risingwave-"${BUILDKITE_TAG}"-${ARCH}-unknown-linux.tar.gz

echo "--- Release upload risingwave debug info"
tar -czvf risingwave-"${BUILDKITE_TAG}"-x86_64-unknown-linux.dwp.tar.gz risingwave.dwp
gh release upload "${BUILDKITE_TAG}" risingwave-"${BUILDKITE_TAG}"-x86_64-unknown-linux.dwp.tar.gz
tar -czvf risingwave-"${BUILDKITE_TAG}"-${ARCH}-unknown-linux.dwp.tar.gz risingwave.dwp
gh release upload "${BUILDKITE_TAG}" risingwave-"${BUILDKITE_TAG}"-${ARCH}-unknown-linux.dwp.tar.gz

echo "--- Release upload risectl asset"
tar -czvf risectl-"${BUILDKITE_TAG}"-x86_64-unknown-linux.tar.gz risectl
gh release upload "${BUILDKITE_TAG}" risectl-"${BUILDKITE_TAG}"-x86_64-unknown-linux.tar.gz
tar -czvf risectl-"${BUILDKITE_TAG}"-${ARCH}-unknown-linux.tar.gz risectl
gh release upload "${BUILDKITE_TAG}" risectl-"${BUILDKITE_TAG}"-${ARCH}-unknown-linux.tar.gz

echo "--- Release upload risingwave-all-in-one asset"
tar -czvf risingwave-"${BUILDKITE_TAG}"-x86_64-unknown-linux-all-in-one.tar.gz risingwave libs
gh release upload "${BUILDKITE_TAG}" risingwave-"${BUILDKITE_TAG}"-x86_64-unknown-linux-all-in-one.tar.gz
tar -czvf risingwave-"${BUILDKITE_TAG}"-${ARCH}-unknown-linux-all-in-one.tar.gz risingwave libs
gh release upload "${BUILDKITE_TAG}" risingwave-"${BUILDKITE_TAG}"-{ARCH}-unknown-linux-all-in-one.tar.gz
fi


Expand Down
22 changes: 20 additions & 2 deletions ci/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,36 @@ steps:
DOCKER_TOKEN: docker-token
retry: *auto-retry

- label: "pre build binary"
- label: "pre build binary: amd64"
command: "ci/scripts/release.sh"
plugins:
- seek-oss/aws-sm#v2.3.1:
env:
GITHUB_TOKEN: github-token
- docker-compose#v4.9.0:
run: release-env
run: release-env-x86
config: ci/docker-compose.yml
mount-buildkite-agent: true
propagate-environment: true
environment:
- BINARY_NAME
- GITHUB_TOKEN
retry: *auto-retry

- label: "pre build binary: aarch64 "
command: "ci/scripts/release.sh"
plugins:
- seek-oss/aws-sm#v2.3.1:
env:
GITHUB_TOKEN: github-token
- docker-compose#v4.9.0:
run: release-env-arm
config: ci/docker-compose.yml
mount-buildkite-agent: true
propagate-environment: true
environment:
- BINARY_NAME
- GITHUB_TOKEN
agents:
queue: "linux-arm64"
retry: *auto-retry
24 changes: 22 additions & 2 deletions ci/workflows/main-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -843,15 +843,15 @@ steps:
timeout_in_minutes: 10
retry: *auto-retry

- label: "release"
- label: "release amd64"
command: "ci/scripts/release.sh"
if: build.tag != null
plugins:
- seek-oss/aws-sm#v2.3.1:
env:
GITHUB_TOKEN: github-token
- docker-compose#v4.9.0:
run: release-env
run: release-env-x86
config: ci/docker-compose.yml
mount-buildkite-agent: true
environment:
Expand All @@ -861,6 +861,26 @@ steps:
timeout_in_minutes: 60
retry: *auto-retry

- label: "release aarch64"
command: "ci/scripts/release.sh"
if: build.tag != null
plugins:
- seek-oss/aws-sm#v2.3.1:
env:
GITHUB_TOKEN: github-token
- docker-compose#v4.9.0:
run: release-env-arm
config: ci/docker-compose.yml
mount-buildkite-agent: true
environment:
- GITHUB_TOKEN
- BUILDKITE_TAG
- BUILDKITE_SOURCE
agents:
queue: "linux-arm64"
timeout_in_minutes: 60
retry: *auto-retry

- label: "release docker image: amd64"
command: "ci/scripts/docker.sh"
key: "build-amd64"
Expand Down
Loading