-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[FEATURE]: Automate release steps as requested in #7500 #7502
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
Open
ADITYATIWARI342005
wants to merge
21
commits into
jaegertracing:main
Choose a base branch
from
ADITYATIWARI342005:feature/automate-release-steps-7500
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e347eeb
feat: automate release steps as requested in #7500
ADITYATIWARI342005 16698e0
fix: Implemented: wrapper for naming consistency; documented and wire…
ADITYATIWARI342005 85f2c94
feat(release): add prepare-release wrapper, tighten dry-run, implemen…
ADITYATIWARI342005 5407cad
fix : simplify start.sh and prepare.sh per review; remove tagging an…
ADITYATIWARI342005 28cbb07
Update Makefile
ADITYATIWARI342005 72eac69
Update scripts/release/prepare.sh
ADITYATIWARI342005 f56aebc
add prepare-release to makefile
ADITYATIWARI342005 c418a08
update the prepare.sh to removed --auto-tag feature
ADITYATIWARI342005 1125028
fix: restructure RELEASE.md properly; And update start.sh with the cu…
ADITYATIWARI342005 a10c5c0
Update scripts/release/prepare.sh
ADITYATIWARI342005 6670c0a
Update scripts/release/prepare.sh
ADITYATIWARI342005 bf85654
Update prepare.sh
ADITYATIWARI342005 dd35bf8
Merge branch 'main' into feature/automate-release-steps-7500
ADITYATIWARI342005 936cc39
Update RELEASE.md, add the bash script from start.sh to release.md
ADITYATIWARI342005 28b09de
Update start.sh, remove bash script
ADITYATIWARI342005 e6f6f2a
Merge branch 'main' into feature/automate-release-steps-7500
ADITYATIWARI342005 17708d1
Update scripts/release/prepare.sh
ADITYATIWARI342005 949ae12
feat: automate release steps with changelog, UI upgrade, and tag crea…
ADITYATIWARI342005 b424cd6
fix logic in prepare.sh
ADITYATIWARI342005 7eb57a8
Delete scripts/release/utils.sh
ADITYATIWARI342005 8512f26
Update Makefile, remove makefile target for prepare-release as instru…
ADITYATIWARI342005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,289 @@ | ||
#!/usr/bin/env bash | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
# Copyright (c) 2025 The Jaeger Authors. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Automated release preparation script (argument-driven) | ||
|
||
set -euo pipefail | ||
|
||
# Source utility functions | ||
source "$(dirname "$0")/utils.sh" | ||
|
||
# Configuration | ||
REPO="jaegertracing/jaeger" | ||
DRY_RUN=false | ||
TRACKING_ISSUE="" | ||
|
||
usage() { | ||
cat << EOF | ||
Usage: $0 [OPTIONS] <v1_version> <v2_version> | ||
Automated release script for Jaeger | ||
OPTIONS: | ||
-d, --dry-run Run in dry-run mode (no actual changes) | ||
--tracking-issue Link to the main tracking issue (e.g., #1234) | ||
-h, --help Show this help message | ||
EOF | ||
} | ||
|
||
# Parse command line arguments | ||
POSITIONAL=() | ||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
-d|--dry-run) | ||
DRY_RUN=true | ||
shift | ||
;; | ||
--tracking-issue) | ||
TRACKING_ISSUE="$2" | ||
shift 2 | ||
;; | ||
-h|--help) | ||
usage | ||
exit 0 | ||
;; | ||
*) | ||
POSITIONAL+=("$1") | ||
shift | ||
;; | ||
esac | ||
done | ||
set -- "${POSITIONAL[@]}" | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
# Expect explicit versions as positional args (provided by start.sh substitutions) | ||
if [[ $# -ne 2 ]]; then | ||
log_error "Expected two arguments: <v1_version> <v2_version>" | ||
usage | ||
exit 1 | ||
fi | ||
new_version_v1="$1" | ||
new_version_v2="$2" | ||
|
||
initialize_and_update_main() { | ||
if [[ "$DRY_RUN" == "true" ]]; then | ||
log_info "DRY RUN: Skipping repository validation and git sync" | ||
return 0 | ||
fi | ||
validate_repository | ||
git fetch upstream | ||
git checkout main | ||
git pull --ff-only upstream main | ||
} | ||
|
||
validate_environment() { | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
if [[ "$DRY_RUN" == "true" ]]; then | ||
log_info "DRY RUN: Skipping GitHub CLI validation" | ||
return 0 | ||
fi | ||
validate_gh_cli | ||
} | ||
|
||
|
||
determine_current_versions() { | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
read -r current_v1 current_v2 <<< "$(get_current_versions)" | ||
log_info "Current versions: $current_v1 / $current_v2" | ||
if [[ -z "${current_v1:-}" || -z "${current_v2:-}" ]]; then | ||
log_error "Failed to determine current versions (v1='${current_v1:-}', v2='${current_v2:-}')." | ||
log_error "Ensure 'get_current_versions' returns both versions in 'vX.Y.Z vA.B.C' format." | ||
exit 1 | ||
fi | ||
} | ||
|
||
|
||
validate_semver_increment() { | ||
local new_version="$1" | ||
local current_version="$2" | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
# Expect format vX.Y.Z | ||
if ! [[ "$new_version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
log_error "Version $new_version does not follow semantic versioning format (vX.Y.Z)" | ||
return 1 | ||
fi | ||
# No monotonicity check; start.sh is the source of truth | ||
return 0 | ||
} | ||
|
||
normalize_and_validate_versions() { | ||
|
||
new_version_v1=$(echo "$new_version_v1" | sed 's/^v//') | ||
new_version_v1="v$new_version_v1" | ||
new_version_v2=$(echo "$new_version_v2" | sed 's/^v//') | ||
new_version_v2="v$new_version_v2" | ||
validate_semver_increment "$new_version_v1" "$current_v1" || exit 1 | ||
validate_semver_increment "$new_version_v2" "$current_v2" || exit 1 | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} | ||
|
||
generate_changelog() { | ||
log_info "Generating changelog..." | ||
temp_changelog=$(mktemp) | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
trap "rm -f \"$temp_changelog\"" EXIT | ||
if make changelog > "$temp_changelog" 2>/dev/null; then | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
log_success "Changelog generated successfully" | ||
else | ||
log_warning "make changelog failed, using fallback template" | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
cat > "$temp_changelog" << EOF | ||
## Changes since last release | ||
### ✨ New Features | ||
- Automated release process implementation | ||
### 🛠️ Bug Fixes | ||
- Various bug fixes and improvements | ||
### 📚 Documentation | ||
- Updated release documentation | ||
EOF | ||
fi | ||
} | ||
|
||
update_ui_submodule() { | ||
log_info "Updating UI submodule to latest version..." | ||
if [[ "$DRY_RUN" == "true" ]]; then | ||
log_info "DRY RUN: Skipping UI submodule update" | ||
else | ||
git submodule init | ||
git submodule update | ||
if [[ ! -d "jaeger-ui" ]]; then | ||
log_error "jaeger-ui submodule not found" | ||
exit 1 | ||
fi | ||
pushd jaeger-ui || { log_error "Failed to enter jaeger-ui directory"; exit 1; } | ||
git checkout main || { log_error "Failed to checkout main branch in UI submodule"; popd; exit 1; } | ||
git pull || { log_error "Failed to pull latest changes in UI submodule"; popd; exit 1; } | ||
popd | ||
log_success "UI submodule updated to latest" | ||
fi | ||
} | ||
|
||
create_release_branch() { | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
branch_name="release-prep-${new_version_v1}-${new_version_v2}" | ||
if [[ "$DRY_RUN" == "true" ]]; then | ||
log_info "DRY RUN: Skipping branch creation: $branch_name" | ||
else | ||
git checkout -b "$branch_name" | ||
log_success "Created and switched to branch: $branch_name" | ||
fi | ||
} | ||
|
||
update_changelog_and_commit() { | ||
log_info "Updating CHANGELOG.md..." | ||
current_date=$(date +"%Y-%m-%d") | ||
if [[ "$DRY_RUN" == "true" ]]; then | ||
log_info "DRY RUN: Would update CHANGELOG.md with new version section" | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
else | ||
if [[ -f "CHANGELOG.md" ]]; then | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
temp_full_changelog=$(mktemp) | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
trap "rm -f \"$temp_full_changelog\"" EXIT | ||
echo "# ${new_version_v1} / ${new_version_v2} (${current_date})" > "$temp_full_changelog" | ||
echo "" >> "$temp_full_changelog" | ||
cat "$temp_changelog" >> "$temp_full_changelog" | ||
echo "" >> "$temp_full_changelog" | ||
cat "CHANGELOG.md" >> "$temp_full_changelog" | ||
mv "$temp_full_changelog" "CHANGELOG.md" | ||
git add "CHANGELOG.md" | ||
git add "jaeger-ui" | ||
git commit -m "Prepare release ${new_version_v1} / ${new_version_v2} | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- Updated CHANGELOG.md with new version section | ||
- Updated UI submodule to latest version | ||
- Generated changelog content using make changelog" | ||
log_success "CHANGELOG.md and UI submodule updated and committed" | ||
else | ||
log_error "CHANGELOG.md not found" | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
push_branch() { | ||
if [[ "$DRY_RUN" == "true" ]]; then | ||
log_info "DRY RUN: Skipping push of branch to origin" | ||
else | ||
git push -u origin "$branch_name" | ||
log_success "Pushed branch to origin" | ||
fi | ||
} | ||
|
||
open_pr_with_body() { | ||
pr_title="Prepare release ${new_version_v1} / ${new_version_v2}" | ||
pr_body="Prepare release ${new_version_v1} / ${new_version_v2}. | ||
This PR updates CHANGELOG.md with a new version section and bumps UI submodule." | ||
if [[ -n "$TRACKING_ISSUE" ]]; then | ||
pr_body+=$'\n\nPart of release tracking issue #'"$TRACKING_ISSUE"'' | ||
fi | ||
if [[ "$DRY_RUN" == "true" ]]; then | ||
log_info "DRY RUN: Skipping PR creation. Preview below:" | ||
echo "Title: $pr_title" | ||
echo "$pr_body" | ||
else | ||
pr_output=$(gh pr create \ | ||
--repo "$REPO" \ | ||
--title "$pr_title" \ | ||
--body "$pr_body" \ | ||
--base main \ | ||
--head "$branch_name") | ||
pr_exit_code=$? | ||
pr_url=$(echo "$pr_output" | tail -n 1) | ||
if [[ $pr_exit_code -eq 0 ]]; then | ||
log_success "Release PR created: $pr_url" | ||
gh pr edit "$pr_url" --add-label "changelog:skip" | ||
log_success "Added changelog:skip label" | ||
else | ||
log_error "Failed to create PR" | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
print_tag_commands() { | ||
cat << EOF | ||
git checkout main | ||
git pull | ||
git tag ${new_version_v1} -s # sign the v1 tag | ||
git tag ${new_version_v2} -s # sign the v2 tag | ||
git push upstream ${new_version_v1} ${new_version_v2} | ||
EOF | ||
} | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
create_release_tags() { | ||
if [[ "$DRY_RUN" == "true" ]]; then | ||
log_info "DRY RUN: Skipping tag creation and push for ${new_version_v1} ${new_version_v2}" | ||
return 0 | ||
fi | ||
git checkout main | ||
git pull --ff-only upstream main || git pull | ||
git tag "${new_version_v1}" -s -m "${new_version_v1}" | ||
git tag "${new_version_v2}" -s -m "${new_version_v2}" | ||
git push upstream "${new_version_v1}" "${new_version_v2}" | ||
} | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
# Main function | ||
main() { | ||
log_info "Starting automated release process..." | ||
if [[ "$DRY_RUN" != "true" ]]; then | ||
initialize_and_update_main | ||
validate_environment | ||
else | ||
log_info "DRY RUN: Skipping environment and repository setup" | ||
fi | ||
determine_current_versions | ||
ADITYATIWARI342005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
normalize_and_validate_versions | ||
generate_changelog | ||
update_ui_submodule | ||
create_release_branch | ||
update_changelog_and_commit | ||
push_branch | ||
open_pr_with_body | ||
log_success "Release PR creation completed!" | ||
log_info "Next: Review and merge the created PR, then follow the steps in the release issue to complete the release." | ||
|
||
log_info "Tag creation is documented in the tracking issue; no tagging performed here." | ||
} | ||
|
||
# Run main function | ||
main "$@" | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.