Sync github actions, including release workflow (#274)

* Sync github actions, other than release actions

* Add release workflow

* Remove nebula

* fix

* Add missing workflow

* Fix link

* more

* Updates

* Sentence case

* more
This commit is contained in:
Trask Stalnaker 2022-03-29 10:21:24 -07:00 committed by GitHub
parent 36eae59bce
commit e345310597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 629 additions and 549 deletions

View File

@ -0,0 +1,3 @@
{
"retryOn429": true
}

View File

@ -1,8 +0,0 @@
{
"ignorePatterns": [
{
"pattern": "^https://github\\.com/open-telemetry/opentelemetry-java-contrib/pull/"
}
],
"retryOn429": true
}

View File

@ -1,6 +0,0 @@
---
title: "{{ env.GITHUB_WORKFLOW }} #{{ env.GITHUB_RUN_NUMBER }} failed"
labels: bug
---
<a href="https://github.com/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }}">
{{ env.GITHUB_WORKFLOW }} #{{ env.GITHUB_RUN_NUMBER }}</a> failed. Please take a look and fix it ASAP.

15
.github/workflows/assign-reviewers.yml vendored Normal file
View File

@ -0,0 +1,15 @@
# assigns reviewers to pull requests in a similar way as CODEOWNERS, but doesn't require reviewers
# to have write access to the repository
# see .github/component_owners.yaml for the list of components and their owners
name: Assign reviewers
on:
# pull_request_target is needed instead of just pull_request
# because repository write permission is needed to assign reviewers
pull_request_target:
jobs:
assign-reviewers:
runs-on: ubuntu-latest
steps:
- uses: dyladan/component-owners@main

View File

@ -0,0 +1,38 @@
name: Backport a pull request
on:
workflow_dispatch:
inputs:
number:
description: "The pull request # to backport"
required: true
jobs:
backport:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# history is needed in order to do cherry-pick
fetch-depth: 0
- name: Set up git name
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
- name: Create pull request
env:
NUMBER: ${{ github.event.inputs.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
commit=$(gh pr view $NUMBER --json mergeCommit --jq .mergeCommit.oid)
title=$(gh pr view $NUMBER --json title --jq .title)
url=$(gh pr view $NUMBER --json url --jq .url)
git cherry-pick $commit
git push origin HEAD:backport-$NUMBER-to-$GITHUB_REF_NAME
gh pr create --title "[$GITHUB_REF_NAME] $title" \
--body "Clean cherry-pick of #$NUMBER to the $GITHUB_REF_NAME branch." \
--head backport-$NUMBER-to-$GITHUB_REF_NAME \
--base $GITHUB_REF_NAME

View File

@ -1,20 +1,15 @@
name: "PR Build"
name: Build pull request
on:
pull_request:
branches:
- main
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
- name: Set up JDK for running Gradle
uses: actions/setup-java@v3
with:
distribution: temurin
@ -34,42 +29,46 @@ jobs:
path: jmx-metrics/build/reports/tests/test
integration-test:
name: integration-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
- name: Set up JDK for running Gradle
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Integration Tests
name: Integration test
with:
arguments: --stacktrace integrationTest
cache-read-only: true
- uses: actions/upload-artifact@v2
name: Save integrationTest results
name: Save integration test results
if: always()
with:
name: integration-test-results
path: jmx-metrics/build/reports/tests/integrationTest
# markdown-link-check is not included in the PR build because links to external urls can break at
# any time, which can be confusing for contributors
# this is not a required check to avoid blocking pull requests if external links break
markdown-link-check:
uses: ./.github/workflows/reusable-markdown-link-check.yml
markdown-misspell-check:
# this is not a required check to avoid blocking pull requests if new misspellings are added
# to the misspell dictionary
misspell-check:
uses: ./.github/workflows/reusable-misspell-check.yml
required-status-check:
needs:
- build
- integration-test
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@v3
- name: Check markdown for common misspellings
run: |
curl -L -o ./install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh
./bin/misspell -error ./**/*
- if: |
needs.build.result != 'success' ||
needs.integration-test.result != 'success'
run: exit 1

92
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,92 @@
name: Build
on:
push:
branches:
- main
- v[0-9]+.[0-9]+.x
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK for running Gradle
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: --stacktrace build
- name: Save unit test results
uses: actions/upload-artifact@v2
if: always()
with:
name: test-results
path: jmx-metrics/build/reports/tests/test
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK for running Gradle
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Integration test
uses: gradle/gradle-build-action@v2
with:
arguments: --stacktrace integrationTest
- name: Save integration test results
uses: actions/upload-artifact@v2
if: always()
with:
name: integration-test-results
path: jmx-metrics/build/reports/tests/integrationTest
markdown-link-check:
# release branches are excluded to avoid unnecessary maintenance if external links break
if: ${{ !startsWith(github.ref_name, 'v') }}
uses: ./.github/workflows/reusable-markdown-link-check.yml
misspell-check:
# release branches are excluded to avoid unnecessary maintenance if new misspellings are added
# to the misspell dictionary
if: ${{ !startsWith(github.ref_name, 'v') }}
uses: ./.github/workflows/reusable-misspell-check.yml
publish-snapshots:
needs:
# intentionally not blocking snapshot publishing on markdown-link-check, or misspell-check
- build
- integration-test
runs-on: ubuntu-latest
if: ${{ github.repository == 'open-telemetry/opentelemetry-java-contrib' }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK for running Gradle
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Publish
with:
arguments: --stacktrace snapshot
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}

View File

@ -1,9 +1,9 @@
name: Nightly CodeQL analysis
on:
workflow_dispatch:
schedule:
- cron: '30 1 * * *'
workflow_dispatch:
jobs:
analyze:
@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup Java 17
- name: Set up Java 17
uses: actions/setup-java@v2
with:
distribution: temurin
@ -31,24 +31,10 @@ jobs:
# skipping build cache is needed so that all modules will be analyzed
arguments: assemble --no-build-cache
- name: Perform CodeQL Analysis
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v1
issue:
name: Open issue on failure
needs: analyze
runs-on: ubuntu-latest
if: always()
steps:
# run this action to get workflow conclusion
# You can get conclusion by env (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@v2.2
- uses: actions/checkout@v3
- uses: JasonEtco/create-an-issue@v2.6
if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/templates/workflow-failed.md
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml

View File

@ -1,14 +0,0 @@
# This action assigns and requires approval from owners of components for
# PRs that are open against those components. Components are defined in
# .github/component_owners.yaml as individual paths within this repository.
name: Component Owners
on:
pull_request_target:
jobs:
run_self:
runs-on: ubuntu-latest
name: Auto Assign Owners
steps:
- uses: dyladan/component-owners@main

View File

@ -0,0 +1,16 @@
name: Gradle wrapper validation
on:
pull_request:
paths:
- '**/gradle/wrapper/**'
push:
paths:
- '**/gradle/wrapper/**'
jobs:
validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1.0.4

View File

@ -1,118 +0,0 @@
name: "Main Build"
on:
push:
branches:
- main
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Build
with:
arguments: --stacktrace build
- uses: actions/upload-artifact@v2
name: Save unit test results
if: always()
with:
name: test-results
path: jmx-metrics/build/reports/tests/test
integration-test:
name: integration-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Integration Tests
with:
arguments: --stacktrace integrationTest
- uses: actions/upload-artifact@v2
name: Save integrationTest results
if: always()
with:
name: integration-test-results
path: jmx-metrics/build/reports/tests/integrationTest
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check markdown links
# using retry because of sporadic external site failures
uses: nick-invision/retry@v2.6.0
with:
# timing out has not been a problem
timeout_minutes: 15
# give external site some time to hopefully recover
retry_wait_seconds: 120
max_attempts: 5
command: |
npm install -g markdown-link-check
find . -type f \
-name '*.md' \
-not -path './.github/*' \
-not -path './node_modules/*' \
-print0 \
| xargs -0 -n1 markdown-link-check --config .github/scripts/markdown_link_check_config.json
markdown-misspell-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check markdown for common misspellings
run: |
curl -L -o ./install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh
./bin/misspell -error ./**/*
publish-snapshots:
name: publish-snapshots
runs-on: ubuntu-latest
needs: [build, integration-test]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Publish
with:
arguments: --stacktrace snapshot
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}

View File

@ -1,162 +0,0 @@
name: Patch Release Build
on:
workflow_dispatch:
inputs:
version:
description: The version to tag the release with, e.g., 1.2.1, 1.2.2
required: true
jobs:
# TODO (trask) remove this after 1.13.0 since release branch is now created proactively
prepare-release-branch:
runs-on: ubuntu-latest
outputs:
release-branch-name: ${{ steps.parse-release-branch.outputs.release-branch-name }}
steps:
- id: parse-release-branch
name: Parse release branch name
run: |
# Sets the release-branch-name output to the version number with the last non-period element replaced with an 'x' and preprended with v.
echo "::set-output name=release-branch-name::$(echo '${{ github.event.inputs.version }}' | sed -E 's/([^.]+)\.([^.]+)\.([^.]+)/v\1.\2.x/')"
# Sets the release-tag-name output to the version number with the last non-period element replace with a '0' and prepended with v
echo "::set-output name=release-tag-name::$(echo '${{ github.event.inputs.version }}' | sed -E 's/([^.]+)\.([^.]+)\.([^.]+)/v\1.\2.0/')"
- id: checkout-release-branch
name: Check out release branch
continue-on-error: true
uses: actions/checkout@v3
with:
ref: ${{ steps.parse-release-branch.outputs.release-branch-name }}
fetch-depth: 0
- id: checkout-release-tag
name: Check out release tag
if: ${{ steps.checkout-release-branch.outcome == 'failure' }}
uses: actions/checkout@v3
with:
ref: ${{ steps.parse-release-branch.outputs.release-tag-name }}
fetch-depth: 0
- name: Create release branch
if: ${{ steps.checkout-release-tag.outcome == 'success' }}
run: |
git checkout -b ${{ steps.parse-release-branch.outputs.release-branch-name }}
git push --set-upstream origin ${{ steps.parse-release-branch.outputs.release-branch-name }}
build:
name: build
needs: prepare-release-branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Build
with:
arguments: --stacktrace build
- uses: actions/upload-artifact@v2
name: Save unit test results
if: always()
with:
name: test-results
path: jmx-metrics/build/reports/tests/test
integration-test:
name: integration-test
needs: prepare-release-branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Integration Tests
with:
arguments: --stacktrace integrationTest
- uses: actions/upload-artifact@v2
name: Save integrationTest results
if: always()
with:
name: integration-test-results
path: jmx-metrics/build/reports/tests/integrationTest
publish:
name: publish
runs-on: ubuntu-latest
needs: [ build, integration-test ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Publish
with:
arguments: --stacktrace final closeAndReleaseSonatypeStagingRepository -Prelease.version=${{ github.event.inputs.version }}
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
- name: Set SDK version
id: set-sdk-version
run: |
v=$(grep -Po "io.opentelemetry:opentelemetry-bom:\K[0-9]+.[0-9]+.0" dependencyManagement/build.gradle.kts)
echo "::set-output name=sdk-version::$v"
- name: Generate Release Notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat > release-notes.txt << EOF
This release targets the OpenTelemetry SDK ${{ steps.set-sdk-version.outputs.sdk-version }}.
EOF
sed -n '/^## Version ${{ github.event.inputs.version }}/,/^## Version /p' CHANGELOG.md \
| head -n -1 \
| perl -0pe 's/^\n+//g' \
| perl -0pe 's/\n+$/\n/g' \
| sed -r 's,\[#([0-9]+)]\(https://github.com/open-telemetry/opentelemetry-java-contrib/pull/[0-9]+\),#\1,' \
| perl -0pe 's/\n +/ /g' \
>> release-notes.txt
cat >> release-notes.txt << EOF
EOF
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp jmx-metrics/build/libs/opentelemetry-jmx-metrics-${{ github.event.inputs.version }}.jar opentelemetry-jmx-metrics.jar
gh release create --target ${{ github.ref_name }} \
--title "Version ${{ github.event.inputs.version }}" \
--notes-file release-notes.txt \
--discussion-category announcements \
v${{ github.event.inputs.version }} \
opentelemetry-javaagent.jar

View File

@ -0,0 +1,48 @@
name: Prepare patch release
on:
workflow_dispatch:
jobs:
prepare-patch-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set versions
id: set-versions
run: |
prior_version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1)
if [[ $prior_version =~ ([0-9]+.[0-9]+).([0-9]+) ]]; then
major_minor="${BASH_REMATCH[1]}"
patch="${BASH_REMATCH[2]}"
else
echo "unexpected version: $prior_version"
exit 1
fi
echo "::set-output name=release-version::$major_minor.$((patch + 1))"
echo "::set-output name=prior-release-version::$prior_version"
- name: Bump version
env:
VERSION: ${{ needs.set-versions.outputs.release-version }}
PRIOR_VERSION: ${{ needs.set-versions.outputs.prior-release-version }}
run: |
sed -ri "s/$PRIOR_VERSION/$VERSION/" version.gradle.kts
- name: Set up git name
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
- name: Create pull request
env:
VERSION: ${{ needs.set-versions.outputs.release-version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
msg="Prepare patch release $VERSION"
git commit -a -m "$msg"
git push origin HEAD:prepare-patch-release-$VERSION
gh pr create --title "$msg" \
--body "$msg" \
--head prepare-patch-release-$VERSION \
--base $GITHUB_REF_NAME

View File

@ -0,0 +1,96 @@
name: Prepare release branch
on:
workflow_dispatch:
jobs:
prepare-release-branch:
runs-on: ubuntu-latest
outputs:
release-branch-name: ${{ steps.set-release-branch-name.outputs.release-branch-name }}
steps:
- uses: actions/checkout@v3
- name: Set release branch name
id: set-release-branch-name
run: |
version=$(grep -Eo "[0-9.]+-SNAPSHOT" version.gradle.kts)
release_branch_name=$(echo $version | sed -E 's/([0-9]+)\.([0-9]+)\.0/v\1.\2.x/')
echo "::set-output name=release-branch-name::$release_branch_name"
- name: Create release branch
env:
RELEASE_BRANCH_NAME: ${{ steps.set-release-branch-name.outputs.release-branch-name }}
run: |
git checkout -b $RELEASE_BRANCH_NAME
git push origin $RELEASE_BRANCH_NAME
create-pull-request-against-release-branch:
needs: prepare-release-branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
- name: Bump version on release branch
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.0-SNAPSHOT" version.gradle.kts | sed 's/-SNAPSHOT//')
sed -ri "s/$version-SNAPSHOT/$version/" version.gradle.kts
sed -ri "s/$version-alpha-SNAPSHOT/$version-alpha/" version.gradle.kts
- name: Set up git name
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
- name: Create pull request against release branch
env:
RELEASE_BRANCH_NAME: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
msg="Prepare release branch $RELEASE_BRANCH_NAME"
git commit -a -m "$msg"
git push origin HEAD:prepare-release-branch-$RELEASE_BRANCH_NAME
gh pr create --title "$msg" \
--body "$msg" \
--head prepare-release-branch-$RELEASE_BRANCH_NAME \
--base $RELEASE_BRANCH_NAME
create-pull-request-against-main:
needs:
- prepare-release-branch
- create-pull-request-against-release-branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump snapshot version
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.0-SNAPSHOT" version.gradle.kts | sed 's/-SNAPSHOT//')
if [[ $version =~ ([0-9]+).([0-9]+).0 ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
else
echo "unexpected version: $version"
exit 1
fi
next_version="$major.$((minor + 1)).0"
sed -ri "s/$version-SNAPSHOT/$next_version-SNAPSHOT/" version.gradle.kts
sed -ri "s/$version-apha-SNAPSHOT/$next_version-apha-SNAPSHOT/" version.gradle.kts
- name: Set up git name
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
- name: Create pull request against main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
msg="Bump version"
git commit -a -m "$msg"
git push origin HEAD:bump-snapshot-version
gh pr create --title "$msg" \
--body "$msg" \
--head bump-snapshot-version \
--base main

View File

@ -1,133 +0,0 @@
# Releases a new minor / major version from the HEAD of the main branch
name: Release Build
on:
workflow_dispatch:
inputs:
version:
description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1
required: true
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Build
with:
arguments: --stacktrace build
- uses: actions/upload-artifact@v2
name: Save unit test results
if: always()
with:
name: test-results
path: jmx-metrics/build/reports/tests/test
integration-test:
name: integration-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Integration Tests
with:
arguments: --stacktrace integrationTest
- uses: actions/upload-artifact@v2
name: Save integrationTest results
if: always()
with:
name: integration-test-results
path: jmx-metrics/build/reports/tests/integrationTest
publish:
name: publish
runs-on: ubuntu-latest
needs: [build, integration-test]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Publish
with:
arguments: --stacktrace final closeAndReleaseSonatypeStagingRepository -Prelease.version=${{ github.event.inputs.version }}
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
- name: Set SDK version
id: set-sdk-version
run: |
v=$(grep -Po "io.opentelemetry:opentelemetry-bom:\K[0-9]+.[0-9]+.0" dependencyManagement/build.gradle.kts)
echo "::set-output name=sdk-version::$v"
- name: Generate Release Notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat > release-notes.txt << EOF
This release targets the OpenTelemetry SDK ${{ steps.set-sdk-version.outputs.sdk-version }}.
EOF
sed -n '/^## Version ${{ github.event.inputs.version }}/,/^## Version /p' CHANGELOG.md \
| tail -n +2 \
| head -n -1 \
| perl -0pe 's/^\n+//g' \
| perl -0pe 's/\n+$/\n/g' \
| sed -r 's,\[#([0-9]+)]\(https://github.com/open-telemetry/opentelemetry-java-contrib/pull/[0-9]+\),#\1,' \
| perl -0pe 's/\n +/ /g' \
>> release-notes.txt
cat >> release-notes.txt << EOF
EOF
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp jmx-metrics/build/libs/opentelemetry-jmx-metrics-${{ github.event.inputs.version }}.jar opentelemetry-jmx-metrics.jar
gh release create --target ${{ github.ref_name }} \
--title "Version ${{ github.event.inputs.version }}" \
--notes-file release-notes.txt \
--discussion-category announcements \
v${{ github.event.inputs.version }} \
opentelemetry-javaagent.jar
# proactively create release branch so that contributors can suggest patches more easily
- name: Create release branch
run: |
branch_name=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+)\.([0-9]+)\.0/v\1.\2.x/')
git checkout -b $branch_name
git push origin $branch_name

182
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,182 @@
name: Release
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK for running Gradle
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Build
with:
arguments: --stacktrace build
- uses: actions/upload-artifact@v2
name: Save unit test results
if: always()
with:
name: test-results
path: jmx-metrics/build/reports/tests/test
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK for running Gradle
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
name: Integration test
with:
arguments: --stacktrace integrationTest
- uses: actions/upload-artifact@v2
name: Save integration test results
if: always()
with:
name: integration-test-results
path: jmx-metrics/build/reports/tests/integrationTest
release:
runs-on: ubuntu-latest
needs:
- build
- integration-test
steps:
- uses: actions/checkout@v3
with:
# tags are needed for the generate-release-contributors.sh script
fetch-depth: 0
- name: Set up JDK for running Gradle
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Build and publish artifacts
uses: gradle/gradle-build-action@v2
with:
arguments: assemble publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
- name: Set versions
id: set-versions
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1)
if [[ $version =~ ([0-9]+).([0-9]+).([0-9]+) ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
else
echo "unexpected version: $version"
exit 1
fi
if [[ $patch == 0 ]]; then
if [[ $minor == 0 ]]; then
prior_major=$((major - 1))
prior_minor=$(grep -Po "^## Version $prior_major.\K([0-9]+)" CHANGELOG.md | head -1)
prior_version="$prior_major.$prior_minor"
else
prior_version="$major.$((minor - 1)).0"
fi
else
prior_version="$major.$minor.$((patch - 1))"
fi
echo "::set-output name=release-version::$version"
echo "::set-output name=prior-release-version::$prior_version"
- name: Generate release notes
env:
VERSION: ${{ steps.set-versions.outputs.release-version }}
PRIOR_VERSION: ${{ steps.set-versions.outputs.prior-release-version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ $version == *.0 ]]; then
cat > release-notes.txt << EOF
This release targets the OpenTelemetry SDK $VERSION.
EOF
else
cat > release-notes.txt << EOF
This is a patch release on the previous $PRIOR_VERSION release, fixing the issue(s) below.
EOF
fi
sed -n '/^## Version $VERSION/,/^## Version /p' CHANGELOG.md \
| tail -n +2 \
| head -n -1 \
| perl -0pe 's/^\n+//g' \
| perl -0pe 's/\n+$/\n/g' \
| sed -r 's,\[#([0-9]+)]\(https://github.com/$GITHUB_REPOSITORY/(pull|issues)/[0-9]+\),#\1,' \
| perl -0pe 's/\n +/ /g' \
>> release-notes.txt
if [[ $version == *.0 ]]; then
cat >> release-notes.txt << EOF
### 🙇 Thank you
This release was possible thanks to the following contributors who shared their brilliant ideas and awesome pull requests:
EOF
.github/scripts/generate-release-contributors.sh v$PRIOR_VERSION v$VERSION >> release-notes.txt
fi
- name: Create GitHub release
env:
VERSION: ${{ steps.set-versions.outputs.release-version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp jmx-metrics/build/libs/opentelemetry-jmx-metrics-$VERSION.jar opentelemetry-jmx-metrics.jar
gh release create --target $GITHUB_REF_NAME \
--title "Version $VERSION" \
--notes-file release-notes.txt \
--discussion-category announcements \
v$VERSION \
opentelemetry-jmx-metrics.jar
- uses: actions/checkout@v3
with:
ref: main
# history is needed in order to generate the patch
fetch-depth: 0
- name: Set up git name
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
# this step should be last since it will fail if conflicting change log updates on main
- name: Create pull request to merge any change log updates to main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git format-patch --stdout main..$GITHUB_REF_NAME CHANGELOG.md > patch
if [ -s patch ]; then
git apply patch
msg="Merge change log updates from $GITHUB_REF_NAME to main"
git commit -a -m "$msg"
git push origin HEAD:opentelemetry-java-bot/merge-change-log-updates
gh pr create --title "$msg" \
--body "$msg" \
--head opentelemetry-java-bot/merge-change-log-updates \
--base main
fi

View File

@ -0,0 +1,26 @@
name: Reusable - Create issue for failure
on:
workflow_call:
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat > body.txt << EOF
[$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) failed.
Please take a look and fix it ASAP.
EOF
gh issue create --title "$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER failed" \
--label bug \
--label area:build \
--label priority:p1 \
--body-file body.txt

View File

@ -0,0 +1,21 @@
name: Reusable - Markdown link check
on:
workflow_call:
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install markdown-link-check
run: npm install -g markdown-link-check
- name: Run markdown-link-check
run: |
# --quiet displays errors only, making them easier to find in the log
find . -type f \
-name '*.md' \
-not -path './CHANGELOG.md' \
| xargs markdown-link-check --quiet --config .github/scripts/markdown-link-check-config.json

View File

@ -0,0 +1,18 @@
name: Reusable - Misspell check
on:
workflow_call:
jobs:
misspell-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install misspell
run: |
curl -L -o ./install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh
- name: Run misspell
run: bin/misspell -error .

View File

@ -2,55 +2,48 @@
OpenTelemetry Java Contrib uses [SemVer standard](https://semver.org) for versioning of its artifacts.
Instead of manually specifying project version (and by extension the version of built artifacts)
in gradle build scripts, we use [nebula-release-plugin](https://github.com/nebula-plugins/nebula-release-plugin)
to calculate the current version based on git tags. This plugin looks for the latest tag of the form
`vX.Y.Z` on the current branch and calculates the current project version as `vX.Y.(Z+1)-SNAPSHOT`.
The version is specified in [version.gradle.kts](version.gradle.kts).
## Snapshot builds
Every successful CI build of the master branch automatically executes `./gradlew snapshot` as the last task.
This signals Nebula plugin to build and publish to
[Sonatype OSS snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/io/opentelemetry/)
next _minor_ release version. This means version `vX.(Y+1).0-SNAPSHOT`.
## Starting the Release
Every successful CI build of the main branch automatically executes `./gradlew publishToSonatype`
as the last step, which publishes a snapshot build to
[Sonatype OSS snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/io/opentelemetry/contrib/).
Before making the release, merge a PR to `main` updating the `CHANGELOG.md`.
You can use the script at `buildscripts/draft-change-log-entries.sh` to help create an initial draft.
Typically only end-user facing changes are included in the change log.
## Preparing a new major or minor release
Open the [Release workflow](https://github.com/open-telemetry/opentelemetry-java-contrib/actions/workflows/release-build.yml).
* Close the release milestone if there is one.
* Merge a pull request to `main` updating the `CHANGELOG.md`.
* Run the [Prepare release branch workflow](.github/workflows/prepare-release-branch.yml).
* Review and merge the two pull requests that it creates
(one is targeted to the release branch and one is targeted to the `main` branch).
Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `v1.9.x`, and click the "Run workflow" button below that.
This workflow will publish the artifacts to maven central and will publish a github release with the
javaagent jar attached and release notes based on the change log.
### Notifying other OpenTelemetry projects
When cutting a new release, the relevant integration tests for components in other opentelemetry projects need to be updated.
- OpenTelemetry Collector contrib JMX receiver - [Downloads latest version here](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/jmxreceiver/integration_test.go)
## Patch Release
## Preparing a new patch release
All patch releases should include only bug-fixes, and must avoid adding/modifying the public APIs.
In general, patch releases are only made for bug-fixes for the following types of issues:
* Regressions
* Memory leaks
* Deadlocks
In general, patch releases are only made for regressions, memory leaks and deadlocks.
Before making the release:
* Backport pull request(s) to the release branch
* Run the [Backport pull request workflow](.github/workflows/backport-pull-request.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `v1.9.x`, then enter the pull request number that you want to backport,
then click the "Run workflow" button below that.
* Review and merge the backport pull request that it generates
* Merge a pull request to the release branch updating the `CHANGELOG.md`
* Run the [Prepare patch release workflow](.github/workflows/prepare-patch-release.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `v1.9.x`, and click the "Run workflow" button below that.
* Review and merge the pull request that it creates
* Merge PR(s) containing the desired patches to the release branch
* Merge a PR to the release branch updating the `CHANGELOG.md`
## Making the release
Open the [Patch release workflow](https://github.com/open-telemetry/opentelemetry-java-contrib/actions/workflows/patch-release-build.yml).
Run the [Release workflow](.github/workflows/release.yml).
Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `v1.9.x`, and click the "Run workflow" button below that.
This workflow will publish the artifacts to maven central and will publish a github release with
release notes based on the change log.
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `v1.9.x`, and click the "Run workflow" button below that.
* This workflow will publish the artifacts to maven central and will publish a GitHub release with
release notes based on the change log and with the javaagent jar attached.
* Lastly, if there were any change log updates in the release branch that need to be merged back to
the main branch, the workflow will create a pull request if the updates can be cleanly applied,
or it will fail this last step if the updates cannot be cleanly applied.

View File

@ -7,4 +7,4 @@ This module contains a custom `IdGenerator` and `Sampler` for use with AWS X-Ray
- [Anuraag Agrawal](https://github.com/anuraaga), AWS
- [William Armiros](https://github.com/willarmiros), AWS
Learn more about component owners in [component-owners.yml](../.github/workflows/component-owners.yml).
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml).

View File

@ -1,4 +1,3 @@
import nebula.plugin.release.git.opinion.Strategies
import java.time.Duration
plugins {
@ -8,16 +7,9 @@ plugins {
id("com.github.ben-manes.versions")
id("io.github.gradle-nexus.publish-plugin")
id("nebula.release")
}
release {
defaultVersionStrategy = Strategies.getSNAPSHOT()
}
nebulaRelease {
addReleaseBranchPattern("""v\d+\.\d+\.x""")
}
apply(from = "version.gradle.kts")
nexusPublishing {
packageGroup.set("io.opentelemetry")

View File

@ -19,12 +19,6 @@ publishing {
}
}
if (findProperty("otel.stable") != "true") {
val versionParts = version.split('-').toMutableList()
versionParts[0] += "-alpha"
version = versionParts.joinToString("-")
}
afterEvaluate {
val mavenGroupId: String? by project
if (mavenGroupId != null) {
@ -68,10 +62,6 @@ publishing {
}
}
rootProject.tasks.named("release").configure {
finalizedBy(tasks["publishToSonatype"])
}
// Sign only if we have a key to do so
val signingKey: String? = System.getenv("GPG_PRIVATE_KEY")
// Stub out entire signing block off of CI since Gradle provides no way of lazy configuration of

View File

@ -12,4 +12,4 @@ The main entry point is the `JfrMetrics` class in the package `io.opentelemetry.
- [Jack Berg](https://github.com/jack-berg), New Relic
- [Jason Plumb](https://github.com/breedx-splk), Splunk
Learn more about component owners in [component-owners.yml](../.github/workflows/component-owners.yml).
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml).

View File

@ -248,4 +248,4 @@ file contents can also be provided via stdin on startup when using `-config -` a
- [Ryan Fitzpatrick](https://github.com/rmfitzpatrick), Splunk
- [Sam DeHaan](https://github.com/dehaansa), ObservIQ
Learn more about component owners in [component-owners.yml](../.github/workflows/component-owners.yml).
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml).

View File

@ -186,4 +186,4 @@ The [`otel-cli`](https://github.com/equinix-labs/otel-cli) is a command line wra
- [Cyrille Le Clerc](https://github.com/cyrille-leclerc), Elastic
- [Ken Finnigan](https://github.com/kenfinnigan), Workday
Learn more about component owners in [component-owners.yml](../.github/workflows/component-owners.yml).
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml).

View File

@ -3,4 +3,4 @@
- [Nikita Salnikov-Tarnovski](https://github.com/iNikem), Splunk
- [Trask Stalnaker](https://github.com/trask), Microsoft
Learn more about component owners in [component-owners.yml](../.github/workflows/component-owners.yml).
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml).

View File

@ -3,4 +3,4 @@
- [Anuraag Agrawal](https://github.com/anuraaga), AWS
- [Nikita Salnikov-Tarnovski](https://github.com/iNikem), Splunk
Learn more about component owners in [component-owners.yml](../.github/workflows/component-owners.yml).
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml).

View File

@ -4,7 +4,6 @@ pluginManagement {
id("com.github.johnrengelman.shadow") version "7.1.2"
id("com.gradle.enterprise") version "3.8.1"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("nebula.release") version "16.0.0"
}
}

View File

@ -21,4 +21,4 @@ Maven3 plugin running the static instrumentation agent during the `package` phas
- [Jakub Wach](https://github.com/kubawach), Splunk
- [Anna Nosek](https://github.com/Enkelian), Splunk
Learn more about component owners in [component-owners.yml](../.github/workflows/component-owners.yml).
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml).

7
version.gradle.kts Normal file
View File

@ -0,0 +1,7 @@
allprojects {
if (findProperty("otel.stable") != "true") {
version = "1.13.0-alpha-SNAPSHOT"
} else {
version = "1.13.0-SNAPSHOT"
}
}