Skip to content

Commit d9ab40a

Browse files
authored
Merge branch 'main' into fix-udp-workflow
2 parents a0c6429 + e3e80cd commit d9ab40a

File tree

8 files changed

+271
-10
lines changed

8 files changed

+271
-10
lines changed
File renamed without changes.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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+
10+
env:
11+
AWS_DEFAULT_REGION: us-east-1
12+
13+
permissions:
14+
id-token: write
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
check-version:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout main
23+
uses: actions/checkout@v2
24+
with:
25+
ref: main
26+
fetch-depth: 0
27+
28+
- name: Extract Major.Minor Version and setup Env variable
29+
run: |
30+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
31+
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
32+
33+
- name: Get current major.minor version from main branch
34+
id: get_version
35+
run: |
36+
CURRENT_VERSION=$(grep '__version__' aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | sed -E 's/__version__ = "([0-9]+\.[0-9]+)\.[0-9]+.*"/\1/')
37+
echo "CURRENT_MAJOR_MINOR_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
38+
39+
- name: Set major and minor for current version
40+
run: |
41+
echo "CURRENT_MAJOR=$(echo $CURRENT_MAJOR_MINOR_VERSION | cut -d. -f1)" >> $GITHUB_ENV
42+
echo "CURRENT_MINOR=$(echo $CURRENT_MAJOR_MINOR_VERSION | cut -d. -f2)" >> $GITHUB_ENV
43+
44+
- name: Set major and minor for input version
45+
run: |
46+
echo "INPUT_MAJOR=$(echo $MAJOR_MINOR | cut -d. -f1)" >> $GITHUB_ENV
47+
echo "INPUT_MINOR=$(echo $MAJOR_MINOR | cut -d. -f2)" >> $GITHUB_ENV
48+
49+
- name: Compare major.minor version and skip if behind
50+
run: |
51+
if [ "$CURRENT_MAJOR" -gt "$INPUT_MAJOR" ] || { [ "$CURRENT_MAJOR" -eq "$INPUT_MAJOR" ] && [ "$CURRENT_MINOR" -gt "$INPUT_MINOR" ]; }; then
52+
echo "Input version is behind main's current major.minor version, don't need to update major version"
53+
exit 1
54+
fi
55+
56+
57+
prepare-main:
58+
runs-on: ubuntu-latest
59+
needs: check-version
60+
steps:
61+
- name: Configure AWS credentials for BOT secrets
62+
uses: aws-actions/configure-aws-credentials@v4
63+
with:
64+
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
65+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
66+
67+
- name: Get Bot secrets
68+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
69+
id: bot_secrets
70+
with:
71+
secret-ids: |
72+
BOT_TOKEN ,${{ secrets.BOT_TOKEN_SECRET_ARN }}
73+
parse-json-secrets: true
74+
75+
- name: Setup Git
76+
uses: actions/checkout@v2
77+
with:
78+
fetch-depth: 0
79+
token: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
80+
81+
- name: Configure Git
82+
run: |
83+
git config user.name "github-actions"
84+
git config user.email "[email protected]"
85+
86+
- name: Extract Major.Minor Version and setup Env variable
87+
run: |
88+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
89+
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
90+
91+
- name: Determine release branch and checkout
92+
run: |
93+
RELEASE_BRANCH="release/v${MAJOR_MINOR}.x"
94+
git fetch origin $RELEASE_BRANCH
95+
git checkout -b "prepare-main-for-next-dev-cycle-${VERSION}" origin/$RELEASE_BRANCH
96+
97+
- name: Update version to next development version in main
98+
run: |
99+
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
100+
sed -i'' -e "s/val adotVersion = \".*\"/val adotVersion = \"${DEV_VERSION}\"/" version.gradle.kts
101+
VERSION="${{ github.event.inputs.version }}"
102+
sed -i'' -e 's/adot-autoinstrumentation-java:v2.*"/adot-autoinstrumentation-java:v'$VERSION'"/' .github/workflows/daily-scan.yml
103+
git add version.gradle.kts
104+
git add .github/workflows/daily-scan.yml
105+
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
106+
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}"
107+
108+
- name: Create Pull Request to main
109+
env:
110+
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
111+
run: |
112+
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
113+
gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \
114+
--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.
115+
116+
This PR should only be merge when release for version v$VERSION is success.
117+
118+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
119+
--head prepare-main-for-next-dev-cycle-${VERSION} \
120+
--base main
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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: Create pull request against the release branch
98+
env:
99+
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
100+
run: |
101+
gh pr create --title "Pre-release: Update version to ${VERSION}" \
102+
--body "This PR updates the version to ${VERSION}.
103+
104+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
105+
--head v${{ github.event.inputs.version }}_release \
106+
--base release/v${MAJOR_MINOR}.x

build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ nebulaRelease {
3737
addReleaseBranchPattern("""v\d+\.\d+\.x""")
3838
}
3939

40+
apply(from = "version.gradle.kts")
41+
4042
nexusPublishing {
4143
repositories {
4244
sonatype {
@@ -71,7 +73,7 @@ allprojects {
7173
ktlint("1.4.0").editorConfigOverride(mapOf("indent_size" to "2", "continuation_indent_size" to "2"))
7274

7375
// Doesn't support pluginManagement block
74-
targetExclude("settings.gradle.kts")
76+
targetExclude("settings.gradle.kts", "version.gradle.kts")
7577

7678
if (!project.path.startsWith(":sample-apps:")) {
7779
licenseHeaderFile("${rootProject.projectDir}/config/license/header.java", "plugins|include|import")

dependencyManagement/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ val dependencyBoms = listOf(
4040
"com.google.protobuf:protobuf-bom:3.25.1",
4141
"com.linecorp.armeria:armeria-bom:1.26.4",
4242
"io.grpc:grpc-bom:1.59.1",
43-
// netty-bom is a fix for CVE-2025-55163 (https://github.com/advisories/GHSA-prj3-ccx8-p6x4).
44-
// Remove once https://github.com/aws/aws-sdk-java-v2/pull/6344 is released.
45-
"io.netty:netty-bom:4.1.124.Final",
43+
// netty-bom is a fix for CVE-2025-58056 (https://github.com/advisories/GHSA-fghv-69vj-qj49).
44+
// Remove once https://github.com/aws/aws-sdk-java-v2/pull/6398 and https://github.com/aws/aws-sdk-java/pull/3192
45+
// are both merged and released, and we update the corresponding dependencies.
46+
"io.netty:netty-bom:4.1.126.Final",
4647
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:$otelAlphaVersion",
4748
"org.apache.logging.log4j:log4j-bom:2.21.1",
4849
"org.junit:junit-bom:5.10.1",

lambda-layer/build-layer.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@ set -e
44
SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
55

66

7+
## Get ADOT version
8+
echo "Info: Getting ADOT Version"
9+
pushd "$SOURCEDIR"/..
10+
version=$(./gradlew -q printVersion)
11+
echo "Found ADOT Version: ${version}"
12+
popd
13+
714
## Get OTel version
815
echo "Info: Getting OTEL Version"
916
file="$SOURCEDIR/../.github/patches/versions"
10-
version=$(awk -F'=v' '/OTEL_JAVA_INSTRUMENTATION_VERSION/ {print $2}' "$file")
11-
echo "Found OTEL Version: ${version}"
17+
otel_instrumentation_version=$(awk -F'=v' '/OTEL_JAVA_INSTRUMENTATION_VERSION/ {print $2}' "$file")
18+
echo "Found OTEL Version: ${otel_instrumentation_version}"
1219
# Exit if the version is empty or null
13-
if [[ -z "$version" ]]; then
20+
if [[ -z "$otel_instrumentation_version" ]]; then
1421
echo "Error: Version could not be found in ${file}."
1522
exit 1
1623
fi
@@ -20,7 +27,7 @@ fi
2027
echo "Info: Cloning and Patching OpenTelemetry Java Instrumentation Repository"
2128
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git
2229
pushd opentelemetry-java-instrumentation
23-
git checkout v${version} -b tag-v${version}
30+
git checkout v${otel_instrumentation_version} -b tag-v${otel_instrumentation_version}
2431

2532
# This patch is for Lambda related context propagation
2633
patch -p1 < "$SOURCEDIR"/patches/opentelemetry-java-instrumentation.patch
@@ -56,7 +63,7 @@ popd
5663

5764
## Build ADOT Lambda Java SDK Layer Code
5865
echo "Info: Building ADOT Lambda Java SDK Layer Code"
59-
./gradlew build -PotelVersion=${version}
66+
./gradlew build -PotelVersion=${otel_instrumentation_version} -Pversion=${version}
6067

6168

6269
## Copy ADOT Java Agent downloaded using Gradle task and bundle it with the Lambda handler script

lambda-layer/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ val javaagentDependency by configurations.creating {
2727
extendsFrom()
2828
}
2929

30+
val version: String by project
3031
val otelVersion: String by project
3132

3233
dependencies {
@@ -35,7 +36,7 @@ dependencies {
3536
// Already included in wrapper so compileOnly
3637
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
3738
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-aws")
38-
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:$otelVersion-adot-lambda1")
39+
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:$version-adot-lambda1")
3940
}
4041

4142
tasks.register<Copy>("download") {

version.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
val adotVersion = "2.18.0-dev0"
17+
18+
allprojects {
19+
version = if (project.hasProperty("release.version")) {
20+
project.property("release.version") as String
21+
} else {
22+
adotVersion
23+
}
24+
}

0 commit comments

Comments
 (0)