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

feat(ci): add fast-docker-build-arm workflow #18124

Merged
merged 7 commits into from
Aug 20, 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
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,15 @@ incremental = true
split-debuginfo = "packed"
lto = "off"

# Patch profile for production clusters.
# It will trade-off lto for faster build time.
[profile.patch-production]
inherits = "production"
debug = "full"
incremental = false
split-debuginfo = "packed"
lto = "off"
Comment on lines +301 to +308
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment the reason for other changes: especially debug & split-debuginfo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I suppose we don't need those fields. We can just follow what production has set. Let me update it.


[profile.production]
inherits = "release"
incremental = false
Expand Down
6 changes: 5 additions & 1 deletion ci/scripts/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -euo pipefail
ghcraddr="ghcr.io/risingwavelabs/risingwave"
dockerhubaddr="risingwavelabs/risingwave"
arch="$(uname -m)"
CARGO_PROFILE=${CARGO_PROFILE:-production}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will still default to production, only in the fast docker build we will use release profile.


echo "--- ghcr login"
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
Expand All @@ -23,12 +24,15 @@ fi

# Build RisingWave docker image ${BUILDKITE_COMMIT}-${arch}
echo "--- docker build and tag"
echo "CARGO_PROFILE is set to ${CARGO_PROFILE}"
docker buildx create \
--name container \
--driver=docker-container

docker buildx build -f docker/Dockerfile \
--build-arg "GIT_SHA=${BUILDKITE_COMMIT}" -t "${ghcraddr}:${BUILDKITE_COMMIT}-${arch}" \
--build-arg "GIT_SHA=${BUILDKITE_COMMIT}" \
--build-arg "CARGO_PROFILE=${CARGO_PROFILE}" \
-t "${ghcraddr}:${BUILDKITE_COMMIT}-${arch}" \
--progress plain \
--builder=container \
--load \
Expand Down
2 changes: 2 additions & 0 deletions ci/scripts/multi-arch-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ if [ "${SKIP_TARGET_AARCH64:-false}" != "true" ]; then
arches+=("aarch64")
fi

echo "--- arches: ${arches[*]}"

# push images to gchr
function pushGchr() {
GHCRTAG="${ghcraddr}:$1"
Expand Down
33 changes: 33 additions & 0 deletions ci/workflows/docker-arm-fast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
auto-retry: &auto-retry
automatic:
# Agent terminated because the AWS EC2 spot instance killed by AWS.
- signal_reason: agent_stop
limit: 3

steps:
- label: "docker-build-push: aarch64"
if: build.env("SKIP_TARGET_AARCH64") != "true"
command: "CARGO_PROFILE=patch-production ci/scripts/docker.sh"
key: "build-aarch64"
plugins:
- seek-oss/aws-sm#v2.3.1:
env:
GHCR_USERNAME: ghcr-username
GHCR_TOKEN: ghcr-token
DOCKER_TOKEN: docker-token
GITHUB_TOKEN: github-token
agents:
queue: "linux-arm64"
retry: *auto-retry

- label: "multi-arch-image-create-push"
command: "SKIP_TARGET_AMD64=true ci/scripts/multi-arch-docker.sh"
depends_on:
- "build-aarch64"
plugins:
- seek-oss/aws-sm#v2.3.1:
env:
GHCR_USERNAME: ghcr-username
GHCR_TOKEN: ghcr-token
DOCKER_TOKEN: docker-token
retry: *auto-retry
11 changes: 7 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,21 @@ FROM rust-base AS rust-builder
ARG GIT_SHA
ENV GIT_SHA=$GIT_SHA

ARG CARGO_PROFILE
ENV CARGO_PROFILE=$CARGO_PROFILE

COPY ./ /risingwave
WORKDIR /risingwave

ENV ENABLE_BUILD_DASHBOARD=1
ENV OPENSSL_STATIC=1

RUN cargo fetch && \
cargo build -p risingwave_cmd_all --profile production --features "rw-static-link" --features all-udf && \
cargo build -p risingwave_cmd_all --profile ${CARGO_PROFILE} --features "rw-static-link" --features all-udf && \
mkdir -p /risingwave/bin && \
mv /risingwave/target/production/risingwave /risingwave/bin/ && \
mv /risingwave/target/production/risingwave.dwp /risingwave/bin/ && \
cp ./target/production/build/tikv-jemalloc-sys-*/out/build/bin/jeprof /risingwave/bin/ && \
mv /risingwave/target/${CARGO_PROFILE}/risingwave /risingwave/bin/ && \
mv /risingwave/target/${CARGO_PROFILE}/risingwave.dwp /risingwave/bin/ && \
cp ./target/${CARGO_PROFILE}/build/tikv-jemalloc-sys-*/out/build/bin/jeprof /risingwave/bin/ && \
chmod +x /risingwave/bin/jeprof && \
mkdir -p /risingwave/lib && cargo clean

Expand Down
Loading