This commit is contained in:
Trask Stalnaker 2022-05-10 09:27:00 -07:00 committed by GitHub
parent 8afa13eec8
commit 432606a168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 115 additions and 125 deletions

View File

@ -18,5 +18,8 @@ else
prior_version="$major.$((minor - 1)).0"
fi
echo "## Version $version (Unreleased)"
echo
git log --reverse --pretty=format:"- %s" "v$prior_version"..HEAD \
| sed -r 's,\(#([0-9]+)\),\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'

3
.github/scripts/get-version.sh vendored Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts

View File

@ -1,5 +1,7 @@
#!/bin/bash -e
# this script helps to reduce sporadic link check failures by retrying at a file-by-file level
retry_count=3
for file in "$@"; do

4
.github/scripts/set-git-user.sh vendored Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash -e
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com

View File

@ -1,23 +1,22 @@
#!/bin/bash
#!/bin/bash -e
# Updates versions in these files
sed -Ei "s/[0-9]+\.[0-9]+\.[0-9]+/$1/" version.gradle.kts
# also update versions in these files
# - examples/distro/build.gradle
# - examples/extension/build.gradle
version=$1
if [[ $version == *-SNAPSHOT ]]; then
alpha_version=${version//-SNAPSHOT/-alpha-SNAPSHOT}
else
alpha_version=$version-alpha
fi
sed -Ei "s/(opentelemetryJavaagent *: )\"[^\"]*\"/\1\"$version\"/" examples/distro/build.gradle
sed -Ei "s/(opentelemetryJavaagentAlpha *: )\"[^\"]*\"/\1\"$alpha_version\"/" examples/distro/build.gradle
sed -ri "s/(opentelemetryJavaagent *: )\"[^\"]*\"/\1\"$version\"/" examples/distro/build.gradle
sed -ri "s/(opentelemetryJavaagentAlpha *: )\"[^\"]*\"/\1\"$alpha_version\"/" examples/distro/build.gradle
sed -Ei "s/(opentelemetryJavaagent *: )\"[^\"]*\"/\1\"$version\"/" examples/extension/build.gradle
sed -Ei "s/(opentelemetryJavaagentAlpha *: )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle
sed -ri "s/(opentelemetryJavaagent *: )\"[^\"]*\"/\1\"$version\"/" examples/extension/build.gradle
sed -ri "s/(opentelemetryJavaagentAlpha *: )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle
sed -ri "s/(io.opentelemetry.instrumentation.muzzle-generation\" version )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle
sed -ri "s/(io.opentelemetry.instrumentation.muzzle-check\" version )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle
sed -Ei "s/(io.opentelemetry.instrumentation.muzzle-generation\" version )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle
sed -Ei "s/(io.opentelemetry.instrumentation.muzzle-check\" version )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle

View File

@ -16,20 +16,19 @@ jobs:
fetch-depth: 0
- name: Set git user
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
run: .github/scripts/set-git-user.sh
- name: Create pull request
env:
NUMBER: ${{ github.event.inputs.number }}
# not using the default GITHUB_TOKEN because pull requests generated by it do not run any workflows
GITHUB_TOKEN: ${{ secrets.BOT_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)
branch=backport-$NUMBER-to-${GITHUB_REF_NAME//\//-}
branch="backport-${NUMBER}-to-${GITHUB_REF_NAME//\//-}"
git cherry-pick $commit
git push origin HEAD:$branch

View File

@ -60,4 +60,4 @@ jobs:
- gradle-plugins
- examples
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -62,4 +62,4 @@ jobs:
- markdown-link-check
- misspell-check
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -35,6 +35,7 @@ jobs:
uses: github/codeql-action/analyze@v2
open-issue-on-failure:
# open an issue on failure because it can be easy to miss CI failure notifications
needs: analyze
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -4,7 +4,7 @@ on:
jobs:
create-pull-request:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
@ -15,18 +15,17 @@ jobs:
fetch-depth: 0
- name: Set git user
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
run: .github/scripts/set-git-user.sh
# this will fail if there have been conflicting change log updates introduced in main
- name: Create pull request against main
env:
# not using the default GITHUB_TOKEN because pull requests generated by it do not run any workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
message="Merge change log updates from $GITHUB_REF_NAME"
body="Merge change log updates from \`$GITHUB_REF_NAME\`."
branch=merge-change-log-updates-from-${GITHUB_REF_NAME//\//-}
branch="merge-change-log-updates-from-${GITHUB_REF_NAME//\//-}"
git format-patch --stdout HEAD..origin/$GITHUB_REF_NAME CHANGELOG.md | git apply --3way
git commit -a -m "$message"

View File

@ -48,4 +48,4 @@ jobs:
open-issue-on-failure:
needs: run-overhead-tests
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -10,37 +10,33 @@ jobs:
- name: Set environment variables
run: |
prior_version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts)
if [[ $prior_version =~ ([0-9]+.[0-9]+).([0-9]+) ]]; then
version=$(.github/scripts/get-version.sh)
if [[ $version =~ ([0-9]+\.[0-9]+)\.([0-9]+) ]]; then
major_minor="${BASH_REMATCH[1]}"
patch="${BASH_REMATCH[2]}"
else
echo "unexpected version: $prior_version"
echo "unexpected version: $version"
exit 1
fi
echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
- name: Update version
run: |
sed -ri "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/" version.gradle.kts
.github/scripts/update-examples.sh "$VERSION"
run: .github/scripts/update-version.sh $VERSION ${VERSION}-alpha
- name: Update download link version
run: |
sed -Ei "s,https://github\.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v[0-9]+\.[0-9]+\.[0-9]+/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$VERSION/," README.md
- name: Set git user
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
run: .github/scripts/set-git-user.sh
- name: Create pull request
env:
# not using the default GITHUB_TOKEN because pull requests generated by it do not run any workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
message="Prepare release $VERSION"
branch=prepare-release-$VERSION
branch="prepare-release-${VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch

View File

@ -11,8 +11,9 @@ jobs:
- name: Create release branch
id: create-release-branch
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
release_branch_name=$(echo $version | sed -E 's,([0-9]+)\.([0-9]+)\.0,release/v\1.\2.x,')
version=$(.github/scripts/get-version.sh)
version=${version//-SNAPSHOT/}
release_branch_name=$(echo $version | sed -E 's/([0-9]+)\.([0-9]+)\.0/release\/v\1.\2.x/')
git push origin HEAD:$release_branch_name
@ -20,11 +21,7 @@ jobs:
echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV
- name: Update version
run: |
sed -ri "s/val snapshot = true/val snapshot = false/" version.gradle.kts
version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
.github/scripts/update-examples.sh "$version"
run: .github/scripts/update-version.sh $VERSION ${VERSION}-alpha
- name: Update download link version
run: |
@ -32,16 +29,15 @@ jobs:
sed -Ei "s,https://github\.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/," README.md
- name: Set git user
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
run: .github/scripts/set-git-user.sh
- name: Create pull request against the release branch
env:
# not using the default GITHUB_TOKEN because pull requests generated by it do not run any workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
message="Prepare release $VERSION"
branch=prepare-release-$VERSION
branch="prepare-release-${VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch
@ -55,10 +51,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Update version
- name: Set environment variables
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
if [[ $version =~ ([0-9]+).([0-9]+).0 ]]; then
version=$(.github/scripts/get-version.sh)
if [[ $version =~ ([0-9]+)\.([0-9]+)\.0 ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
else
@ -66,24 +62,25 @@ jobs:
exit 1
fi
next_version="$major.$((minor + 1)).0"
sed -ri "s/[0-9]+\.[0-9]+\.[0-9]+/$next_version/" version.gradle.kts
.github/scripts/update-examples.sh "$next_version-SNAPSHOT"
next_version="${next_version}-SNAPSHOT"
echo "NEXT_VERSION=$next_version" >> $GITHUB_ENV
- name: Set git user
- name: Update version
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
next_alpha_version=${NEXT_VERSION//-SNAPSHOT/}-alpha-SNAPSHOT
.github/scripts/update-version.sh $NEXT_VERSION $NEXT_ALPHA_VERSION
- name: Set git user
run: .github/scripts/set-git-user.sh
- name: Create pull request against main
env:
# not using the default GITHUB_TOKEN because pull requests generated by it do not run any workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
message="Update version to $NEXT_VERSION-SNAPSHOT"
body="Update version to \`$NEXT_VERSION-SNAPSHOT\`."
branch=update-version-to-$NEXT_VERSION-snapshot
message="Update version to $NEXT_VERSION"
body="Update version to \`$NEXT_VERSION\`."
branch="update-version-to-${NEXT_VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch

View File

@ -73,4 +73,4 @@ jobs:
- publishLinux
- publishWindows
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -19,4 +19,4 @@ jobs:
open-issue-on-failure:
needs: publish
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -54,4 +54,4 @@ jobs:
- publish
- publish-java-15
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -21,4 +21,4 @@ jobs:
open-issue-on-failure:
needs: publish
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -72,4 +72,4 @@ jobs:
open-issue-on-failure:
needs: publish
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -19,4 +19,4 @@ jobs:
open-issue-on-failure:
needs: publish
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml
uses: ./.github/workflows/reusable-open-issue-on-failure.yml

View File

@ -36,13 +36,18 @@ jobs:
- examples
runs-on: ubuntu-latest
steps:
- run: |
if [[ $GITHUB_REF_NAME != release/* ]]; then
echo the release workflow should only be run against release branches
exit 1
fi
- 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
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
@ -73,8 +78,8 @@ jobs:
- name: Set environment variables
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts)
if [[ $version =~ ([0-9]+).([0-9]+).([0-9]+) ]]; then
version=$(.github/scripts/get-version.sh)
if [[ $version =~ ([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
@ -98,7 +103,7 @@ jobs:
- name: Generate release notes
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# conditional blocks not indented because of the heredoc
if [[ $VERSION == *.0 ]]; then
@ -115,14 +120,9 @@ jobs:
EOF
fi
# the last complex regex is needed because markdown docs render newlines as soft wraps
# the complex perl regex is needed because markdown docs render newlines as soft wraps
# while release notes render them as line breaks
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," \
sed -n "0,/^## Version $VERSION/d;/^## Version /q;p" CHANGELOG.md \
| perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' \
>> release-notes.txt
@ -140,9 +140,9 @@ jobs:
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp javaagent/build/libs/opentelemetry-javaagent-$VERSION.jar opentelemetry-javaagent.jar
cp javaagent/build/libs/opentelemetry-javaagent-${VERSION}.jar opentelemetry-javaagent.jar
gh release create --target $GITHUB_REF_NAME \
--title "Version $VERSION" \
--notes-file release-notes.txt \
@ -152,22 +152,21 @@ jobs:
- name: Update the change log with the release date
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
sed -ri "s/## Version $VERSION .*/## Version $VERSION ($date)/" CHANGELOG.md
sed -Ei "s/## Version $VERSION .*/## Version $VERSION ($date)/" CHANGELOG.md
- name: Set git user
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
run: .github/scripts/set-git-user.sh
- name: Create pull request against the release branch
env:
# not using the default GITHUB_TOKEN because pull requests generated by it do not run any workflows
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
message="Add the release date for $VERSION to the change log"
branch=add-release-date-for-$VERSION
branch="add-release-date-for-${VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch
@ -186,16 +185,14 @@ jobs:
run: |
git remote add upstream https://github.com/open-telemetry/opentelemetry-operator.git
git fetch upstream
git checkout -b update-opentelemetry-javaagent-to-$VERSION upstream/main
git checkout -b update-opentelemetry-javaagent-to-${VERSION} upstream/main
- name: Update version
run: |
echo $VERSION > autoinstrumentation/java/version.txt
- name: Set git user
run: |
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
run: .github/scripts/set-git-user.sh
- name: Create pull request against opentelemetry-operator
env:
@ -210,7 +207,7 @@ jobs:
# repository if you set up a tracking branch
git commit -a -m "$message"
git push --set-upstream origin update-opentelemetry-javaagent-to-$VERSION
git push --set-upstream origin update-opentelemetry-javaagent-to-${VERSION}
gh pr create --title "$message" \
--body "$body" \
--repo open-telemetry/opentelemetry-operator \

View File

@ -1,26 +0,0 @@
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.BOT_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,18 @@
name: Reusable - Open issue on failure
on:
workflow_call:
jobs:
open-issue:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Open issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue create --title "$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER failed" \
--label bug \
--body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."

View File

@ -15,7 +15,7 @@ as the last step, which publishes a snapshot build to
* Close the release milestone if there is one.
* Merge a pull request to `main` updating the `CHANGELOG.md`.
* The heading for the release should include the release version but not the release date, e.g.
`## Version 1.9.0 (unreleased)`.
`## Version 1.9.0 (Unreleased)`.
* Use `.github/scripts/draft-change-log-entries.sh` as a starting point for writing the change
log.
* Run the [Prepare release branch workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/prepare-release-branch.yml).
@ -37,7 +37,7 @@ and deadlocks.
* Review and merge the backport pull request that it generates.
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
* The heading for the release should include the release version but not the release date, e.g.
`## Version 1.9.1 (unreleased)`.
`## Version 1.9.1 (Unreleased)`.
* Run the [Prepare patch release workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/prepare-patch-release.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.

View File

@ -1,12 +1,10 @@
val snapshot = true
val stableVersion = "1.14.0-SNAPSHOT"
val alphaVersion = "1.14.0-alpha-SNAPSHOT"
allprojects {
var ver = "1.14.0"
if (findProperty("otel.stable") != "true") {
ver += "-alpha"
version = alphaVersion
} else {
version = stableVersion
}
if (snapshot) {
ver += "-SNAPSHOT"
}
version = ver
}