Skip to content

Update OTel fork components version #3

Update OTel fork components version

Update OTel fork components version #3

name: Update OTel fork components version
env:
UPSTREAM: https://github.com/amazon-contributing/opentelemetry-collector-contrib.git
UPSTREAM_BRANCH: aws-cwa-dev
on:
workflow_dispatch:
inputs:
CommitSha:
description: "Commit sha to point the OTel fork components to"
required: false
type: string
default: ''
jobs:
update-components:
runs-on: ubuntu-latest
steps:
- name: Get latest commit sha
id: get-latest-commit
run: |
if ["${{ inputs.CommitSha }}" == ""]; then
echo "sha=$(git ls-remote ${{ env.UPSTREAM }} ${{ env.UPSTREAM_BRANCH }} | awk '{print $1;}')" >> $GITHUB_OUTPUT
else
echo "sha=${{ inputs.CommitSha }}" >> $GITHUB_OUTPUT
fi
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
cache: false
- name: Update OTel fork components version
id: set-matrix
run: |
git config --global user.name 'Github Action'
git config --global user.email '[email protected]'
git checkout -b otel-fork-replace-${{ steps.get-latest-commit.outputs.sha }}
packages=(
exporter/awscloudwatchlogsexporter
exporter/awsemfexporter
exporter/awsxrayexporter
extension/awsproxy
internal/aws/awsutil
internal/aws/containerinsight
internal/aws/cwlogs
internal/aws/k8s
internal/aws/proxy
internal/aws/xray
internal/kubelet
pkg/stanza
pkg/translator/prometheus
processor/resourcedetectionprocessor
receiver/awscontainerinsightreceiver
receiver/awsxrayreceiver
receiver/prometheusreceiver
)
for p in ${packages[@]}; do
go mod edit -replace github.com/open-telemetry/opentelemetry-collector-contrib/$p=github.com/amazon-contributing/opentelemetry-collector-contrib/$p@${{ steps.get-latest-commit.outputs.sha }}
go mod tidy
done
amazonContributingPackages=(
extension/awsmiddleware
override/aws
)
for p in ${amazonContributingPackages[@]}; do
go mod edit -require github.com/amazon-contributing/opentelemetry-collector-contrib/$p@${{ steps.get-latest-commit.outputs.sha }}
go mod tidy
done
git commit -am "Update OTel fork components to https://github.com/amazon-contributing/opentelemetry-collector-contrib/commit/${{ steps.get-latest-commit.outputs.sha }}"
git push -u origin HEAD
git config --global --unset user.name
git config --global --unset user.email
- name: Create pull request
uses: repo-sync/pull-request@v2
with:
source_branch: otel-fork-replace-${{ steps.get-latest-commit.outputs.sha }}
destination_branch: main
pr_title: "Update OTel fork components to ${{ steps.get-latest-commit.outputs.sha }}"
pr_allow_empty: false
pr_body: |
# Description of the issue
An automated PR to update the OTel fork components to point to [${{ steps.get-latest-commit.outputs.sha }}](https://github.com/amazon-contributing/opentelemetry-collector-contrib/commit/${{ steps.get-latest-commit.outputs.sha }}).
# 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
n/a
# Requirements
_Before commit the code, please do the following steps._
1. Run `make fmt` and `make fmt-sh`
2. Run `make lint`