amazon-cloudwatch-agent
amazon-cloudwatch-agent copied to clipboard
Add script to update OTel dependencies and simplify GitHub Action
Description of the issue
The current GitHub Action workflow for updating OpenTelemetry dependencies uses many individual go mod edit commands, making it verbose and hard to maintain. Additionally, there's no easy way for developers to manually update these dependencies locally.
Description of changes
-
Added
scripts/update-otel-deps.sh: A script that uses regex to update all amazon-contributing/opentelemetry-collector-contrib dependencies to the latest commit from the aws-cwa-dev branch -
Added
make update-otel-depstarget: Provides an easy way for developers to run the update script -
Simplified GitHub Action: Updated
.github/workflows/otel-fork-replace.ymlto use the new script instead of individual go mod edit commands -
Improved safety: The regex only targets replace directives (with
=>prefix) to avoid accidentally updating dependencies in the require section -
Proper formatting: Uses space-separated format compatible with go mod, letting
go mod tidygenerate correct pseudo-versions
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
- Tested regex pattern to ensure it only matches amazon-contributing dependencies in replace directives
- Verified script works with
make update-otel-deps - Confirmed
go mod tidygenerates proper pseudo-versions after script execution
Requirements
Before commiting your code, please do the following steps.
- Run
make fmtandmake fmt-sh - Run
make lint
Integration Tests
To run integration tests against this PR, add the ready for testing label.