Skip to content
Merged
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
11 changes: 6 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ const archiver = require('archiver')
// this is a static list that comes from here: https://developer.adobe.com/runtime/docs/guides/reference/runtimes/
const SupportedRuntimes = ['sequence', 'blackbox', 'nodejs:10', 'nodejs:12', 'nodejs:14', 'nodejs:16', 'nodejs:18', 'nodejs:20', 'nodejs:22']

// must cover 'deploy-service[-region][.env].app-builder[.int|.corp].adp.adobe.io/runtime
const SUPPORTED_ADOBE_ANNOTATION_ENDPOINT_REGEXES = [
/http(s)?:\/\/localhost/,
/http(s)?:\/\/127\.0\.0\.1/,
/https:\/\/adobeioruntime\.net/,
/https:\/\/deploy-service.*\.app-builder\.corp\.adp\.adobe\.io\/runtime/,
/https:\/\/deploy-service.*\.app-builder\.adp\.adobe\.io\/runtime/
/https:\/\/deploy-service.*\.app-builder.*\.adp\.adobe\.io\/runtime/
]
const NON_CUSTOM_ADOBE_APIHOSTS_REGEXES = [
/adobeioruntime\.net/,
/deploy-service.*\.app-builder\.corp\.adp\.adobe\.io\/runtime/,
/deploy-service.*\.app-builder\.adp\.adobe\.io\/runtime/
/deploy-service.*\.app-builder.*\.adp\.adobe\.io\/runtime/
]

const DEFAULT_PACKAGE_RESERVED_NAME = 'default'
Expand Down Expand Up @@ -1917,8 +1916,10 @@ function getActionUrls (appConfig, /* istanbul ignore next */ isRemoteDev = fals
} else {
// if (!actionIsBehindCdn && !apihostIsCustom)
// https://<ns>.adobeioruntime.net/api/v1/web/<package>/<action>
// note: if the apihost matches /deploy-service.*\.app-builder\.*\.adp\.adobe\.io\/runtime/
// we still want to serve dataplane requests on adobeioruntime.net
return urlJoin(
'https://' + config.ow.namespace + '.' + cleanApihost,
'https://' + config.ow.namespace + '.' + 'adobeioruntime.net',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit pick, adobeioruntime.net can be moved as a constant in the same file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry missed it, keeping a note, thanks Sandeep

'api',
config.ow.apiversion,
webUri,
Expand Down
90 changes: 90 additions & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,96 @@ describe('getActionUrls', () => {
expect(result).toEqual(expected)
})

test('some non web actions, with ui, deploy-service prod environment apihost, no custom hostname', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action',
'sample-app-1.0.0/action-sequence': 'https://fake_ns.adobeioruntime.net/api/v1/sample-app-1.0.0/action-sequence',
'sample-app-1.0.0/action-zip': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action-zip',
'pkg2/thataction': 'https://fake_ns.adobeioruntime.net/api/v1/pkg2/thataction',
'pkg2/thatsequence': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thatsequence'
}
config.ow.apihost = 'deploy-service.app-builder.adp.adobe.io/runtime'
config.manifest.full.packages.__APP_PACKAGE__.sequences['action-sequence'].web = 'no'
config.manifest.full.packages.pkg2.actions.thataction.web = 'no'
const result = utils.getActionUrls(config, false, false)
expect(result).toEqual(expected)
})

test('some non web actions, with ui, deploy-service-region prod environment apihost, no custom hostname', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action',
'sample-app-1.0.0/action-sequence': 'https://fake_ns.adobeioruntime.net/api/v1/sample-app-1.0.0/action-sequence',
'sample-app-1.0.0/action-zip': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action-zip',
'pkg2/thataction': 'https://fake_ns.adobeioruntime.net/api/v1/pkg2/thataction',
'pkg2/thatsequence': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thatsequence'
}
config.ow.apihost = 'deploy-service-va6.app-builder.adp.adobe.io/runtime'
config.manifest.full.packages.__APP_PACKAGE__.sequences['action-sequence'].web = 'no'
config.manifest.full.packages.pkg2.actions.thataction.web = 'no'
const result = utils.getActionUrls(config, false, false)
expect(result).toEqual(expected)
})

test('some non web actions, with ui, deploy-service-region prod int environment apihost, no custom hostname', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action',
'sample-app-1.0.0/action-sequence': 'https://fake_ns.adobeioruntime.net/api/v1/sample-app-1.0.0/action-sequence',
'sample-app-1.0.0/action-zip': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action-zip',
'pkg2/thataction': 'https://fake_ns.adobeioruntime.net/api/v1/pkg2/thataction',
'pkg2/thatsequence': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thatsequence'
}
config.ow.apihost = 'deploy-service-va6.app-builder.int.adp.adobe.io/runtime'
config.manifest.full.packages.__APP_PACKAGE__.sequences['action-sequence'].web = 'no'
config.manifest.full.packages.pkg2.actions.thataction.web = 'no'
const result = utils.getActionUrls(config, false, false)
expect(result).toEqual(expected)
})

test('some non web actions, with ui, deploy-service-region stg corp environment apihost, no custom hostname', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action',
'sample-app-1.0.0/action-sequence': 'https://fake_ns.adobeioruntime.net/api/v1/sample-app-1.0.0/action-sequence',
'sample-app-1.0.0/action-zip': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action-zip',
'pkg2/thataction': 'https://fake_ns.adobeioruntime.net/api/v1/pkg2/thataction',
'pkg2/thatsequence': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thatsequence'
}
config.ow.apihost = 'deploy-service-va6.stg.app-builder.corp.adp.adobe.io/runtime'
config.manifest.full.packages.__APP_PACKAGE__.sequences['action-sequence'].web = 'no'
config.manifest.full.packages.pkg2.actions.thataction.web = 'no'
const result = utils.getActionUrls(config, false, false)
expect(result).toEqual(expected)
})

test('some non web actions, with ui, deploy-service-region stg int environment apihost, no custom hostname', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action',
'sample-app-1.0.0/action-sequence': 'https://fake_ns.adobeioruntime.net/api/v1/sample-app-1.0.0/action-sequence',
'sample-app-1.0.0/action-zip': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action-zip',
'pkg2/thataction': 'https://fake_ns.adobeioruntime.net/api/v1/pkg2/thataction',
'pkg2/thatsequence': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thatsequence'
}
config.ow.apihost = 'deploy-service-va6.stg.app-builder.int.adp.adobe.io/runtime'
config.manifest.full.packages.__APP_PACKAGE__.sequences['action-sequence'].web = 'no'
config.manifest.full.packages.pkg2.actions.thataction.web = 'no'
const result = utils.getActionUrls(config, false, false)
expect(result).toEqual(expected)
})

test('some non web actions, with ui, deploy-service-region dev int environment apihost, no custom hostname', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action',
'sample-app-1.0.0/action-sequence': 'https://fake_ns.adobeioruntime.net/api/v1/sample-app-1.0.0/action-sequence',
'sample-app-1.0.0/action-zip': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action-zip',
'pkg2/thataction': 'https://fake_ns.adobeioruntime.net/api/v1/pkg2/thataction',
'pkg2/thatsequence': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thatsequence'
}
config.ow.apihost = 'deploy-service-va6.dev.app-builder.int.adp.adobe.io/runtime'
config.manifest.full.packages.__APP_PACKAGE__.sequences['action-sequence'].web = 'no'
config.manifest.full.packages.pkg2.actions.thataction.web = 'no'
const result = utils.getActionUrls(config, false, false)
expect(result).toEqual(expected)
})

test('some non web actions, with ui, remote dev, no custom apihost, no custom hostname', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.adobeioruntime.net/api/v1/web/sample-app-1.0.0/action',
Expand Down
Loading