Skip to content

Commit fb661fb

Browse files
committed
add CHANGELOG.md (#1187)
*Issue #, if available:* *Description of changes:* Add CHANGELOG.md to track future features and fixes made to ADOT. Updated pr-build.yml workflow to check that CHANGELOG.md has been updated for all changes that affect SDK behavior. Updated pre-release-prepare.yml workflow to update CHANGELOG in both release series branch, moving the Unreleased changes under a header for the new release version. Updated post-release-version-bump.yml to merge CHANGELOG back into main, resolving any conflicts. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 83edc98 commit fb661fb

File tree

4 files changed

+316
-0
lines changed

4 files changed

+316
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Post Release - Prepare Main for Next Development Cycle
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number (e.g., 1.0.1)'
8+
required: true
9+
is_patch:
10+
description: 'Is this a patch? (true or false)'
11+
required: true
12+
default: 'false'
13+
14+
env:
15+
AWS_DEFAULT_REGION: us-east-1
16+
17+
permissions:
18+
id-token: write
19+
contents: write
20+
pull-requests: write
21+
22+
jobs:
23+
check-version:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout main
27+
uses: actions/checkout@v2
28+
with:
29+
ref: main
30+
fetch-depth: 0
31+
32+
- name: Extract Major.Minor Version and setup Env variable
33+
run: |
34+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
35+
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
36+
37+
- name: Get current major.minor version from main branch
38+
id: get_version
39+
run: |
40+
CURRENT_VERSION=$(grep '__version__' aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | sed -E 's/__version__ = "([0-9]+\.[0-9]+)\.[0-9]+.*"/\1/')
41+
echo "CURRENT_MAJOR_MINOR_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
42+
43+
- name: Set major and minor for current version
44+
run: |
45+
echo "CURRENT_MAJOR=$(echo $CURRENT_MAJOR_MINOR_VERSION | cut -d. -f1)" >> $GITHUB_ENV
46+
echo "CURRENT_MINOR=$(echo $CURRENT_MAJOR_MINOR_VERSION | cut -d. -f2)" >> $GITHUB_ENV
47+
48+
- name: Set major and minor for input version
49+
run: |
50+
echo "INPUT_MAJOR=$(echo $MAJOR_MINOR | cut -d. -f1)" >> $GITHUB_ENV
51+
echo "INPUT_MINOR=$(echo $MAJOR_MINOR | cut -d. -f2)" >> $GITHUB_ENV
52+
53+
- name: Compare major.minor version and skip if behind
54+
run: |
55+
if [ "$CURRENT_MAJOR" -gt "$INPUT_MAJOR" ] || { [ "$CURRENT_MAJOR" -eq "$INPUT_MAJOR" ] && [ "$CURRENT_MINOR" -gt "$INPUT_MINOR" ]; }; then
56+
echo "Input version is behind main's current major.minor version, don't need to update major version"
57+
exit 1
58+
fi
59+
60+
61+
prepare-main:
62+
runs-on: ubuntu-latest
63+
needs: check-version
64+
steps:
65+
- name: Configure AWS credentials for BOT secrets
66+
uses: aws-actions/configure-aws-credentials@v4
67+
with:
68+
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
69+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
70+
71+
- name: Get Bot secrets
72+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
73+
id: bot_secrets
74+
with:
75+
secret-ids: |
76+
BOT_TOKEN ,${{ secrets.BOT_TOKEN_SECRET_ARN }}
77+
parse-json-secrets: true
78+
79+
- name: Setup Git
80+
uses: actions/checkout@v2
81+
with:
82+
fetch-depth: 0
83+
token: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
84+
85+
- name: Configure Git
86+
run: |
87+
git config user.name "github-actions"
88+
git config user.email "[email protected]"
89+
90+
- name: Extract Major.Minor Version and setup Env variable
91+
run: |
92+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
93+
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
94+
95+
- name: Determine release branch and checkout
96+
run: |
97+
RELEASE_BRANCH="release/v${MAJOR_MINOR}.x"
98+
git fetch origin $RELEASE_BRANCH
99+
git checkout -b "prepare-main-for-next-dev-cycle-${VERSION}" origin/$RELEASE_BRANCH
100+
101+
- name: Update version to next development version in main
102+
run: |
103+
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
104+
sed -i'' -e "s/val adotVersion = \".*\"/val adotVersion = \"${DEV_VERSION}\"/" version.gradle.kts
105+
VERSION="${{ github.event.inputs.version }}"
106+
sed -i'' -e 's/adot-autoinstrumentation-java:v2.*"/adot-autoinstrumentation-java:v'$VERSION'"/' .github/workflows/daily-scan.yml
107+
108+
# for patch releases, avoid merge conflict by manually resolving CHANGELOG with main
109+
if [[ "${{ github.event.inputs.is_patch }}" == "true" ]]; then
110+
# Copy the patch release entries
111+
sed -n "/^## v${VERSION}/,/^## v[0-9]/p" CHANGELOG.md | sed '$d' > /tmp/patch_release_section.txt
112+
git fetch origin main
113+
git show origin/main:CHANGELOG.md > CHANGELOG.md
114+
# Insert the patch release entries after Unreleased
115+
awk -i inplace '/^## v[0-9]/ && !inserted { system("cat /tmp/patch_release_section.txt"); inserted=1 } {print}' CHANGELOG.md
116+
fi
117+
118+
git add version.gradle.kts
119+
git add .github/workflows/daily-scan.yml
120+
git add CHANGELOG.md
121+
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
122+
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}"
123+
124+
- name: Create Pull Request to main
125+
env:
126+
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
127+
run: |
128+
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
129+
gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \
130+
--body "This PR prepares the main branch for the next development cycle by updating the version to $DEV_VERSION and updating the image version to be scanned to the latest released.
131+
132+
This PR should only be merge when release for version v$VERSION is success.
133+
134+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
135+
--head prepare-main-for-next-dev-cycle-${VERSION} \
136+
--base main
137+
138+
- name: Force our CHANGELOG to override merge conflicts
139+
run: |
140+
git merge origin/main || true
141+
git checkout --ours CHANGELOG.md
142+
git add CHANGELOG.md
143+
if ! git diff --quiet --cached; then
144+
git commit -m "Force our CHANGELOG to override merge conflicts"
145+
git push origin "prepare-main-for-next-dev-cycle-${VERSION}"
146+
fi

.github/workflows/pr-build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,55 @@
11
name: PR Build
22
on:
33
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
- labeled
9+
- unlabeled
410
branches:
511
- main
612
- "release/v*"
713
env:
814
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test-v2
915

1016
jobs:
17+
changelog-check:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Check CHANGELOG
25+
run: |
26+
# Check if PR is from workflows bot or dependabot
27+
if [[ "${{ github.event.pull_request.user.login }}" == "aws-application-signals-bot" ]]; then
28+
echo "Skipping check: PR from aws-application-signals-bot"
29+
exit 0
30+
fi
31+
32+
if [[ "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]]; then
33+
echo "Skipping check: PR from dependabot"
34+
exit 0
35+
fi
36+
37+
# Check for skip changelog label
38+
if echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' | jq -r '.[]' | grep -q "skip changelog"; then
39+
echo "Skipping check: skip changelog label found"
40+
exit 0
41+
fi
42+
43+
# Fetch base branch and check for CHANGELOG modifications
44+
git fetch origin ${{ github.base_ref }}
45+
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -q "CHANGELOG.md"; then
46+
echo "CHANGELOG.md entry found - check passed"
47+
exit 0
48+
fi
49+
50+
echo "It looks like you didn't add an entry to CHANGELOG.md. If this change affects the SDK behavior, please update CHANGELOG.md and link this PR in your entry. If this PR does not need a CHANGELOG entry, you can add the 'Skip Changelog' label to this PR."
51+
exit 1
52+
1153
testpatch:
1254
name: Test patches applied to dependencies
1355
runs-on: aws-otel-java-instrumentation_ubuntu-latest_32-core
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Pre Release Prepare - Update Version and Create PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number (e.g., 1.0.1)'
8+
required: true
9+
is_patch:
10+
description: 'Is this a patch? (true or false)'
11+
required: true
12+
default: 'false'
13+
14+
env:
15+
AWS_DEFAULT_REGION: us-east-1
16+
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
id-token: write
21+
22+
23+
jobs:
24+
update-version-and-create-pr:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Configure AWS credentials for BOT secrets
28+
uses: aws-actions/configure-aws-credentials@v4
29+
with:
30+
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
31+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
32+
33+
- name: Get Bot secrets
34+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
35+
id: bot_secrets
36+
with:
37+
secret-ids: |
38+
BOT_TOKEN ,${{ secrets.BOT_TOKEN_SECRET_ARN }}
39+
parse-json-secrets: true
40+
41+
- name: Checkout main branch
42+
uses: actions/checkout@v3
43+
with:
44+
ref: 'main'
45+
token: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
46+
47+
- name: Setup Git
48+
run: |
49+
git config user.name "github-actions"
50+
git config user.email "[email protected]"
51+
52+
- name: Extract Major.Minor Version and setup Env variable
53+
run: |
54+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
55+
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
56+
57+
- name: Create branches
58+
run: |
59+
IS_PATCH=${{ github.event.inputs.is_patch }}
60+
if [[ "$IS_PATCH" != "true" && "$IS_PATCH" != "false" ]]; then
61+
echo "Invalid input for IS_PATCH. Must be 'true' or 'false'."
62+
exit 1
63+
fi
64+
65+
66+
if git ls-remote --heads origin release/v${MAJOR_MINOR}.x | grep -q "release/v${MAJOR_MINOR}.x"; then
67+
if [ "$IS_PATCH" = "true" ]; then
68+
git fetch origin release/v${MAJOR_MINOR}.x
69+
echo "Branch release/v${MAJOR_MINOR}.x already exists, checking out."
70+
git checkout "release/v${MAJOR_MINOR}.x"
71+
else
72+
echo "Error, release series branch release/v${MAJOR_MINOR}.x exist for non-patch release"
73+
echo "Check your input or branch"
74+
exit 1
75+
fi
76+
else
77+
if [ "$IS_PATCH" = "true" ]; then
78+
echo "Error, release series branch release/v${MAJOR_MINOR}.x NOT exist for patch release"
79+
echo "Check your input or branch"
80+
exit 1
81+
else
82+
echo "Creating branch release/v${MAJOR_MINOR}.x."
83+
git checkout -b "release/v${MAJOR_MINOR}.x"
84+
git push origin "release/v${MAJOR_MINOR}.x"
85+
fi
86+
fi
87+
88+
git checkout -b "v${VERSION}_release"
89+
git push origin "v${VERSION}_release"
90+
91+
- name: Update version in file
92+
run: |
93+
sed -i'' -e "s/val adotVersion = \".*\"/val adotVersion = \"${VERSION}\"/" version.gradle.kts
94+
git commit -am "Update version to ${VERSION}"
95+
git push origin "v${VERSION}_release"
96+
97+
- name: Update CHANGELOG for release
98+
if: github.event.inputs.is_patch != 'true'
99+
run: |
100+
sed -i "s/## Unreleased/## Unreleased\n\n## v${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
101+
git add CHANGELOG.md
102+
git commit -m "Update CHANGELOG for version ${VERSION}"
103+
git push origin "v${VERSION}_release"
104+
105+
- name: Create pull request against the release branch
106+
env:
107+
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
108+
run: |
109+
gh pr create --title "Pre-release: Update version to ${VERSION}" \
110+
--body "This PR updates the version to ${VERSION}.
111+
112+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
113+
--head v${{ github.event.inputs.version }}_release \
114+
--base release/v${MAJOR_MINOR}.x

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
> **Note:** This CHANGELOG was created starting after version 2.11.5. Earlier changes are not documented here.
6+
7+
For any change that affects end users of this package, please add an entry under the **Unreleased** section. Briefly summarize the change and provide the link to the PR. Example:
8+
9+
- add SigV4 authentication for HTTP exporter
10+
([#1019](https://github.com/aws-observability/aws-otel-java-instrumentation/pull/1019))
11+
12+
If your change does not need a CHANGELOG entry, add the "skip changelog" label to your PR.
13+
14+
## Unreleased

0 commit comments

Comments
 (0)