Skip to content

Commit

Permalink
Merge branch 'main' into shared-tagwriter-cleanup-and-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch authored May 14, 2024
2 parents f2adebc + a578ed3 commit eb86a50
Show file tree
Hide file tree
Showing 36 changed files with 733 additions and 228 deletions.
27 changes: 16 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@ body:
Before filing a bug, please be sure you have searched through [existing bugs](https://github.com/open-telemetry/opentelemetry-dotnet/issues?q=is%3Aissue+is%3Aopen+label%3Abug) to see if an existing issue covers the bug.
- type: dropdown
id: area
id: package
attributes:
label: Area
description: Which area does this bug report concern? If none fits, please select `area:other`
label: Package
description: Which NuGet package does this bug report concern?
multiple: false
options:
- area:other
- area:api
- area:exporter
- area:exporter:otlp
- area:exporter:prometheus
- area:ext:hosting
- area:sdk
- OpenTelemetry
- OpenTelemetry.Api
- OpenTelemetry.Api.ProviderBuilderExtensions
- OpenTelemetry.Exporter.Console
- OpenTelemetry.Exporter.InMemory
- OpenTelemetry.Exporter.OpenTelemetryProtocol
- OpenTelemetry.Exporter.Prometheus.AspNetCore
- OpenTelemetry.Exporter.Prometheus.HttpListener
- OpenTelemetry.Exporter.Zipkin
- OpenTelemetry.Extensions.Hosting
- OpenTelemetry.Extensions.Propagators
- OpenTelemetry.Shims.OpenTracing
validations:
required: true

Expand Down Expand Up @@ -56,7 +61,7 @@ body:
- type: textarea
attributes:
label: Steps to Reproduce
description: Create a self-contained project using the template of your choice, apply the minimum required code to result in the issue you are observing. We will close the issue if the repro project you share with us is complex or we cannot reproduce the behavior you are reporting. We can not investigate custom projects, so don't point us to such, please.
description: Provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). We will close the issue if the repro project you share with us is complex or we cannot reproduce the behavior you are reporting. We cannot investigate custom projects, so don't point us to such, please.
validations:
required: true

Expand Down
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ body:
Before opening a feature request, consider whether the feature should/could be implemented in the [other OpenTelemetry client libraries](https://github.com/open-telemetry/). If so, please [open an issue on opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification/issues/new) first.
- type: dropdown
id: package
attributes:
label: Package
description: Which NuGet package does this feature request concern?
multiple: false
options:
- OpenTelemetry
- OpenTelemetry.Api
- OpenTelemetry.Api.ProviderBuilderExtensions
- OpenTelemetry.Exporter.Console
- OpenTelemetry.Exporter.InMemory
- OpenTelemetry.Exporter.OpenTelemetryProtocol
- OpenTelemetry.Exporter.Prometheus.AspNetCore
- OpenTelemetry.Exporter.Prometheus.HttpListener
- OpenTelemetry.Exporter.Zipkin
- OpenTelemetry.Extensions.Hosting
- OpenTelemetry.Extensions.Propagators
- OpenTelemetry.Shims.OpenTracing

- type: textarea
attributes:
label: Is your feature request related to a problem?
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/add-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ jobs:
- name: Add labels for areas found in bug issue descriptions
shell: pwsh
run: |
$match = [regex]::Match('${{ github.event.issue.body }}', '^[#]+ Area\s*?(area:\w+)')
if ($match.Success -eq $false)
{
Return
}
gh issue edit ${{ github.event.issue.number }} `
--add-label $match.Groups[1].Value
.\build\scripts\add-labels.ps1 -issueNumber $env:ISSUE_NUMBER -issueBody $env:ISSUE_BODY
env:
GH_TOKEN: ${{ github.token }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_BODY: ${{ github.event.issue.body }}
139 changes: 139 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Prepare for a release

on:
workflow_dispatch:
inputs:
tag-prefix:
type: choice
options:
- core-
- coreunstable-
description: 'Release tag prefix'
required: true
version:
type: string
description: 'Release version'
required: true

pull_request:
types:
- closed

issue_comment:
types:
- created

permissions:
contents: write
pull-requests: write

jobs:
prepare-release-pr:
if: github.event_name == 'workflow_dispatch'

runs-on: windows-latest

steps:
- name: check out code
uses: actions/checkout@v4

- name: Create GitHub Pull Request to prepare release
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
CreatePullRequestToUpdateChangelogsAndPublicApis `
-minVerTagPrefix '${{ inputs.tag-prefix }}' `
-version '${{ inputs.version }}' `
-targetBranch '${{ github.ref_name }}'
env:
GH_TOKEN: ${{ github.token }}

lock-pr-and-post-notice-to-create-release-tag:
if: |
github.event_name == 'pull_request'
&& github.event.action == 'closed'
&& github.event.pull_request.user.login == 'github-actions[bot]'
&& github.event.pull_request.merged == true
&& startsWith(github.event.pull_request.title, '[repo] Prepare release ')
runs-on: windows-latest

steps:
- name: check out code
uses: actions/checkout@v4

- name: Lock GitHub Pull Request to prepare release
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
LockPullRequestAndPostNoticeToCreateReleaseTag `
-pullRequestNumber '${{ github.event.pull_request.number }}'
env:
GH_TOKEN: ${{ github.token }}

create-release-tag-unlock-pr-post-notice:
if: |
github.event_name == 'issue_comment'
&& github.event.issue.pull_request
&& github.event.issue.locked == true
&& contains(github.event.comment.body, '/CreateReleaseTag')
&& startsWith(github.event.issue.title, '[repo] Prepare release ')
&& github.event.issue.pull_request.merged_at
runs-on: windows-latest

outputs:
tag: ${{ steps.create-tag.outputs.tag }}

steps:
- name: check out code
uses: actions/checkout@v4
with:
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
fetch-depth: 0

- name: Create release tag
id: create-tag
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
$tag = ''
CreateReleaseTag `
-pullRequestNumber '${{ github.event.issue.number }}' `
-actionRunId '${{ github.run_id }}' `
-tag ([ref]$tag)
echo "tag=$tag" >> $env:GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}

invoke-package-workflow:
needs: create-release-tag-unlock-pr-post-notice
uses: ./.github/workflows/publish-packages-1.0.yml
with:
tag: ${{ needs.create-release-tag-unlock-pr-post-notice.outputs.tag }}

post-packages-ready-notice:
needs:
- create-release-tag-unlock-pr-post-notice
- invoke-package-workflow
runs-on: windows-latest
steps:
- name: check out code
uses: actions/checkout@v4

- name: Post notice when packages are ready
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
PostPackagesReadyNotice `
-pullRequestNumber '${{ github.event.issue.number }}' `
-tag '${{ needs.create-release-tag-unlock-pr-post-notice.outputs.tag }}' `
-packagesUrl '${{ needs.invoke-package-workflow.outputs.artifact-url }}'
env:
GH_TOKEN: ${{ github.token }}
47 changes: 32 additions & 15 deletions .github/workflows/publish-packages-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ on:
- 'core-*'
- 'coreunstable-*'
- 'Instrumentation.*-'
workflow_call:
inputs:
tag:
required: true
type: string
outputs:
artifact-id:
value: ${{ jobs.build-pack-publish.outputs.artifact-id }}
artifact-url:
value: ${{ jobs.build-pack-publish.outputs.artifact-url }}
schedule:
- cron: '0 0 * * *' # once in a day at 00:00

Expand All @@ -25,14 +35,18 @@ jobs:
build-pack-publish:
runs-on: windows-latest

outputs:
artifact-id: ${{ steps.upload-artifacts.outputs.artifact-id }}
artifact-url: ${{ steps.upload-artifacts.outputs.artifact-url }}

steps:
- uses: actions/checkout@v4
with:
# Note: By default GitHub only fetches 1 commit. MinVer needs to find
# the version tag which is typically NOT on the first commit so we
# retrieve them all.
fetch-depth: 0
ref: ${{ github.ref || 'main' }}
ref: ${{ inputs.tag || github.ref || 'main' }}

- name: Setup dotnet
uses: actions/setup-dotnet@v4
Expand All @@ -44,12 +58,13 @@ jobs:
run: dotnet build OpenTelemetry.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} -p:RunningDotNetPack=true

- name: dotnet pack
run: dotnet pack OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref_type == 'tag' && github.ref_name || '' }}
run: dotnet pack OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref_type == 'tag' && github.ref_name || inputs.tag || '' }}

- name: Publish Artifacts
id: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.ref_name }}-packages
name: ${{ inputs.tag || github.ref_name }}-packages
path: '**/bin/**/*.*nupkg'

- name: Publish MyGet
Expand All @@ -61,7 +76,7 @@ jobs:
nuget push **/bin/**/*.nupkg -Source https://www.myget.org/F/opentelemetry/api/v2/package
- name: Create GitHub Release draft
if: github.ref_type == 'tag'
if: github.ref_type == 'tag' || inputs.tag
shell: pwsh
run: |
$packages = (Get-ChildItem -Path src/*/bin/Release/*.nupkg).Name
Expand All @@ -88,7 +103,7 @@ jobs:
foreach ($line in $changelogContent)
{
if ($line -like "## ${{ github.ref_name }}" -and $started -ne $true)
if ($line -like "## $packageVersion" -and $started -ne $true)
{
$started = $true
}
Expand Down Expand Up @@ -122,24 +137,24 @@ jobs:
$content
See [CHANGELOG](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/src/$packageName/CHANGELOG.md) for details.
See [CHANGELOG](https://github.com/${{ github.repository }}/blob/${{ inputs.tag || github.ref_name }}/src/$packageName/CHANGELOG.md) for details.
"@
}
if ($firstPackageVersion -match '-alpha' -or $firstPackageVersion -match '-beta' -or $firstPackageVersion -match '-rc')
{
gh release create ${{ github.ref_name }} `
--title ${{ github.ref_name }} `
gh release create ${{ inputs.tag || github.ref_name }} `
--title ${{ inputs.tag || github.ref_name }} `
--verify-tag `
--notes "$notes" `
--prerelease `
--draft
}
else
{
gh release create ${{ github.ref_name }} `
--title ${{ github.ref_name }} `
gh release create ${{ inputs.tag || github.ref_name }} `
--title ${{ inputs.tag || github.ref_name }} `
--verify-tag `
--notes "$notes" `
--latest `
Expand All @@ -149,20 +164,22 @@ jobs:
GH_TOKEN: ${{ github.token }}

- name: Create GitHub draft Pull Request to update stable build version in props
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'core-') && !contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-rc')
if: |
(github.ref_type == 'tag' && startsWith(github.ref_name, 'core-') && !contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-rc'))
|| (inputs.tag && startsWith(inputs.tag, 'core-') && !contains(inputs.tag, '-alpha') && !contains(inputs.tag, '-beta') && !contains(inputs.tag, '-rc'))
shell: pwsh
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch --create release/post-stable-${{ github.ref_name }}-update 2>&1 | % ToString
git switch --create release/post-stable-${{ inputs.tag || github.ref_name }}-update main 2>&1 | % ToString
if ($LASTEXITCODE -gt 0)
{
Write-Error 'git switch failure'
Return
}
$match = [regex]::Match('${{ github.ref_name }}', '.*?-(.*)')
$match = [regex]::Match('${{ inputs.tag || github.ref_name }}', '.*?-(.*)')
$packageVersion = $match.Groups[1].Value
(Get-Content Directory.Packages.props) `
Expand All @@ -183,7 +200,7 @@ jobs:
Return
}
git push -u origin release/post-stable-${{ github.ref_name }}-update 2>&1 | % ToString
git push -u origin release/post-stable-${{ inputs.tag || github.ref_name }}-update 2>&1 | % ToString
if ($LASTEXITCODE -gt 0)
{
Write-Error 'git push failure'
Expand All @@ -205,7 +222,7 @@ jobs:
--title "[repo] Core stable release $packageVersion updates" `
--body $body `
--base main `
--head release/post-stable-${{ github.ref_name }}-update `
--head release/post-stable-${{ inputs.tag || github.ref_name }}-update `
--label infra `
--draft
env:
Expand Down
7 changes: 6 additions & 1 deletion .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Default state for all rules
default: true

# allow long lines for tables and code blocks
# MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md013.md
MD013:
code_blocks: false
tables: false

# MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md033.md
MD033:
# Allowed elements
allowed_elements: [ 'details', 'summary' ]
Loading

0 comments on commit eb86a50

Please sign in to comment.