From ea7a3fe5a8303c04228301fc07aaa5d0d5e5bf22 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Tue, 15 Jul 2025 13:21:31 +0200 Subject: [PATCH 1/2] feat: Add script to perform release --- tooling/perform-release.sh | 92 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 tooling/perform-release.sh diff --git a/tooling/perform-release.sh b/tooling/perform-release.sh new file mode 100755 index 00000000000..bd77271d12a --- /dev/null +++ b/tooling/perform-release.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Ask for confirmation before continuing the release +function confirmOrAbort() { + read -p "Do you want to continue? (y/N): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Aborting." + exit 1 + fi +} + +# Check if current branch is either 'master' or 'release/v*' +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +if [[ "$CURRENT_BRANCH" == "master" ]]; then + MINOR_RELEASE=true +elif [[ "$CURRENT_BRANCH" =~ ^release/v[0-9]+\.[0-9]+\.x$ ]]; then + MINOR_RELEASE=false +else + echo "❌ Please check out either 'master' branch or a 'release/v*' branch to perform a release first." + exit 1 +fi +echo -n "✅ Current branch is '$CURRENT_BRANCH'. Performing a " +if [ "$MINOR_RELEASE" = true ]; then + echo "minor release." +else + echo "patch release." +fi + +# Check upstream branch is set +if ! git rev-parse --abbrev-ref --symbolic-full-name "@{u}" >/dev/null 2>&1; then + echo "❌ No upstream branch set. Please set the upstream branch for the current branch." + exit 1 +fi + +# Get the remote name +REMOTE=$(git config --get "branch.$CURRENT_BRANCH.remote") +if [ -z "$REMOTE" ]; then + echo "❌ Unable to determine the remote name. Please ensure you have a remote set." + exit 1 +fi + +# Check if working copy is clean +if ! git diff-index --quiet HEAD; then + echo "❌ Working copy is not clean. Please commit or stash your changes before performing a release." + exit 1 +fi + +# Check if clone is up to date +if ! git fetch "$REMOTE" --quiet ; then + echo "❌ Unable to fetch the latest changes from $REMOTE. Please check your network connection." + exit 1 +fi +if ! git diff-index --quiet "$REMOTE/$CURRENT_BRANCH"; then + echo "❌ Working copy is not up to date with $REMOTE/$CURRENT_BRANCH. Please pull the latest changes before performing a release." + exit 1 +fi +echo "✅ Working copy is clean and up-to-date." + +# Check the git log history +LAST_RELEASE_TAG=$(git describe --tags --abbrev=0 --match='v[0-9]*.[0-9]*.[0-9]*') +echo "ℹ️ Last release version: $LAST_RELEASE_TAG" +SUSPICIOUS_COMMITS=$(git log --oneline --first-parent "$LAST_RELEASE_TAG"..HEAD | grep -E -v "Merge pull request #" | grep -E -v "\(#") +if [ -n "$SUSPICIOUS_COMMITS" ]; then + echo "❌ The following commits are not merge commits and may not be suitable for a release:" + echo "$SUSPICIOUS_COMMITS" + echo "Please review these commits before proceeding with the release." + confirmOrAbort +else + echo "✅ All commits since the last release are merge commits." +fi + +# Get the next release version +VERSION=$(echo "$LAST_RELEASE_TAG" | grep -E '^v[0-9]+\.[0-9]+\.0$' | sed 's/^v//') +if [ -z "$VERSION" ]; then + echo "❌ Unable to determine the next release version from the last release tag: $LAST_RELEASE_TAG" + exit 1 +fi +if [ "$MINOR_RELEASE" = true ]; then + NEXT_RELEASE_VERSION=$(echo "$VERSION" | awk -F. '{printf "v%d.%d.0", $1, $2 + 1}') +else + NEXT_RELEASE_VERSION=$(echo "$VERSION" | awk -F. '{printf "v%d.%d.%d", $1, $2, $3 + 1}') +fi +echo "ℹ️ Next release version: $NEXT_RELEASE_VERSION" + +# Create and push the release tag +echo "ℹ️ The release tag will be created and pushed. No abort is possible after this point." +confirmOrAbort +git tag -a -s -m "Release $NEXT_RELEASE_VERSION" "$NEXT_RELEASE_VERSION" +git push "$REMOTE" "$NEXT_RELEASE_VERSION" --no-verify +echo "✅ Release tag $NEXT_RELEASE_VERSION created and pushed to $REMOTE." From d5ed76280b48dcb53a51bdda052d364a80470306 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 17 Jul 2025 14:36:45 +0200 Subject: [PATCH 2/2] feat(ci): Disable merge queue --- repository.datadog.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 repository.datadog.yaml diff --git a/repository.datadog.yaml b/repository.datadog.yaml new file mode 100644 index 00000000000..ded5018823b --- /dev/null +++ b/repository.datadog.yaml @@ -0,0 +1,4 @@ +--- +schema-version: v1 +kind: mergequeue +enable: false