From 9c69db17d8e95af93f8fad3576f97f2e7e48bc3d Mon Sep 17 00:00:00 2001 From: Hugh Simpson Date: Tue, 10 Sep 2024 12:22:41 +0100 Subject: [PATCH 1/3] Squash workflow changes --- .github/workflows/ci.yml | 38 ++++++++++++++++-- .github/workflows/pr-bb-updates.yml | 54 +++++++++++++++++++++++++ bb.patch | 62 +++++++++++++++++++++++++++++ byte-buddy-tag | 1 + 4 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pr-bb-updates.yml create mode 100644 bb.patch create mode 100644 byte-buddy-tag diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75563c7..2b9f600 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,37 @@ name: Test all the things -on: [push, pull_request] +on: + push: + pull_request: + issue_comment: + types: [ created ] + workflow_dispatch: + +permissions: + checks: write + pull-requests: read + contents: read jobs: ci: + if: (github.event.issue.pull_request && contains(github.event.comment.body, 'please rerun tests')) || !github.event.issue runs-on: ubuntu-latest name: Java ${{ matrix.java }} strategy: matrix: - java: [8, 11, 17, 21] + java: [ 8, 11, 17, 21 ] fail-fast: false steps: + - name: Get PR branch + uses: xt0rted/pull-request-comment-branch@v2 + id: comment-branch + if: github.event.issue.pull_request + - uses: actions/checkout@v3 + if: (!github.event.issue) - uses: actions/checkout@v3 + with: + ref: ${{ steps.comment-branch.outputs.head_ref }} + if: github.event.issue.pull_request - name: Set up JDK ${{ matrix.java }} uses: actions/cache@v2 with: @@ -31,4 +51,16 @@ jobs: ./gradlew wrapper --gradle-version=8.4-rc-1 :agent:spec && ./gradlew wrapper --gradle-version=8.4-rc-1 agent:publishToMavenLocal else ./travis-test.sh - fi \ No newline at end of file + fi + - name: Report status + if: github.event.issue.pull_request + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/$GITHUB_REPOSITORY/check-runs \ + -f "name=Test all the things / Java ${{ matrix.java }}" -f "head_sha=${{ steps.comment-branch.outputs.head_ref }}" -f "status=completed" \ + -f "output[title]=Requested test" -f "conclusion=success" -f "details_url=https://github.com/$GITHUB_REPOSITORY/actions/runs/${{ github.run_id }}" -f "output[summary]=Manually triggered test succeeded" \ No newline at end of file diff --git a/.github/workflows/pr-bb-updates.yml b/.github/workflows/pr-bb-updates.yml new file mode 100644 index 0000000..7e02ec9 --- /dev/null +++ b/.github/workflows/pr-bb-updates.yml @@ -0,0 +1,54 @@ +name: "Byte Buddy Update" + +on: + pull_request: + +permissions: + pull-requests: write + contents: write + +jobs: + pr-api-change: + name: PR Byte Buddy change + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 8 + - name: Rebuild byte-buddy if version has changed + env: + GH_TOKEN: ${{ github.token }} + run: | + if [ 'byte-buddy-tag' = $(git diff --diff-filter=d --name-only origin/master -- 'byte-buddy-tag' agent/libs | xargs) ] + then + echo Byte Buddy tag was updated + tag=$(cat byte-buddy-tag) + rm agent/libs/byte-buddy* + git clone https://github.com/raphw/byte-buddy.git + cp bb.patch byte-buddy + cd byte-buddy + git checkout $tag + git apply bb.patch + mvn clean package -Pextras -Dskiptests -q -B + echo Build succeeded + mv ./byte-buddy/target/$tag.jar ../agent/libs + mv ./byte-buddy/target/$tag-sources.jar ../agent/libs + cd .. + rm -rf byte-buddy + perl -pi -e "s|libs/byte-buddy-.+jar|libs/$tag.jar|" agent/build.gradle + echo updated byte buddy and reference + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY + echo set origin url to https://github.com/$GITHUB_REPOSITORY + git fetch + git checkout -b update_byte_buddy-tag-$tag + git add agent/libs agent/build.gradle + git config --global user.name "GitHub Actions" + git config --global user.email "github_actions_bot@kamon.io" + git commit -m "rebuilt byte buddy" + git push -f origin update_byte_buddy-tag-$tag + gh pr create -B master -H update_byte_buddy-tag-$tag --fill && echo Update PR successfully made || echo PR is already open + fi \ No newline at end of file diff --git a/bb.patch b/bb.patch new file mode 100644 index 0000000..7318f4f --- /dev/null +++ b/bb.patch @@ -0,0 +1,62 @@ +diff --git a/byte-buddy-dep/pom.xml b/byte-buddy-dep/pom.xml +index 3f8fa6217f..07ed398b33 100644 +--- a/byte-buddy-dep/pom.xml ++++ b/byte-buddy-dep/pom.xml +@@ -48,10 +48,6 @@ + org.ow2.asm + asm-analysis + +- +- org.ow2.asm +- asm-tree +- + + + +diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/InstrumentedType.java b/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/InstrumentedType.java +index 936a7c2b61..302c55e373 100644 +--- a/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/InstrumentedType.java ++++ b/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/InstrumentedType.java +@@ -44,7 +44,8 @@ import static net.bytebuddy.matcher.ElementMatchers.is; + import static net.bytebuddy.matcher.ElementMatchers.not; + + /** +- * Implementations of this interface represent an instrumented type that is subject to change. Implementations ++ * Implementations of this ++ represent an instrumented type that is subject to change. Implementations + * should however be immutable and return new instance when its builder methods are invoked. + */ + public interface InstrumentedType extends TypeDescription { +@@ -509,10 +510,10 @@ public interface InstrumentedType extends TypeDescription { + * A set containing all keywords of the Java programming language. + */ + private static final Set KEYWORDS = new HashSet(Arrays.asList( +- "abstract", "continue", "for", "new", "switch", "assert", "default", "goto", "package", "synchronized", "boolean", ++ "abstract", "continue", "for", "new", "switch", "assert", "goto", "package", "synchronized", "boolean", + "do", "if", "private", "this", "break", "double", "implements", "protected", "throw", "byte", "else", "import", + "public", "throws", "case", "enum", "instanceof", "return", "transient", "catch", "extends", "int", "short", +- "try", "char", "final", "interface", "static", "void", "class", "finally", "long", "strictfp", "volatile", ++ "try", "char", "final", "static", "void", "class", "finally", "long", "strictfp", "volatile", + "const", "float", "native", "super", "while" + )); + +diff --git a/byte-buddy/pom.xml b/byte-buddy/pom.xml +index 35e8445b31..1c5bd75787 100644 +--- a/byte-buddy/pom.xml ++++ b/byte-buddy/pom.xml +@@ -277,6 +277,7 @@ + **/NOTICE + + ++ + + + diff --git a/byte-buddy-tag b/byte-buddy-tag new file mode 100644 index 0000000..46e0713 --- /dev/null +++ b/byte-buddy-tag @@ -0,0 +1 @@ +byte-buddy-1.14.5 From db2e88fb78bd08be66c60455f71739f0e83efa1d Mon Sep 17 00:00:00 2001 From: Hugh Simpson Date: Tue, 10 Sep 2024 12:33:05 +0100 Subject: [PATCH 2/3] rm workflow_dispatch trigger --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b9f600..81aa118 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,6 @@ on: pull_request: issue_comment: types: [ created ] - workflow_dispatch: permissions: checks: write From f23ca3f491b04b7e75709162b4790b2e45227116 Mon Sep 17 00:00:00 2001 From: Hugh Simpson Date: Tue, 10 Sep 2024 12:40:48 +0100 Subject: [PATCH 3/3] better target_url --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81aa118..2177bc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,4 +62,4 @@ jobs: -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/$GITHUB_REPOSITORY/check-runs \ -f "name=Test all the things / Java ${{ matrix.java }}" -f "head_sha=${{ steps.comment-branch.outputs.head_ref }}" -f "status=completed" \ - -f "output[title]=Requested test" -f "conclusion=success" -f "details_url=https://github.com/$GITHUB_REPOSITORY/actions/runs/${{ github.run_id }}" -f "output[summary]=Manually triggered test succeeded" \ No newline at end of file + -f "output[title]=Requested test" -f "conclusion=success" -f "target_url=https://github.com/$GITHUB_REPOSITORY/actions/runs/${{ github.run_id }}" -f "output[summary]=Manually triggered test succeeded" \ No newline at end of file