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
21 changes: 21 additions & 0 deletions .github/workflows/Check-Build-Files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
check-build-files:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
with:
fetch-depth: 2

- name: Check changed files meet build linter requirements
run: |
CHANGED_FILES=$(git diff --name-only -r HEAD^1 HEAD | xargs)
./automation/pull-request/lint-build-files.sh $CHANGED_FILES
if [ $? -ne 0 ]; then
echo "::warning::Build files in this PR did not pass optional checks. Please review for accuracy! See check-build-files step for details."
fi
continue-on-error: true
54 changes: 54 additions & 0 deletions .github/workflows/migrate_publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test migration workflow

on:
workflow_dispatch:
inputs:
agent-ref:
description: "Specify agent branch/tag/sha (main is default)"
required: false
default: 'main'

jobs:
publish_release:
runs-on: ubuntu-24.04
steps:
- name: Checkout Agent
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # pin@v4
with:
ref: ${{ inputs.agent-ref || 'main' }}

- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Publish release
env:
SONATYPE_USERNAME: ${{ secrets.MIGRATION_TEST_SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.MIGRATION_TEST_SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew $GRADLE_OPTIONS publish -x :newrelic-scala3-api:publish -x :newrelic-scala-api:publish -x :newrelic-scala-cats-api:publish -x :newrelic-cats-effect3-api:publish -x :newrelic-scala-zio-api:publish -x :newrelic-scala-zio2-api:publish -x :agent-bridge:publish -x :agent-bridge-datastore:publish -x :newrelic-weaver:publish -x :newrelic-weaver-api:publish -x :newrelic-weaver-scala:publish -x :newrelic-weaver-scala-api:publish -x :newrelic-opentelemetry-agent-extension:publish -Prelease=true
- name: Publish release scala apis
env:
SONATYPE_USERNAME: ${{ secrets.MIGRATION_TEST_SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.MIGRATION_TEST_SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew $GRADLE_OPTIONS :newrelic-scala3-api:publish :newrelic-scala-api:publish :newrelic-scala-cats-api:publish :newrelic-cats-effect3-api:publish :newrelic-scala-zio-api:publish :newrelic-scala-zio2-api:publish -Prelease=true
- name: Publish apis for Security agent
env:
SONATYPE_USERNAME: ${{ secrets.MIGRATION_TEST_SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.MIGRATION_TEST_SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew $GRADLE_OPTIONS :agent-bridge:publish :agent-bridge-datastore:publish :newrelic-weaver:publish :newrelic-weaver-api:publish :newrelic-weaver-scala:publish :newrelic-weaver-scala-api:publish -Prelease=true
- name: Publish New Relic OpenTelemetry API Extension
env:
SONATYPE_USERNAME: ${{ secrets.MIGRATION_TEST_SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.MIGRATION_TEST_SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew $GRADLE_OPTIONS :newrelic-opentelemetry-agent-extension:publish -Prelease=true
18 changes: 18 additions & 0 deletions automation/pull-request/check-implementation-title.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/bash

FILE=$1

if [ -z "$FILE" ]; then
echo "Usage: $0 <path-to-gradle-file>"
exit 1
fi

MODULE_NAME=$(basename "$(dirname "$FILE")")
EXPECTED_TITLE="com.newrelic.instrumentation.$MODULE_NAME"
TITLE_LINE=$(grep "'Implementation-Title':\s*'${EXPECTED_TITLE}'" "$FILE")

#If the line is empty, fail
if [ -z "$TITLE_LINE" ]; then
echo " Error: Expected $EXPECTED_TITLE in 'Implementation-Title' field but did not find it."
exit 1
fi
21 changes: 21 additions & 0 deletions automation/pull-request/check-verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /bin/bash

FILE=$1

if [ -z "$FILE" ]; then
echo "Usage: $0 <path-to-gradle-file>"
exit 1
fi

# Extract verifyInstrumentation block
block=$(awk '/verifyInstrumentation[[:space:]]*\{/,/\}/' "$FILE")

if [ -z "$block" ]; then
echo " Error: verifyInstrumentation block not found."
exit 1
fi

if !(echo "$block" | grep -q 'passesOnly') ; then
echo " Error: passesOnly not found inside verifyInstrumentation block."
exit 1
fi
31 changes: 31 additions & 0 deletions automation/pull-request/lint-build-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#! /bin/bash

CHANGED_FILES=$@
MYPATH=$0
INSTALL_DIR="`dirname ${MYPATH}`"
CHECK_TITLE="IMPLEMENTATION_TITLE_SHOULD_MATCH_MODULE_NAME"
CHECK_VERIFY_INSTRUMENTATION="VERIFY_INSTRUMENTATION_SHOULD_CONTAIN_PASSESONLY"


FAILURES=""
for file in $CHANGED_FILES; do
if [[ $file == *instrumentation/*.gradle ]]; then
echo "Checking build file: $file"
/bin/sh "${INSTALL_DIR}/check-verify.sh" "$file"
if [ $? -ne 0 ]; then
FAILURES="${FAILURES} ${CHECK_VERIFY_INSTRUMENTATION}:${file} \n"
fi
/bin/sh "${INSTALL_DIR}/check-implementation-title.sh" "$file"
if [ $? -ne 0 ]; then
FAILURES="${FAILURES} ${CHECK_TITLE}:${file} \n"
fi
fi
done
echo "~~~~~~~~~~ RESULTS ~~~~~~~~~~"
if [[ -n "$FAILURES" ]]; then
echo "Build file checks failed at the following locations:"
echo -e "$FAILURES"
exit 1
else
echo "All build files passed lint checks."
fi
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ allprojects {
}
}

group = 'com.newrelic.agent.java'
group = 'io.github.kanderson250.agent.java'
version = agentVersion + (project.findProperty("release") == "true" ? "" : "-SNAPSHOT")
version = version + (project.findProperty("release-suffix") != null ? project.findProperty("release-suffix") : "")

Expand Down
6 changes: 6 additions & 0 deletions instrumentation/my-test-package/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

'Implementation-Title': 'com.newrelic.instrumentation.my-bar-test-package'

verifyInstrumentation {
passes "foo"
}
2 changes: 1 addition & 1 deletion newrelic-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

evaluationDependsOn(":newrelic-agent")

group = "com.newrelic.agent.java"
group = "io.github.kanderson250.agent.java"

task dist(type: Zip, dependsOn: [
project(":newrelic-agent").newrelicVersionedAgentJar,
Expand Down
Loading