newrelic 7.1.2 → 7.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEWS.md +33 -0
- package/bin/create-github-release.js +109 -0
- package/bin/create-release-tag.js +95 -0
- package/bin/git-commands.js +110 -0
- package/bin/github.js +29 -4
- package/bin/npm-commands.js +31 -0
- package/bin/prepare-release.js +359 -0
- package/bin/run-versioned-tests.sh +1 -9
- package/index.js +4 -2
- package/lib/agent.js +4 -0
- package/lib/collector/api.js +45 -18
- package/lib/collector/remote-method.js +14 -5
- package/lib/config/index.js +21 -4
- package/lib/instrumentation/core/timers.js +6 -1
- package/lib/metrics/names.js +7 -1
- package/lib/transaction/index.js +7 -0
- package/package.json +3 -4
- package/bin/create-release.js +0 -74
- package/bin/generate-release-notes.js +0 -126
- package/bin/travis-install-gcc5.sh +0 -13
- package/bin/travis-install-mongo.sh +0 -16
- package/bin/travis-node.sh +0 -57
- package/bin/travis-setup.sh +0 -52
- package/bin/update-changelog-version.js +0 -68
package/bin/create-release.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {exec} = require('child_process')
|
|
4
|
-
const checkWorkflowRun = require('./check-workflow-run')
|
|
5
|
-
const {program, Option} = require('commander')
|
|
6
|
-
|
|
7
|
-
const ERROR_MSG = '! [ERROR] !\n'
|
|
8
|
-
|
|
9
|
-
// Add command line options
|
|
10
|
-
program.option('-b, --branch <branch>', 'release branch', 'main')
|
|
11
|
-
|
|
12
|
-
program.addOption(new Option('-r, --release-type <releaseType>', 'release type')
|
|
13
|
-
.choices(['patch', 'minor', 'major']))
|
|
14
|
-
|
|
15
|
-
program.option('-m, --major-release', 'create a major release. (release-type option must be set to \'major\')')
|
|
16
|
-
|
|
17
|
-
program.option('-o, --repo-owner <repoOwner>', 'repository owner', 'newrelic')
|
|
18
|
-
|
|
19
|
-
async function createRelease() {
|
|
20
|
-
// Parse commandline options inputs
|
|
21
|
-
program.parse()
|
|
22
|
-
|
|
23
|
-
const options = program.opts()
|
|
24
|
-
|
|
25
|
-
// TODO: rework to use program.requiredOption
|
|
26
|
-
if (!options.releaseType) {
|
|
27
|
-
console.log('FAILURE: release type required.')
|
|
28
|
-
process.exit(1)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (options.releaseType === 'major' && !options.majorRelease) {
|
|
32
|
-
console.log('WARNING: you must set the \'-m\' flag to create a major release.\nExiting...')
|
|
33
|
-
process.exit(1)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (options.majorRelease && options.releaseType !== 'major') {
|
|
37
|
-
console.log(`WARNING: ignoring \'-m, --major-release\' option as release type set to ${options.rel}.`)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const releaseType = options.releaseType
|
|
41
|
-
const branch = options.branch ? options.branch.replace('refs/heads/', '') : null
|
|
42
|
-
const repoOwner = options.repoOwner ? options.repoOwner : null
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const passesWorkflowChecks = await checkWorkflowRun(repoOwner, branch)
|
|
46
|
-
|
|
47
|
-
if (!passesWorkflowChecks) {
|
|
48
|
-
process.exit(1)
|
|
49
|
-
}
|
|
50
|
-
} catch (err) {
|
|
51
|
-
console.log(err)
|
|
52
|
-
|
|
53
|
-
process.exit(1)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
console.log('Starting npm version and pushing tags')
|
|
57
|
-
exec(`npm version ${releaseType} && git push origin ${branch} && git push --tags`, (err, stdout) => {
|
|
58
|
-
if (err) {
|
|
59
|
-
console.log(ERROR_MSG, err)
|
|
60
|
-
|
|
61
|
-
process.exit(1)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (stdout) {
|
|
65
|
-
console.log(stdout)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
console.log('DONE')
|
|
69
|
-
|
|
70
|
-
process.exit(0)
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
createRelease()
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const Github = require('./github')
|
|
5
|
-
|
|
6
|
-
const FILE_NAME = 'NEWS.md'
|
|
7
|
-
const PROPOSED_NOTES_HEADER = 'Proposed Release Notes'
|
|
8
|
-
const NEXT_VERSION_HEADER = '### vNext (TBD):'
|
|
9
|
-
|
|
10
|
-
async function generateReleaseNotes() {
|
|
11
|
-
try {
|
|
12
|
-
const github = new Github()
|
|
13
|
-
const latestRelease = await github.getLatestRelease()
|
|
14
|
-
console.log(`The latest release is: ${latestRelease.name} published: ${latestRelease.published_at}`)
|
|
15
|
-
console.log(`Tag: ${latestRelease.tag_name}, Target: ${latestRelease.target_commitish}`)
|
|
16
|
-
|
|
17
|
-
const tag = await github.getTagByName(latestRelease.tag_name)
|
|
18
|
-
console.log('The tag commit sha is: ', tag.commit.sha)
|
|
19
|
-
|
|
20
|
-
const commit = await github.getCommit(tag.commit.sha)
|
|
21
|
-
const commitDate = commit.commit.committer.date
|
|
22
|
-
|
|
23
|
-
console.log(`Finding merged pull requests since: ${commitDate}`)
|
|
24
|
-
|
|
25
|
-
const mergedPullRequests = await github.getMergedPullRequestsSince(commitDate)
|
|
26
|
-
console.log(`Found ${mergedPullRequests.length}`)
|
|
27
|
-
|
|
28
|
-
const releaseNoteData = mergedPullRequests.map((pr) => {
|
|
29
|
-
const parts = pr.body.split(/(?:^|\n)##\s*/g)
|
|
30
|
-
|
|
31
|
-
// If only has one part, not in appropriate format.
|
|
32
|
-
if (parts.length === 1) {
|
|
33
|
-
return {
|
|
34
|
-
notes: generateUnformattedNotes(pr.body),
|
|
35
|
-
url: pr.html_url
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const {1: proposedReleaseNotes} = parts
|
|
40
|
-
|
|
41
|
-
const titleRemoved = proposedReleaseNotes.replace(PROPOSED_NOTES_HEADER, '')
|
|
42
|
-
return {
|
|
43
|
-
notes: titleRemoved,
|
|
44
|
-
url: pr.html_url
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const finalData = releaseNoteData.reduce((result, currentValue) => {
|
|
49
|
-
result.notes += '\n\n' + currentValue.notes.trim()
|
|
50
|
-
result.links += `\n\n* PR: ${currentValue.url}\n`
|
|
51
|
-
return result
|
|
52
|
-
}, {
|
|
53
|
-
notes: '',
|
|
54
|
-
links: ''
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
console.log('Final data: ', JSON.stringify(finalData))
|
|
58
|
-
|
|
59
|
-
await updateReleaseNotes(FILE_NAME, finalData.notes)
|
|
60
|
-
|
|
61
|
-
console.log('*** [SUCCESS] ***')
|
|
62
|
-
} catch(err) {
|
|
63
|
-
console.log('! [FAILURE] !')
|
|
64
|
-
console.error(err)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function generateUnformattedNotes(originalNotes) {
|
|
69
|
-
let unformattedNotes = originalNotes
|
|
70
|
-
|
|
71
|
-
// Drop extra snyk details and just keep high-level summary.
|
|
72
|
-
if (originalNotes.indexOf('snyk:metadata') >= 0) {
|
|
73
|
-
const snykParts = originalNotes.split('<details>')
|
|
74
|
-
const {0: snykDescription} = snykParts
|
|
75
|
-
|
|
76
|
-
unformattedNotes = snykDescription.trim()
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const needsReviewNotes = [
|
|
80
|
-
'--- NOTES NEEDS REVIEW ---',
|
|
81
|
-
unformattedNotes,
|
|
82
|
-
'--------------------------'
|
|
83
|
-
].join('\n')
|
|
84
|
-
|
|
85
|
-
return needsReviewNotes
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function updateReleaseNotes(file, newNotes) {
|
|
89
|
-
const promise = new Promise((resolve, reject) => {
|
|
90
|
-
fs.readFile(file, 'utf8', function (err, data) {
|
|
91
|
-
if (err) {
|
|
92
|
-
return reject(err)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (data.startsWith(NEXT_VERSION_HEADER)) {
|
|
96
|
-
const errMessage = [
|
|
97
|
-
`${file} already contains '${NEXT_VERSION_HEADER}'`,
|
|
98
|
-
'Delete existing vNext release notes (if desired) and run again'
|
|
99
|
-
].join('\n')
|
|
100
|
-
|
|
101
|
-
return reject(new Error(errMessage))
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const newContent = [
|
|
105
|
-
NEXT_VERSION_HEADER,
|
|
106
|
-
newNotes,
|
|
107
|
-
'\n\n',
|
|
108
|
-
data
|
|
109
|
-
].join('')
|
|
110
|
-
|
|
111
|
-
fs.writeFile(file, newContent, 'utf8', function (err) {
|
|
112
|
-
if (err) {
|
|
113
|
-
return reject(err)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
console.log(`Added new release notes to ${file} under the ${NEXT_VERSION_HEADER}`)
|
|
117
|
-
|
|
118
|
-
resolve()
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
return promise
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
generateReleaseNotes()
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#! /bin/bash
|
|
2
|
-
|
|
3
|
-
# Copyright 2020 New Relic Corporation. All rights reserved.
|
|
4
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
|
|
6
|
-
set -x # echo commands as executed
|
|
7
|
-
|
|
8
|
-
sudo apt-get install -qq gcc-5 g++-5
|
|
9
|
-
sudo update-alternatives \
|
|
10
|
-
--install /usr/bin/gcc gcc /usr/bin/gcc-5 60 \
|
|
11
|
-
--slave /usr/bin/g++ g++ /usr/bin/g++-5
|
|
12
|
-
sudo update-alternatives --auto gcc
|
|
13
|
-
export CXX="g++-5" CC="gcc-5"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Copyright 2020 New Relic Corporation. All rights reserved.
|
|
4
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
|
|
6
|
-
set -xev # -x echo commands as executed
|
|
7
|
-
# -e exit as soon as something goes wrong
|
|
8
|
-
# -v when considering whether to say something or not say something
|
|
9
|
-
# take the appraoch that provide as much information as possible
|
|
10
|
-
# which human beings something describe as being verbose
|
|
11
|
-
|
|
12
|
-
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz -O /tmp/mongodb.tgz
|
|
13
|
-
mkdir -p /tmp/mongodb/data
|
|
14
|
-
tar -xf /tmp/mongodb.tgz -C /tmp/mongodb
|
|
15
|
-
/tmp/mongodb/mongodb-linux-x86_64-${MONGODB}/bin/mongod --version
|
|
16
|
-
/tmp/mongodb/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath /tmp/mongodb/data --bind_ip 127.0.0.1 --noauth &> /dev/null &
|
package/bin/travis-node.sh
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Copyright 2020 New Relic Corporation. All rights reserved.
|
|
4
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
|
|
6
|
-
# https://stackoverflow.com/questions/16989598/bash-comparing-version-numbers/24067243
|
|
7
|
-
# tests version strings using `sort`'s -V option
|
|
8
|
-
function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
|
|
9
|
-
|
|
10
|
-
sudo apt-get update
|
|
11
|
-
|
|
12
|
-
# so dumb that we need python-software-properties
|
|
13
|
-
# to get add-apt-repository
|
|
14
|
-
sudo apt-get -y install build-essential libssl-dev curl python-software-properties time sudo
|
|
15
|
-
|
|
16
|
-
# update gcc to something that will install pg-native module
|
|
17
|
-
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
18
|
-
sudo apt-get -y update
|
|
19
|
-
sudo apt-get -y install gcc-4.9 g++-4.9
|
|
20
|
-
sudo rm /usr/bin/g++
|
|
21
|
-
sudo rm /usr/bin/gcc
|
|
22
|
-
sudo ln -s /usr/bin/g++-4.9 /usr/bin/g++
|
|
23
|
-
sudo ln -s /usr/bin/gcc-4.9 /usr/bin/gcc
|
|
24
|
-
|
|
25
|
-
# Where is ppa:ubuntu-toolchain-r/test?
|
|
26
|
-
# sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
27
|
-
# sudo apt-get -y update
|
|
28
|
-
# sudo apt-get -y install libstdc++6-4.7-dev
|
|
29
|
-
|
|
30
|
-
# only do for NODE 12 AND for old glibc
|
|
31
|
-
|
|
32
|
-
GLIBC_VERSION_CHECK=`ldd --version | head -n 1 | awk '{print $NF}'`
|
|
33
|
-
|
|
34
|
-
if [ -z $NR_NODE_VERSION ]; then
|
|
35
|
-
echo "please define NR_NODE_VERSION in local env"
|
|
36
|
-
exit 1
|
|
37
|
-
fi
|
|
38
|
-
|
|
39
|
-
version=$NR_NODE_VERSION
|
|
40
|
-
major=${version/.*}
|
|
41
|
-
echo $major
|
|
42
|
-
if [ $major -gt 11 ] && version_gt 2.17 $GLIBC_VERSION_CHECK;then
|
|
43
|
-
echo "Installing updated glibc\n"
|
|
44
|
-
# can we get this from an actual repository?
|
|
45
|
-
curl -LO 'http://launchpadlibrarian.net/130794928/libc6_2.17-0ubuntu4_amd64.deb'
|
|
46
|
-
sudo dpkg -i libc6_2.17-0ubuntu4_amd64.deb
|
|
47
|
-
else
|
|
48
|
-
echo "Skipping glibc update\n"
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
# install nvm
|
|
52
|
-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
|
|
53
|
-
export NVM_DIR="$HOME/.nvm"
|
|
54
|
-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
55
|
-
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
|
56
|
-
|
|
57
|
-
nvm install $NR_NODE_VERSION
|
package/bin/travis-setup.sh
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#! /bin/bash
|
|
2
|
-
|
|
3
|
-
# Copyright 2020 New Relic Corporation. All rights reserved.
|
|
4
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
|
|
6
|
-
function get_version {
|
|
7
|
-
local num='[[:digit:]][[:digit:]]*' # Grep doesn't have `+` operator.
|
|
8
|
-
local version=`$1 --version 2>/dev/null | grep -o "$num\.$num\.$num" | head -1`
|
|
9
|
-
echo $version | grep -o "$num" | head -1
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
TOOLCHAIN_ADDED="false"
|
|
13
|
-
function add_toolchain {
|
|
14
|
-
if [ "$TOOLCHAIN_ADDED" == "false" ]; then
|
|
15
|
-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
|
16
|
-
sudo apt-get update -qq
|
|
17
|
-
fi
|
|
18
|
-
TOOLCHAIN_ADDED="true"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
# npm 5 introduced 'ci' and 6 introduce 'audit', so just default to latest
|
|
22
|
-
if (("$(get_version npm)" < "6" )); then
|
|
23
|
-
echo " --- upgrading npm to 6 --- "
|
|
24
|
-
npm install -g npm@6
|
|
25
|
-
else
|
|
26
|
-
echo " --- not upgrading npm ($(npm --version)) --- "
|
|
27
|
-
fi
|
|
28
|
-
|
|
29
|
-
if [ "$SUITE" = "versioned" ]; then
|
|
30
|
-
echo " --- installing cassandra --- "
|
|
31
|
-
./bin/cassandra-setup.sh
|
|
32
|
-
|
|
33
|
-
# GCC 5 is the lowest version of GCC we can use.
|
|
34
|
-
if [ "$(get_version gcc)" == "4" ]; then
|
|
35
|
-
echo " --- upgrading GCC --- "
|
|
36
|
-
add_toolchain
|
|
37
|
-
./bin/travis-install-gcc5.sh > /dev/null
|
|
38
|
-
else
|
|
39
|
-
echo " --- not upgrading GCC ($(gcc --version)) --- "
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
echo " --- installing $SUITE requirements --- "
|
|
43
|
-
|
|
44
|
-
# MongoDB is always installed in integrations and versioned.
|
|
45
|
-
echo " --- installing mongodb --- "
|
|
46
|
-
add_toolchain
|
|
47
|
-
./bin/travis-install-mongo.sh
|
|
48
|
-
|
|
49
|
-
echo " --- done installing $SUITE requirements --- "
|
|
50
|
-
else
|
|
51
|
-
echo " --- no $SUITE installation requirements --- "
|
|
52
|
-
fi
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Executed as a part of the "version" step of npm version.
|
|
5
|
-
* Updates the placeholder release note header with the incremented version
|
|
6
|
-
* from running npm version
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const fs = require('fs')
|
|
10
|
-
const packageInfo = require('../package.json')
|
|
11
|
-
|
|
12
|
-
const FILE_NAME = 'NEWS.md'
|
|
13
|
-
const NEXT_VERSION_HEADER = '### vNext (TBD):'
|
|
14
|
-
|
|
15
|
-
const SUCCESS_MSG = '*** [SUCCESS] ***'
|
|
16
|
-
const FAIL_MSG = '! [FAILURE] !'
|
|
17
|
-
|
|
18
|
-
updateChangelogVersion()
|
|
19
|
-
|
|
20
|
-
async function updateChangelogVersion() {
|
|
21
|
-
try {
|
|
22
|
-
await updateHeader(FILE_NAME)
|
|
23
|
-
|
|
24
|
-
console.log(SUCCESS_MSG)
|
|
25
|
-
} catch (err) {
|
|
26
|
-
console.log(FAIL_MSG)
|
|
27
|
-
console.error(err)
|
|
28
|
-
|
|
29
|
-
process.exit(1)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function updateHeader(file) {
|
|
34
|
-
const promise = new Promise((resolve, reject) => {
|
|
35
|
-
fs.readFile(file, 'utf8', (err, data) => {
|
|
36
|
-
if (err) {
|
|
37
|
-
return reject(err)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// toISOString() will always return UTC time
|
|
41
|
-
const todayFormatted = new Date().toISOString().split('T')[0]
|
|
42
|
-
const version = `v${packageInfo.version}`
|
|
43
|
-
const newChangelogHeader = `### ${version} (${todayFormatted})`
|
|
44
|
-
|
|
45
|
-
console.log('Updating vNext header to: ', newChangelogHeader)
|
|
46
|
-
|
|
47
|
-
if (!data.startsWith(NEXT_VERSION_HEADER)) {
|
|
48
|
-
const err = new Error(`Failed to find next version header in form: '${NEXT_VERSION_HEADER}'`)
|
|
49
|
-
return reject(err)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const modified = data.replace(
|
|
53
|
-
NEXT_VERSION_HEADER,
|
|
54
|
-
newChangelogHeader
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
fs.writeFile(file, modified, 'utf8', (err) => {
|
|
58
|
-
if (err) {
|
|
59
|
-
return reject (err)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
console.log(SUCCESS_MSG)
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
return promise
|
|
68
|
-
}
|