Skip to content

Commit 4ea9aa1

Browse files
authored
Merge branch 'main' into bugfix/potential_duplication
2 parents e03a841 + e330c69 commit 4ea9aa1

File tree

8 files changed

+154
-91
lines changed

8 files changed

+154
-91
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Auto-update agents
2+
3+
on:
4+
schedule:
5+
# Daily at 01:30 (UTC)
6+
- cron: '30 1 * * *'
7+
workflow_dispatch:
8+
pull_request:
9+
10+
jobs:
11+
update-agent:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
agent: [java, dotnet, nodejs, python]
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- id: check-versions
20+
name: Check versions
21+
env:
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
case ${{ matrix.agent }} in
25+
java)
26+
current_version=$(grep -Po "[0-9]+.[0-9]+.[0-9]+" autoinstrumentation/java/version.txt)
27+
latest_version=$(gh release view \
28+
--repo open-telemetry/opentelemetry-java-instrumentation \
29+
--json tagName \
30+
--jq .tagName \
31+
| sed 's/^v//')
32+
;;
33+
dotnet)
34+
current_version=$(grep -Po "[0-9]+.[0-9]+.[0-9]+" autoinstrumentation/dotnet/version.txt)
35+
latest_version=$(gh release view \
36+
--repo open-telemetry/opentelemetry-dotnet-instrumentation \
37+
--json tagName \
38+
--jq .tagName \
39+
| sed 's/^v//')
40+
;;
41+
nodejs)
42+
current_version=$(grep -Po '"@opentelemetry/auto-instrumentations-node": "\K[0-9]+\.[0-9]+\.[0-9]+"' autoinstrumentation/nodejs/package.json | tr -d '"')
43+
latest_version=$(gh release list \
44+
--repo open-telemetry/opentelemetry-js-contrib \
45+
--json tagName \
46+
--jq '.[] | select(.tagName | startswith("auto-instrumentations-node-v")) | .tagName' \
47+
| head -1 \
48+
| sed 's/auto-instrumentations-node-v//')
49+
;;
50+
python)
51+
current_version=$(grep -Po "^opentelemetry-distro==\K[0-9]+\.[0-9]+(b[0-9]+)?" autoinstrumentation/python/requirements.txt)
52+
# Python releases are not tagged with the same version published on PyPI. Instead, we extract the PyPI version from the release name.
53+
latest_version=$(gh release view \
54+
--repo open-telemetry/opentelemetry-python \
55+
--json name \
56+
--jq .name \
57+
| sed -E 's/.*\/([0-9]+\.[0-9]+(b[0-9]+)?).*/\1/')
58+
;;
59+
esac
60+
61+
matches=$(gh pr list \
62+
--author opentelemetrybot \
63+
--state open \
64+
--search "in:title \"Update the OpenTelemetry ${{ matrix.agent }} agent version to $latest_version\"")
65+
if [ ! -z "$matches" ]
66+
then
67+
already_opened=true
68+
fi
69+
70+
# Ensure proper format and remove any unintended characters
71+
echo "current-version=${current_version}" >> $GITHUB_OUTPUT
72+
echo "latest-version=${latest_version}" >> $GITHUB_OUTPUT
73+
echo "already-opened=${already_opened}" >> $GITHUB_OUTPUT
74+
75+
# Debug information
76+
echo "Debug information for ${{ matrix.agent }} agent:"
77+
echo "Current version detected: ${current_version}"
78+
echo "Latest version detected: ${latest_version}"
79+
echo "PR already opened for this version: ${already_opened:-false}"
80+
echo "Version comparison: Current ${current_version} vs Latest ${latest_version}"
81+
82+
# Additional validation
83+
if [[ -z "$current_version" ]]; then
84+
echo "WARNING: Failed to detect current version"
85+
fi
86+
87+
if [[ -z "$latest_version" ]]; then
88+
echo "WARNING: Failed to detect latest version"
89+
fi
90+
91+
# Print PR search query details
92+
echo "PR search query: \"Update the OpenTelemetry ${{ matrix.agent }} agent version to $latest_version\""
93+
echo "PR search results: ${matches:-none}"
94+
95+
- name: Update version
96+
if: |
97+
steps.check-versions.outputs.current-version != steps.check-versions.outputs.latest-version &&
98+
steps.check-versions.outputs.already-opened != 'true'
99+
env:
100+
VERSION: ${{ steps.check-versions.outputs.latest-version }}
101+
run: |
102+
case ${{ matrix.agent }} in
103+
java)
104+
echo $VERSION > autoinstrumentation/java/version.txt
105+
;;
106+
dotnet)
107+
echo $VERSION > autoinstrumentation/dotnet/version.txt
108+
;;
109+
nodejs)
110+
sed -i "s/\"@opentelemetry\/auto-instrumentations-node\": \".*\"/\"@opentelemetry\/auto-instrumentations-node\": \"$VERSION\"/" autoinstrumentation/nodejs/package.json
111+
;;
112+
python)
113+
sed -i "s/^opentelemetry-distro==.*/opentelemetry-distro==$VERSION/" autoinstrumentation/python/requirements.txt
114+
;;
115+
esac
116+
117+
- name: Use CLA approved github bot
118+
run: |
119+
git config user.name opentelemetrybot
120+
git config user.email [email protected]
121+
122+
- name: Create pull request against main
123+
if: |
124+
steps.check-versions.outputs.current-version != steps.check-versions.outputs.latest-version &&
125+
steps.check-versions.outputs.already-opened != 'true'
126+
env:
127+
VERSION: ${{ steps.check-versions.outputs.latest-version }}
128+
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
129+
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
130+
run: |
131+
message="Update the OpenTelemetry ${{ matrix.agent }} agent version to $VERSION"
132+
body="Update the OpenTelemetry ${{ matrix.agent }} agent version to \`$VERSION\`."
133+
branch="opentelemetrybot/update-opentelemetry-${{ matrix.agent }}-agent-to-${VERSION}"
134+
135+
git checkout -b $branch
136+
git commit -a -m "$message"
137+
# Only push and create PR when not triggered by a pull_request event
138+
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
139+
git push --set-upstream origin $branch
140+
gh pr create --title "$message" \
141+
--body "$body" \
142+
--base main
143+
else
144+
git show HEAD
145+
fi

.github/workflows/auto-update-java-agent.yaml

Lines changed: 0 additions & 81 deletions
This file was deleted.

.github/workflows/continuous-integration.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ jobs:
8282
go-version: "~1.24.2"
8383

8484
- name: Initialize CodeQL
85-
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
85+
uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
8686
with:
8787
languages: go
8888

8989
- name: Autobuild
90-
uses: github/codeql-action/autobuild@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
90+
uses: github/codeql-action/autobuild@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
9191

9292
- name: Perform CodeQL Analysis
93-
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
93+
uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
9494

9595
- name: Govulncheck
9696
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4

.github/workflows/ossf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
# Upload the results to GitHub's code scanning dashboard (optional).
4343
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
4444
- name: "Upload to code-scanning"
45-
uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
45+
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
4646
with:
4747
sarif_file: results.sarif

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ KUSTOMIZE_VERSION ?= v5.6.0
500500
# renovate: datasource=go depName=sigs.k8s.io/controller-tools/cmd/controller-gen
501501
CONTROLLER_TOOLS_VERSION ?= v0.17.1
502502
# renovate: datasource=github-releases depName=golangci/golangci-lint
503-
GOLANGCI_LINT_VERSION ?= v2.0.2
503+
GOLANGCI_LINT_VERSION ?= v2.1.1
504504
# renovate: datasource=go depName=sigs.k8s.io/kind
505505
KIND_VERSION ?= v0.27.0
506506
# renovate: datasource=go depName=github.com/kyverno/chainsaw

autoinstrumentation/nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
},
1414
"dependencies": {
1515
"@opentelemetry/api": "1.9.0",
16-
"@opentelemetry/auto-instrumentations-node": "0.56.0"
16+
"@opentelemetry/auto-instrumentations-node": "0.57.1"
1717
}
1818
}

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
github.com/prometheus-operator/prometheus-operator v0.80.1
2929
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.80.1
3030
github.com/prometheus-operator/prometheus-operator/pkg/client v0.80.1
31-
github.com/prometheus/client_golang v1.21.1
31+
github.com/prometheus/client_golang v1.22.0
3232
github.com/prometheus/common v0.63.0
3333
github.com/prometheus/prometheus v0.301.0
3434
github.com/shirou/gopsutil v3.21.11+incompatible
@@ -153,7 +153,6 @@ require (
153153
github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 // indirect
154154
github.com/josharian/intern v1.0.0 // indirect
155155
github.com/jpillora/backoff v1.0.0 // indirect
156-
github.com/klauspost/compress v1.18.0 // indirect
157156
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
158157
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect
159158
github.com/kylelemons/godebug v1.1.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
451451
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
452452
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
453453
github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
454-
github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
455-
github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
454+
github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q=
455+
github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0=
456456
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
457457
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
458458
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=

0 commit comments

Comments
 (0)