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
2 changes: 2 additions & 0 deletions src/commands/app/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const LogForwarding = require('../../lib/log-forwarding')
const { sendAppAssetsDeployedAuditLog, sendAppDeployAuditLog } = require('../../lib/audit-logger')
const { setRuntimeApiHostAndAuthHandler, getAccessToken } = require('../../lib/auth-helper')
const logActions = require('../../lib/log-actions')
const aioConfigLoader = require('@adobe/aio-lib-core-config')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@purplecabbage are you ok with this var name?


const PRE_DEPLOY_EVENT_REG = 'pre-deploy-event-reg'
const POST_DEPLOY_EVENT_REG = 'post-deploy-event-reg'
Expand Down Expand Up @@ -230,6 +231,7 @@ class Deploy extends BuildCommand {
// output should be "Error : <plugin-name> : <error-message>\n" for each failure
this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
}
aioConfigLoader.reload()
deployedRuntimeEntities = await rtLib.deployActions(config, { filterEntities, useForce: flags['force-deploy'] }, onProgress)
}

Expand Down
19 changes: 19 additions & 0 deletions test/commands/app/deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ beforeEach(() => {
helpers.buildExcShellViewExtensionMetadata.mockReset()
helpers.createWebExportFilter.mockReset()
helpers.rewriteActionUrlInEntities.mockReset()
mockConfig.reload.mockReset()
mockLogForwarding.isLocalConfigChanged.mockReset()
mockLogForwarding.getLocalConfigWithSecrets.mockReset()
mockLogForwarding.updateServerConfig.mockReset()
Expand Down Expand Up @@ -868,6 +869,24 @@ describe('run', () => {
expect(command.error).toHaveBeenCalledTimes(0)
})

test('deploy reloads config before deploying actions', async () => {
command.getAppExtConfigs.mockResolvedValueOnce(createAppConfig(command.appConfig))
const noScriptFound = undefined
helpers.runInProcess
.mockResolvedValueOnce(noScriptFound) // pre-app-deploy
.mockResolvedValueOnce(noScriptFound) // deploy-actions
.mockResolvedValueOnce(noScriptFound) // post-app-deploy

command.argv = ['--no-web-assets']
await command.run()

expect(mockConfig.reload).toHaveBeenCalledTimes(1)
expect(mockRuntimeLib.deployActions).toHaveBeenCalledTimes(1)
expect(mockConfig.reload.mock.invocationCallOrder[0]).toBeLessThan(
mockRuntimeLib.deployActions.mock.invocationCallOrder[0]
)
})

test('deploy (has deploy-actions and deploy-static hooks)', async () => {
command.getAppExtConfigs.mockResolvedValueOnce(createAppConfig(command.appConfig))
const noScriptFound = undefined
Expand Down
Loading