Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
required: false
type: string
default: Dev
ref:
description: 'The branch, tag or SHA to checkout'
required: false
type: string
default: ''
workflow_dispatch: # be able to run the workflow on demand
push:
branches:
Expand All @@ -31,6 +36,8 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
ref: ${{ inputs.ref || github.sha }}

- name: Setup .NET
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d #v5.0.0
Expand Down Expand Up @@ -89,6 +96,7 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
fetch-depth: 0
ref: ${{ inputs.ref || github.sha }}

- name: Build in Docker container
run: |
Expand All @@ -108,6 +116,8 @@ jobs:
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
ref: ${{ inputs.ref || github.sha }}

- name: Setup .NET
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d #v5.0.0
Expand All @@ -134,6 +144,7 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
fetch-depth: 0
ref: ${{ inputs.ref || github.sha }}

- name: Build in Docker container
run: |
Expand All @@ -158,6 +169,8 @@ jobs:
os: [windows-2022, ubuntu-latest]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
ref: ${{ inputs.ref || github.sha }}

- name: Build and scan Linux images
if: runner.os == 'Linux'
Expand Down
132 changes: 132 additions & 0 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Nightly Upstream Snapshot Build

on:
schedule:
- cron: "21 3 * * *"
workflow_dispatch:
push:
branches:
- zhaez/nightly-build

permissions:
contents: write
pull-requests: write
id-token: write

env:
BRANCH_NAME: nightly-dependency-updates
AWS_DEFAULT_REGION: us-east-1

jobs:
update-and-create-pr:
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check_changes.outputs.has_changes }}

steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"

- name: Check out dependency update branch
run: |
if git ls-remote --exit-code --heads origin "$BRANCH_NAME"; then
echo "Branch $BRANCH_NAME already exists, checking out..."
git checkout "$BRANCH_NAME"
else
echo "Branch $BRANCH_NAME does not exist, creating new branch..."
git checkout -b "$BRANCH_NAME"
fi

- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #v6.0.0
with:
python-version: '3.11'

- name: Install Python dependencies
run: pip install requests

- name: Update dependencies
run: python3 scripts/update_dependencies.py

- name: Check for changes and commit
id: check_changes
run: |
if git diff --quiet; then
echo "No dependency updates needed"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "Dependencies were updated"
echo "has_changes=true" >> $GITHUB_OUTPUT

git add src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AWS.Distro.OpenTelemetry.AutoInstrumentation.csproj build/Build.cs
git commit -m "chore: update OpenTelemetry dependencies to latest versions"
git push origin "$BRANCH_NAME"
fi

- name: Create or update PR
if: steps.check_changes.outputs.has_changes == 'true'
run: |
PR_BODY="Automated update of OpenTelemetry dependencies to their latest available versions.

**Check for breaking changes:**
- [opentelemetry-dotnet releases](https://github.com/open-telemetry/opentelemetry-dotnet/releases)
- [opentelemetry-dotnet-contrib releases](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/releases)"

if gh pr view "$BRANCH_NAME" --json state --jq '.state' 2>/dev/null | grep -q "OPEN"; then
echo "Open PR already exists, updating description..."
gh pr edit "$BRANCH_NAME" --body "$PR_BODY"
else
echo "Creating new PR..."
gh pr create \
--title "Nightly dependency update: OpenTelemetry packages to latest versions" \
--body "$PR_BODY" \
--base main \
--head "$BRANCH_NAME"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-and-test:
needs: update-and-create-pr
if: needs.update-and-create-pr.outputs.has_changes == 'true'
uses: ./.github/workflows/main-build.yml
secrets: inherit
permissions:
id-token: write
contents: write
with:
caller-workflow-name: nightly-build
environment: Dev
ref: nightly-dependency-updates

publish-nightly-build-status:
name: "Publish Nightly Build Status"
needs: [update-and-create-pr, build-and-test]
runs-on: ubuntu-latest
if: always()
steps:
- name: Configure AWS Credentials for emitting metrics
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0
with:
role-to-assume: ${{ secrets.MONITORING_ROLE_ARN }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}

- name: Publish nightly build status
run: |
if [[ "${{ needs.build-and-test.result }}" == "skipped" ]]; then
echo "Build was skipped (no changes), not publishing metric"
else
value="${{ needs.build-and-test.result == 'success' && '0.0' || '1.0'}}"
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
--metric-name Failure \
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \
--value $value
fi
2 changes: 1 addition & 1 deletion build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

internal partial class Build : NukeBuild
{
private const string OpenTelemetryAutoInstrumentationDefaultVersion = "v1.11.0";
private const string OpenTelemetryAutoInstrumentationDefaultVersion = "v1.12.0";
private static readonly AbsolutePath TestNuGetPackageApps = NukeBuild.RootDirectory / "test" / "test-applications" / "nuget-package";

[Solution("AWS.Distro.OpenTelemetry.AutoInstrumentation.sln")]
Expand Down
Loading