Skip to content

Commit 7acd6ec

Browse files
Initial commit
0 parents  commit 7acd6ec

20 files changed

+1212
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Describe a scenario in which this project behaves unexpectedly
4+
title: ''
5+
labels: bug, needs-triage
6+
assignees: ''
7+
8+
---
9+
10+
[NOTE]: # ( ^^ Provide a general summary of the issue in the title above. ^^ )
11+
12+
## Description
13+
14+
[NOTE]: # ( Describe the problem you're encountering. )
15+
[TIP]: # ( Do NOT give us access or passwords to your New Relic account or API keys! )
16+
17+
## Steps to Reproduce
18+
19+
[NOTE]: # ( Please be as specific as possible. )
20+
21+
## Expected Behavior
22+
23+
[NOTE]: # ( Tell us what you expected to happen. )
24+
25+
## Relevant Logs / Console output
26+
27+
[NOTE]: # ( Please provide specifics of the local error logs, Browser Dev Tools console, etc. if appropriate and possible. )
28+
29+
## Your Environment
30+
31+
[TIP]: # ( Include as many relevant details about your environment as possible. )
32+
33+
* ex: Browser name and version:
34+
* ex: Operating System and version:
35+
36+
## Additional context
37+
38+
[TIP]: # ( Add any other context about the problem here. )
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Enhancement request
3+
about: Suggest an idea for a future version of this project
4+
title: ''
5+
labels: enhancement, needs-triage
6+
assignees: ''
7+
8+
---
9+
10+
[NOTE]: # ( ^^ Provide a general summary of the request in the title above. ^^ )
11+
12+
## Summary
13+
14+
[NOTE]: # ( Provide a brief overview of what the new feature is all about. )
15+
16+
## Desired Behavior
17+
18+
[NOTE]: # ( Tell us how the new feature should work. Be specific. )
19+
[TIP]: # ( Do NOT give us access or passwords to your New Relic account or API keys! )
20+
21+
## Possible Solution
22+
23+
[NOTE]: # ( Not required. Suggest how to implement the addition or change. )
24+
25+
## Additional context
26+
27+
[TIP]: # ( Why does this feature matter to you? What unique circumstances do you have? )

.github/workflows/CHANGELOG.tpl.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
{{.SECTION}}### $title{{.SECTION}}
3+
{{.COMMITS}}- $commit{{.COMMITS}}

.github/workflows/release.yml

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
name: Build and Release (Manual Run) v1.3
2+
3+
on:
4+
workflow_dispatch: # This event allows manual triggering
5+
6+
jobs:
7+
build-and-release:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
17+
- name: Set up JDK 8
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: 8
21+
distribution: 'temurin'
22+
23+
24+
- name: Set Extensions Dir
25+
id: set_ext_dir
26+
run: |
27+
echo "Setting Extensions Dir..."
28+
mkdir ${HOME}/release
29+
mkdir /tmp/to
30+
echo "NEW_RELIC_EXTENSIONS_DIR=${HOME}/release" >> $GITHUB_ENV
31+
32+
- name: Build with Gradle and verifyInstrumentation
33+
run: |
34+
. ./newrelic-dependencies.sh
35+
./gradlew clean build install verifyInstrumentation
36+
37+
- name: Identify Release Type
38+
id: define_release_type
39+
run: |
40+
echo "Generating changelog to check type of release..."
41+
old_tag=$(git describe --abbrev=0 --tags 2>/dev/null) || true
42+
if [[ -n "$old_tag" ]]; then
43+
changelog=$(git log --pretty=format:"- %s (%h)" $old_tag..HEAD)
44+
fi
45+
if echo "$changelog" | grep -iqE '\bBREAKING CHANGE\b'; then
46+
echo "RELEASE_TYPE=major" >> $GITHUB_ENV
47+
elif echo "$changelog" | grep -iqE '\bfeat\b'; then
48+
echo "RELEASE_TYPE=minor" >> $GITHUB_ENV
49+
else
50+
echo "RELEASE_TYPE=patch" >> $GITHUB_ENV
51+
fi
52+
53+
- name: Set release version
54+
id: set_release_version
55+
run: |
56+
major_version=1
57+
minor_version=0
58+
patch_revision=0
59+
60+
# Retrieve the latest release tag
61+
latest_tag=$(git describe --abbrev=0 --tags 2>/dev/null) || true
62+
echo "LATEST_TAG=${latest_tag}" >> $GITHUB_ENV
63+
64+
if [[ -n "$latest_tag" && $latest_tag == v* ]]; then
65+
# Extract the major and minor versions from the latest tag
66+
current_major_version=$(echo $latest_tag | cut -d'.' -f1 | sed 's/v//')
67+
current_minor_version=$(echo $latest_tag | cut -d'.' -f2)
68+
current_patch_revision=$(echo $latest_tag | cut -d'.' -f3)
69+
70+
if [ "${{ env.RELEASE_TYPE }}" = "major" ]; then
71+
major_version=$((current_major_version +1 ))
72+
elif [ "${{ env.RELEASE_TYPE }}" = "minor" ]; then
73+
minor_version=$((current_minor_version + 1))
74+
major_version=$((current_major_version))
75+
else
76+
patch_revision=$((current_patch_revision + 1))
77+
minor_version=$((current_minor_version))
78+
major_version=$((current_major_version))
79+
fi
80+
81+
fi
82+
83+
# Set the release version environment variable
84+
release_version="v${major_version}.${minor_version}.${patch_revision}"
85+
echo "RELEASE_VERSION=${release_version}" >> $GITHUB_ENV
86+
87+
- name: Set Tag
88+
id: set_tag
89+
run: echo "::set-output name=tag::${{ env.RELEASE_VERSION }}"
90+
91+
- name: Set release name
92+
id: set_release_name
93+
run: |
94+
repo_name="${{ github.repository }}"
95+
sanitized_repo_name=$(echo "$repo_name" | awk -F 'newrelic-java-' '{print $2}')
96+
echo "RELEASE_NAME=${sanitized_repo_name}-instrumentation-" >> $GITHUB_ENV
97+
previous_tag=$(git describe --abbrev=0 --tags HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)
98+
99+
- name: Create Archive
100+
run: |
101+
echo "CURRENT=${PWD}" >> $GITHUB_ENV
102+
cd ${HOME}/release
103+
zip -r /tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip *.jar
104+
cd ${{env.CURRENT}}
105+
106+
107+
108+
- name: Create Release
109+
id: create_release
110+
uses: actions/github-script@v6
111+
with:
112+
github-token: ${{ secrets.GITHUB_TOKEN }}
113+
script: |
114+
try {
115+
var changelog = ``;
116+
var tag = '' + `${{ steps.set_tag.outputs.tag }}`;
117+
const archivePath = '/tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip';
118+
var response = await github.rest.repos.createRelease({
119+
draft:false,
120+
generate_release_notes:true,
121+
name:tag,
122+
owner:context.repo.owner,
123+
prerelease:false,
124+
repo:context.repo.repo,
125+
tag_name:tag,
126+
body:changelog
127+
});
128+
129+
core.exportVariable('RELEASE_ID', response.data.id);
130+
core.exportVariable('RELEASE_URL', response.data.html_url);
131+
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
132+
} catch (error) {
133+
core.setFailed(error.message);
134+
}
135+
- name: Upload Release Artifacts
136+
uses: actions/upload-release-asset@v1
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
with:
140+
asset_path: /tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip
141+
asset_name: ${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip
142+
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
143+
asset_content_type: application/zip
144+
145+
- name: "Generate release changelog"
146+
id: github_changelog
147+
uses: Helmisek/conventional-changelog-generator@v1.0.6-release
148+
with:
149+
repo-token: ${{ secrets.GITHUB_TOKEN }}
150+
commit-types: "fix:Bug Fixes,feat:Features,doc:Documentation,build:Build Upgrades,BREAKING CHANGE:Enhancements"
151+
template-path: ".github/workflows/CHANGELOG.tpl.md"
152+
153+
154+
- name: update CHANGELOG.md
155+
run: |
156+
# Content to add at the top
157+
# Get the current date in YYYY-MM-DD format
158+
release_date=$(date +"%Y-%m-%d")
159+
version="## Version: [${{env.RELEASE_VERSION}}](${{ env.RELEASE_URL }}) | Created: $release_date"
160+
content="$version${{steps.github_changelog.outputs.changelog}}"
161+
162+
# Existing file
163+
file="CHANGELOG.md"
164+
165+
# Create a temporary file with the content at the top and existing content below
166+
167+
echo "$content" > temp_file.txt
168+
cat "$file" >> temp_file.txt
169+
170+
# Overwrite the original file with the updated content
171+
mv temp_file.txt "$file"
172+
173+
# Commit the updated CHANGELOG.md file
174+
git add CHANGELOG.md
175+
git config --local user.email "action@github.com"
176+
git config --local user.name "GitHub Action"
177+
git commit -m "Update Changelog for Release [skip ci]"
178+
179+
# Push the changes to the remote repository
180+
git push --quiet --set-upstream origin HEAD
181+
182+
- name: Get Compare URL
183+
run: |
184+
compare=$(echo ${{ env.RELEASE_URL }} | sed 's/releases\/tag.*/compare/')
185+
compareurl=$(echo "\nFull Changelog: ($compare/${{ env.LATEST_TAG }}...${{ steps.set_tag.outputs.tag }})")
186+
echo "COMPAREURL=${compareurl}" >> $GITHUB_ENV
187+
188+
- name: Update Release
189+
id: update_release
190+
uses: actions/github-script@v6
191+
with:
192+
github-token: ${{ secrets.GITHUB_TOKEN }}
193+
script: |
194+
try {
195+
196+
197+
var changelog = `${{steps.github_changelog.outputs.changelog}}` + `${{env.COMPAREURL}}` ;
198+
var release_id = `${{env.RELEASE_ID}}`;
199+
var tag = '' + `${{ steps.set_tag.outputs.tag }}`;
200+
const archivePath = '/tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip';
201+
var _response = await github.rest.repos.updateRelease({
202+
draft:false,
203+
generate_release_notes:true,
204+
owner:context.repo.owner,
205+
repo: context.repo.repo,
206+
prerelease:false,
207+
release_id:release_id,
208+
body:changelog
209+
});
210+
211+
core.exportVariable('RELEASE_ID', _response.data.id);
212+
core.exportVariable('RELEASE_URL', _response.data.html_url);
213+
core.exportVariable('RELEASE_UPLOAD_URL', _response.data.upload_url);
214+
} catch (error) {
215+
core.setFailed(error.message);
216+
}

.github/workflows/repolinter.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# NOTE: This file should always be named `repolinter.yml` to allow
2+
# workflow_dispatch to work properly
3+
name: Repolinter Action
4+
5+
# NOTE: This workflow will ONLY check the default branch!
6+
# Currently there is no elegant way to specify the default
7+
# branch in the event filtering, so branches are instead
8+
# filtered in the "Test Default Branch" step.
9+
on: [push, workflow_dispatch]
10+
11+
jobs:
12+
repolint:
13+
name: Run Repolinter
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Test Default Branch
17+
id: default-branch
18+
uses: actions/github-script@v2
19+
with:
20+
script: |
21+
const data = await github.repos.get(context.repo)
22+
return data.data && data.data.default_branch === context.ref.split('/').slice(-1)[0]
23+
- name: Checkout Self
24+
if: ${{ steps.default-branch.outputs.result == 'true' }}
25+
uses: actions/checkout@v2
26+
- name: Run Repolinter
27+
if: ${{ steps.default-branch.outputs.result == 'true' }}
28+
uses: newrelic/repolinter-action@v1
29+
with:
30+
config_url: https://raw.githubusercontent.com/newrelic/.github/main/repolinter-rulesets/new-relic-experimental.yml
31+
output_type: issue

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.java-version
2+
.git
3+
.github

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Installation
2+
3+
To install:
4+
5+
1. Download the latest release jar files.
6+
2. In the New Relic Java directory (the one containing newrelic.jar), create a directory named extensions if it does not already exist.
7+
3. Copy the downloaded jars into the extensions directory.
8+
4. Restart the application.

CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Contributing
2+
3+
Contributions are always welcome. Before contributing please read the
4+
[code of conduct](./CODE_OF_CONDUCT.md) and [search the issue tracker](issues); your issue may have already been discussed or fixed in `main`. To contribute,
5+
[fork](https://help.github.com/articles/fork-a-repo/) this repository, commit your changes, and [send a Pull Request](https://help.github.com/articles/using-pull-requests/).
6+
7+
Note that our [code of conduct](./CODE_OF_CONDUCT.md) applies to all platforms and venues related to this project; please follow it in all your interactions with the project and its participants.
8+
9+
## Feature Requests
10+
11+
Feature requests should be submitted in the [Issue tracker](../../issues), with a description of the expected behavior & use case, where they’ll remain closed until sufficient interest, [e.g. :+1: reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/), has been [shown by the community](../../issues?q=label%3A%22votes+needed%22+sort%3Areactions-%2B1-desc).
12+
Before submitting an Issue, please search for similar ones in the
13+
[closed issues](../../issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement).
14+
15+
## Pull Requests
16+
17+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
18+
2. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
19+
3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
20+
21+
## Contributor License Agreement
22+
23+
Keep in mind that when you submit your Pull Request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at opensource@newrelic.com.
24+
25+
For more information about CLAs, please check out Alex Russell’s excellent post,
26+
[“Why Do I Need to Sign This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
27+
28+
## Slack
29+
30+
We host a public Slack with a dedicated channel for contributors and maintainers of open source projects hosted by New Relic. If you are contributing to this project, you're welcome to request access to the #oss-contributors channel in the newrelicusers.slack.com workspace. To request access, see https://newrelicusers-signup.herokuapp.com/.

0 commit comments

Comments
 (0)