Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8cf7c8e
make sure versioned assets exist
metal-messiah Jun 17, 2026
ef464c9
fix name
metal-messiah Jun 17, 2026
226d7bc
improve ci for released asset
metal-messiah Jun 17, 2026
58b6769
append branch name for dev for clarity
metal-messiah Jun 17, 2026
2eeb3ce
apply to subversion
metal-messiah Jun 18, 2026
c8d2d12
clean up
metal-messiah Jun 18, 2026
aaad12c
full deployment re-work
metal-messiah Jun 18, 2026
a2ee191
resolve merge conflicts
metal-messiah Jun 18, 2026
7b42502
clean up
metal-messiah Jun 18, 2026
c7883e6
add env for clarity
metal-messiah Jun 18, 2026
d60b060
simplify deploy flow
metal-messiah Jun 19, 2026
c2faf54
ensure it always runs
metal-messiah Jun 19, 2026
20a1438
keep as failures
metal-messiah Jun 19, 2026
2c1967e
only try js-agent not staging-js-agent
metal-messiah Jun 23, 2026
4ee6b99
also use local build to avoid fetch and cache busting requirements
metal-messiah Jun 23, 2026
52e876b
quick-fix
metal-messiah Jun 23, 2026
d95739e
rebase with main
metal-messiah Jun 23, 2026
1243a49
fix deploy order to match company standard
metal-messiah Jun 23, 2026
2c0330e
remove unneeded portion of postamble
metal-messiah Jun 23, 2026
bc4d04d
remove usage of staging-js cdn for caching reasons
metal-messiah Jun 23, 2026
0b96989
consolidate and ensure consistency
metal-messiah Jun 24, 2026
6a60042
consolidate and ensure consistency
metal-messiah Jun 24, 2026
e9bf51f
fix inconsistencies
metal-messiah Jun 24, 2026
71e3582
undo last changes for simpler
metal-messiah Jun 24, 2026
dd75b82
ensure nrdb publish uses same build as NR1 deploy
metal-messiah Jun 24, 2026
c378a2a
ensure that publish nrdb can succeed with local build
metal-messiah Jun 25, 2026
1962104
address fuzzy staging upload issues
metal-messiah Jun 29, 2026
953e441
address var mismatches
metal-messiah Jun 29, 2026
385697e
simplify
metal-messiah Jun 29, 2026
8cae22e
simplify
metal-messiah Jun 29, 2026
3839354
simplify
metal-messiah Jun 29, 2026
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
11 changes: 0 additions & 11 deletions .github/actions/internal-promotion/templates/postamble.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
// Reset config values back to released
window.NREUM.loader_config.agentID = '{{{args.appId}}}'
window.NREUM.loader_config.applicationID = '{{{args.appId}}}'
window.NREUM.loader_config.licenseKey = '{{{args.licenseKey}}}'
window.NREUM.info.applicationID = '{{{args.appId}}}'
window.NREUM.info.licenseKey = '{{{args.licenseKey}}}'
window.NREUM.init.proxy = {}
window.NREUM.init.session_replay.enabled = true
window.NREUM.init.session_trace.enabled = true
window.NREUM.init.user_actions = { elementAttributes: ['id', 'className', 'tagName', 'type', 'ariaLabel', 'alt', 'title'] }

// Session replay entitlements check
try {
var xhr = new XMLHttpRequest()
Expand Down
22 changes: 0 additions & 22 deletions .github/actions/nr-upload-dev/action.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/actions/nr-upload-dev/args.js

This file was deleted.

44 changes: 0 additions & 44 deletions .github/actions/nr-upload-dev/index.js

This file was deleted.

3 changes: 0 additions & 3 deletions .github/actions/nr-upload/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export const args = yargs(hideBin(process.argv))
.string('loader-version')
.describe('loader-version', 'Browser Agent version number')

.string('local-dir')
.describe('local-dir', 'Local directory to read loader files from instead of fetching from CDN')

.demandOption(['environment', 'loader-version'])
.check((argv) => {
if (argv.environment.includes('stage') && !argv.stageApiKey) {
Expand Down
64 changes: 19 additions & 45 deletions .github/actions/nr-upload/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { v4 as uuidv4 } from 'uuid'
import { readFile } from 'fs/promises'
import { join } from 'path'
import { args } from './args.js'
import { fetchRetry } from '../shared-utils/fetch-retry.js'
import { constructLoaderFileNames, constructFuzzyVersions } from '../shared-utils/loaders.js'
import {
expandLoaderFileNames,
constructLoaderFileNames
} from '../shared-utils/loaders.js'

const loaderFileNames = constructLoaderFileNames(args.loaderVersion)
const fuzzyVersions = constructFuzzyVersions(args.loaderVersion)
const loaderVersion = args.loaderVersion
const loaderFileNames = constructLoaderFileNames(loaderVersion)
const envOptions = {
stage: {
url: 'https://staging-api.newrelic.com/v2/js_agent_loaders/create.json',
Expand All @@ -24,58 +25,31 @@ const envOptions = {
}
}

// Read loader contents from local directory or fetch from CDN
const loaderFileContents = (await Promise.all(
loaderFileNames.map(async loaderFileName => {
let fileContents

if (args.localDir) {
// Read from local build directory
const filePath = join(args.localDir, loaderFileName)
console.log(`Reading ${loaderFileName} from ${filePath}`)
try {
fileContents = await readFile(filePath, 'utf-8')
} catch (error) {
throw new Error(`Failed to read local file ${filePath}: ${error.message}`)
}
} else {
// Fetch from CDN
const fileContentsRequest = await fetchRetry(`https://js-agent.newrelic.com/${loaderFileName}?_nocache=${uuidv4()}`, { retry: 3 })

if (!fileContentsRequest.ok) {
throw new Error(`Download for loader ${loaderFileName} failed.`)
}
const fileContentsRequest = await fetchRetry(`https://js-agent.newrelic.com/${loaderFileName}?_nocache=${uuidv4()}`, { retry: 3 })

fileContents = await fileContentsRequest.text()
if (!fileContentsRequest.ok) {
throw new Error(`Download for loader ${loaderFileName} failed.`)
}

return [loaderFileName, fileContents]
return [loaderFileName, await fileContentsRequest.text()]
})
)).reduce((aggregator, [loaderFileName, fileContents]) => {
aggregator[loaderFileName] = fileContents
return aggregator
}, {})

const uploadJobs = args.environment.map(env => {
return Object.entries(loaderFileContents).map(([loaderFileName, loaderFileContent]) => {
return [
{
env,
loaderFileName,
loaderFileContent
},
{
env,
loaderFileName: loaderFileName.replace(args.loaderVersion, fuzzyVersions.PATCH),
loaderFileContent
},
{
env,
loaderFileName: loaderFileName.replace(args.loaderVersion, fuzzyVersions.MINOR),
loaderFileContent
}
]
}).flat()
return Object.entries(loaderFileContents).flatMap(([loaderFileName, loaderFileContent]) => {
const uploadLoaderFileNames = expandLoaderFileNames([loaderFileName], loaderVersion)

return uploadLoaderFileNames.map(uploadLoaderFileName => ({
env,
loaderFileName: uploadLoaderFileName,
loaderFileContent
}))
})
}).flat()

let jobs = 0, success = true
Expand Down
1 change: 0 additions & 1 deletion .github/actions/nr-verify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ inputs:
loader_version:
description: "Browser Agent version number"
required: true

runs:
using: "composite"
steps:
Expand Down
37 changes: 14 additions & 23 deletions .github/actions/nr-verify/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { args } from './args.js'
import { fetchRetry } from '../shared-utils/fetch-retry.js'
import { constructLoaderFileNames, constructFuzzyVersions } from '../shared-utils/loaders.js'
import {
expandLoaderFileNames,
constructLoaderFileNames
} from '../shared-utils/loaders.js'

const loaderFileNames = constructLoaderFileNames(args.loaderVersion)
const fuzzyVersions = constructFuzzyVersions(args.loaderVersion)
const loaderVersion = args.loaderVersion
const verifyFileNames = expandLoaderFileNames(constructLoaderFileNames(loaderVersion), loaderVersion)
const envOptions = {
stage: {
url: 'https://staging-api.newrelic.com/v2/js_agent_loaders/version.json'
Expand All @@ -13,24 +16,12 @@ const envOptions = {
}
}

const verifyJobs = args.environment.map(env => {
return loaderFileNames.map(loaderFileName => {
return [
{
env,
loaderFileName
},
{
env,
loaderFileName: loaderFileName.replace(args.loaderVersion, fuzzyVersions.PATCH)
},
{
env,
loaderFileName: loaderFileName.replace(args.loaderVersion, fuzzyVersions.MINOR)
}
]
}).flat()
}).flat()
const verifyJobs = args.environment.flatMap(env => {
return verifyFileNames.map(loaderFileName => ({
env,
loaderFileName
}))
})

const results = await Promise.allSettled(
verifyJobs.map(async jobDetails => {
Expand All @@ -51,7 +42,7 @@ const results = await Promise.allSettled(
console.log(`Verified existence of ${jobDetails.loaderFileName} in ${jobDetails.env} NR environment.`)
return true
}
} catch(err){
} catch (err) {
console.log(`FAILURE: ${jobDetails.loaderFileName}\n\n`)
throw new Error(err)
}
Expand All @@ -62,7 +53,7 @@ if (
results.find(result => result.status === 'rejected') ||
results.find(result => result.value === false)
) {
throw new Error(`Not all loaders could be verified in NR.`)
throw new Error('Not all loaders could be verified in NR.')
} else {
console.log(`Verified ${results.length} loaders in NR`)
process.exit(0)
Expand Down
21 changes: 21 additions & 0 deletions .github/actions/shared-utils/loaders.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
export const loaderTypes = ['rum', 'full', 'spa']

export function constructLoaderFileNames (loaderVersion) {
if (!loaderVersion) {
return loaderTypes.map(type => [
`nr-loader-${type}.min.js`,
`nr-loader-${type}.js`,
]).flat()
}

return loaderTypes.map(type => [
`nr-loader-${type}-${loaderVersion}.min.js`,
`nr-loader-${type}-${loaderVersion}.js`,
Expand All @@ -15,3 +22,17 @@ export function constructFuzzyVersions (loaderVersion) {
PATCH: `${pieces[0]}.${pieces[1]}.x`
}
}

export function expandLoaderFileNames (loaderFileNames, loaderVersion) {
if (!loaderVersion) {
return loaderFileNames
}

const fuzzyVersions = constructFuzzyVersions(loaderVersion)

return loaderFileNames.flatMap(loaderFileName => [
loaderFileName,
loaderFileName.replace(loaderVersion, fuzzyVersions.PATCH),
loaderFileName.replace(loaderVersion, fuzzyVersions.MINOR)
])
}
Loading
Loading