Skip to content

Commit 697c90d

Browse files
authored
Simplify running against azure-monitor-opentelemetry-autoconfigure snapshots (#4336)
1 parent 3f666a3 commit 697c90d

File tree

2 files changed

+79
-25
lines changed

2 files changed

+79
-25
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
# Script to build and install azure-monitor-opentelemetry-autoconfigure dependency
4+
# from a specified GitHub repository and branch
5+
6+
set -e
7+
8+
echo "Building azure-monitor-opentelemetry-autoconfigure from $AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE"
9+
10+
# Parse repo and branch from format "owner/repo:branch"
11+
REPO_BRANCH="$AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE"
12+
REPO=$(echo "$REPO_BRANCH" | cut -d':' -f1)
13+
BRANCH=$(echo "$REPO_BRANCH" | cut -d':' -f2)
14+
15+
echo "Repository: $REPO"
16+
echo "Branch: $BRANCH"
17+
18+
# Clone the repository
19+
echo "Cloning repository..."
20+
git clone https://github.com/$REPO.git azure-sdk-temp
21+
cd azure-sdk-temp
22+
git checkout $BRANCH
23+
24+
# Build and install the azure-monitor-opentelemetry-autoconfigure module
25+
echo "Building and installing azure-monitor-opentelemetry-autoconfigure..."
26+
mvn clean install -DskipTests -pl sdk/monitor/azure-monitor-opentelemetry-autoconfigure -am
27+
28+
# Get the version that was just built and installed
29+
echo "Determining installed version..."
30+
INSTALLED_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -pl sdk/monitor/azure-monitor-opentelemetry-autoconfigure)
31+
echo "Installed version: $INSTALLED_VERSION"
32+
33+
# Clean up
34+
echo "Cleaning up..."
35+
cd ..
36+
rm -rf azure-sdk-temp
37+
38+
# Update dependency versions in the current project
39+
echo "Updating dependency versions in project files..."
40+
41+
# Update agent-tooling build.gradle.kts
42+
if [ -f "agent/agent-tooling/build.gradle.kts" ]; then
43+
sed -i "s/com\.azure:azure-monitor-opentelemetry-autoconfigure:[^\"]\+/com.azure:azure-monitor-opentelemetry-autoconfigure:$INSTALLED_VERSION/g" agent/agent-tooling/build.gradle.kts
44+
echo "Updated agent/agent-tooling/build.gradle.kts"
45+
fi
46+
47+
# Update smoke-tests framework build.gradle.kts
48+
if [ -f "smoke-tests/framework/build.gradle.kts" ]; then
49+
sed -i "s/com\.azure:azure-monitor-opentelemetry-autoconfigure:[^\"]\+/com.azure:azure-monitor-opentelemetry-autoconfigure:$INSTALLED_VERSION/g" smoke-tests/framework/build.gradle.kts
50+
echo "Updated smoke-tests/framework/build.gradle.kts"
51+
fi
52+
53+
./gradlew resolveAndLockAll --write-locks
54+
./gradlew generateLicenseReport --no-build-cache
55+
56+
# this is needed to make license report pass
57+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
58+
git config user.name "github-actions[bot]"
59+
git commit -a -m "update azure-monitor-opentelemetry-autoconfigure dependency to $INSTALLED_VERSION"
60+
61+
echo "azure-monitor-opentelemetry-autoconfigure dependency build completed successfully"
62+
echo "All project files updated to use version: $INSTALLED_VERSION"

.github/workflows/build-common.yml

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ on:
88
required: false
99

1010
env:
11-
EXPORTER_VERSION: 1.1.0 # to be updated with the latest version
11+
# set this to <repo>:<branch/sha> to build and test with an unreleased
12+
# version of the azure-monitor-opentelemetry-autoconfigure dependency
13+
AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE:
1214

1315
jobs:
1416
spotless:
@@ -46,12 +48,9 @@ jobs:
4648
distribution: temurin
4749
java-version: 17
4850

49-
- name: Using a local standalone exporter dependency?
50-
if: ${{ hashFiles('azure-monitor-opentelemetry-autoconfigure-1.0.0-beta.*.jar') != '' }}
51-
run: |
52-
echo "exporter_version: ${{ env.EXPORTER_VERSION }}"
53-
mvn -version
54-
mvn install:install-file -Dfile="azure-monitor-opentelemetry-autoconfigure-${{ env.EXPORTER_VERSION }}.jar" -DpomFile="azure-monitor-opentelemetry-autoconfigure-${{ env.EXPORTER_VERSION }}.pom" -DgroupId="com.azure" -DartifactId="azure-monitor-opentelemetry-autoconfigure" -Dversion="${{ env.EXPORTER_VERSION }}"
51+
- name: Build and install local azure-monitor-opentelemetry-autoconfigure dependency
52+
if: env.AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE != ''
53+
run: ./.github/scripts/build-azure-monitor-dependency.sh
5554

5655
- name: Setup Gradle
5756
uses: gradle/actions/setup-gradle@v4
@@ -93,12 +92,10 @@ jobs:
9392
distribution: temurin
9493
java-version: 17
9594

96-
- name: Using a local standalone exporter dependency?
97-
if: ${{ hashFiles('azure-monitor-opentelemetry-autoconfigure-1.0.0-beta.*.jar') != '' }}
98-
run: |
99-
echo "exporter_version: ${{ env.EXPORTER_VERSION }}"
100-
mvn -version
101-
mvn install:install-file -Dfile="azure-monitor-opentelemetry-autoconfigure-${{ env.EXPORTER_VERSION }}.jar" -DpomFile="azure-monitor-opentelemetry-autoconfigure-${{ env.EXPORTER_VERSION }}.pom" -DgroupId="com.azure" -DartifactId="azure-monitor-opentelemetry-autoconfigure" -Dversion="${{ env.EXPORTER_VERSION }}"
95+
- name: Build and install local azure-monitor-opentelemetry-autoconfigure dependency
96+
if: env.AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE != ''
97+
shell: bash
98+
run: ./.github/scripts/build-azure-monitor-dependency.sh
10299

103100
- name: Setup Gradle
104101
uses: gradle/actions/setup-gradle@v4
@@ -165,12 +162,10 @@ jobs:
165162
distribution: temurin
166163
java-version: 17
167164

168-
- name: Using a local standalone exporter dependency?
169-
if: ${{ hashFiles('azure-monitor-opentelemetry-autoconfigure-1.0.0-beta.*.jar') != '' }}
170-
run: |
171-
echo "exporter_version: ${{ env.EXPORTER_VERSION }}"
172-
mvn -version
173-
mvn install:install-file -Dfile="azure-monitor-opentelemetry-autoconfigure-${{ env.EXPORTER_VERSION }}.jar" -DpomFile="azure-monitor-opentelemetry-autoconfigure-${{ env.EXPORTER_VERSION }}.pom" -DgroupId="com.azure" -DartifactId="azure-monitor-opentelemetry-autoconfigure" -Dversion="${{ env.EXPORTER_VERSION }}"
165+
- name: Build and install local azure-monitor-opentelemetry-autoconfigure dependency
166+
if: env.AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE != ''
167+
shell: bash
168+
run: ./.github/scripts/build-azure-monitor-dependency.sh
174169

175170
- name: Setup Gradle
176171
uses: gradle/actions/setup-gradle@v4
@@ -239,12 +234,9 @@ jobs:
239234
distribution: temurin
240235
java-version: 17
241236

242-
- name: Using a local standalone exporter dependency?
243-
if: ${{ hashFiles('azure-monitor-opentelemetry-autoconfigure-1.0.0-beta.*.jar') != '' }}
244-
run: |
245-
echo "exporter_version: ${{ env.EXPORTER_VERSION }}"
246-
mvn -version
247-
mvn install:install-file -Dfile="azure-monitor-opentelemetry-autoconfigure-${{ env.EXPORTER_VERSION }}.jar" -DpomFile="azure-monitor-opentelemetry-autoconfigure-${{ env.EXPORTER_VERSION }}.pom" -DgroupId="com.azure" -DartifactId="azure-monitor-opentelemetry-autoconfigure" -Dversion="${{ env.EXPORTER_VERSION }}"
237+
- name: Build and install local azure-monitor-opentelemetry-autoconfigure dependency
238+
if: env.AZURE_MONITOR_OPENTELEMETRY_AUTOCONFIGURE != ''
239+
run: ./.github/scripts/build-azure-monitor-dependency.sh
248240

249241
- name: Setup Gradle
250242
uses: gradle/actions/setup-gradle@v4

0 commit comments

Comments
 (0)