Repository: risingwavelabs/risingwave
File: ci/scripts/release.sh (Shell)

Code before:
    echo "CARGO_PKG_VERSION and BUILDKITE_TAG are not equal"
    exit 1
  fi
fi

echo "--- Build risingwave release binary"
export ENABLE_BUILD_DASHBOARD=1
if [ "${ARCH}" == "aarch64" ]; then
  # enable large page size support for jemalloc
  # see https://github.com/tikv/jemallocator/blob/802969384ae0c581255f3375ee2ba774c8d2a754/jemalloc-sys/build.rs#L218
  export JEMALLOC_SYS_WITH_LG_PAGE=16
fi

cargo build -p risingwave_cmd_all --features "rw-static-link" --features udf --features openssl-vendored --profile production
cargo build -p risingwave_cmd --bin risectl --features "rw-static-link" --features openssl-vendored --profile production

echo "--- check link info"
check_link_info production

cd target/production && chmod +x risingwave risectl

if [ "${SKIP_RELEASE}" -ne 1 ]; then
  echo "--- Upload nightly binary to s3"
  if [ "${BUILDKITE_SOURCE}" == "schedule" ]; then
    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://rw-nightly-pre-built-binary
  elif [[ -n "${BINARY_NAME+x}" ]]; then
    tar -czvf risingwave-"${BINARY_NAME}"-"${ARCH}"-unknown-linux.tar.gz risingwave
    aws s3 cp risingwave-"${BINARY_NAME}"-"${ARCH}"-unknown-linux.tar.gz s3://rw-nightly-pre-built-binary
  fi
else
  echo "--- Skipped upload nightly binary"
fi

echo "--- Build connector node"
cd "${REPO_ROOT}"/java && mvn -B package -Dmaven.test.skip=true -Dno-build-rust

if [[ -n "${BUILDKITE_TAG}" ]]; then
  echo "--- Collect all release assets"
  cd "${REPO_ROOT}" && mkdir release-assets && cd release-assets
  cp -r "${REPO_ROOT}"/target/production/* .
  mv "${REPO_ROOT}"/java/connector-node/assembly/target/risingwave-connector-1.0.0.tar.gz risingwave-connector-"${BUILDKITE_TAG}".tar.gz
  tar -zxvf risingwave-connector-"${BUILDKITE_TAG}".tar.gz libs
  ls -l

  echo "--- Install gh cli"
  dnf install -y 'dnf-command(config-manager)'
  dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
  dnf install -y gh

  if [ "${SKIP_RELEASE}" -ne 1 ]; then

Review comment (suggestion):
The `check_link_info` function in `ci/scripts/common.sh:206` has a hardcoded check for the `"production"` profile. When calling it with `"thin-production"`, the libssl static linking check will be skipped. This should be updated to also include `"thin-production"` in the profile check, or use a pattern match to include all production-like profiles.
```suggestion
# Normalize profile name for link checking so that thin-production still
# triggers the production-level static linking checks in check_link_info.
LINK_CHECK_PROFILE="${CARGO_PROFILE}"
if [[ "${CARGO_PROFILE}" == thin-production* ]]; then
  LINK_CHECK_PROFILE="production"
fi

echo "--- Check link info"
check_link_info "${LINK_CHECK_PROFILE}"
```

Code after:
if [[ -n "${BUILDKITE_TAG}" ]]; then
  CARGO_PKG_VERSION="$(toml get --toml-path Cargo.toml workspace.package.version)"
  if [[ "${CARGO_PKG_VERSION}" != "${BUILDKITE_TAG#*v}" ]]; then
    echo "CARGO_PKG_VERSION: ${CARGO_PKG_VERSION}"
    echo "BUILDKITE_TAG: ${BUILDKITE_TAG}"
    echo "CARGO_PKG_VERSION and BUILDKITE_TAG are not equal"
    exit 1
  fi
fi

echo "--- Build risingwave release binary"
source ci/scripts/common.sh
unset RUSTC_WORKSPACE_WRAPPER # disable rustc-workspace-wrapper, for coverage instrumentation

export ENABLE_BUILD_DASHBOARD=1
if [ "${ARCH}" == "aarch64" ]; then
  # enable large page size support for jemalloc
  # see https://github.com/tikv/jemallocator/blob/802969384ae0c581255f3375ee2ba774c8d2a754/jemalloc-sys/build.rs#L218
  export JEMALLOC_SYS_WITH_LG_PAGE=16
fi

cargo build -p risingwave_cmd_all --features "rw-static-link" --features udf --features openssl-vendored --profile "${CARGO_PROFILE}"
cargo build -p risingwave_cmd --bin risectl --features "rw-static-link" --features openssl-vendored --profile "${CARGO_PROFILE}"

echo "--- Check link info"
check_link_info "${CARGO_PROFILE}"

echo "--- Show sccache stats"
sccache --show-stats
sccache --zero-stats

echo "--- Check binary size"
cd target/"${CARGO_PROFILE}" && chmod +x risingwave risectl
du -sh risingwave* risectl

if [ "${SKIP_RELEASE}" -ne 1 ]; then
  echo "--- Upload nightly binary to s3"
  if [ "${BUILDKITE_SOURCE}" == "schedule" ]; then
    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://rw-nightly-pre-built-binary
  elif [[ -n "${BINARY_NAME+x}" ]]; then
    tar -czvf risingwave-"${BINARY_NAME}"-"${ARCH}"-unknown-linux.tar.gz risingwave
    aws s3 cp risingwave-"${BINARY_NAME}"-"${ARCH}"-unknown-linux.tar.gz s3://rw-nightly-pre-built-binary
  fi
else
  echo "--- Skipped upload nightly binary"
fi

echo "--- Build connector node"
cd "${REPO_ROOT}"/java && mvn -B package -Dmaven.test.skip=true -Dno-build-rust