Skip to content

Commit

Permalink
Merge pull request #127 from adobe/imsorgid
Browse files Browse the repository at this point in the history
passing imsOrgId to syncProject
  • Loading branch information
Himavanth authored Aug 11, 2020
2 parents 588321f + a776086 commit 77c47f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const dotenv = require('dotenv')
const deepCopy = require('lodash.clonedeep')
const globby = require('globby')
const RuntimeLib = require('@adobe/aio-lib-runtime')
const aioConfig = require('@adobe/aio-lib-core-config')
const AIO_CONFIG_IMS_ORG_ID = 'project.org.ims_org_id'

async function deployWsk (scriptConfig, manifestContent, logger, filterEntities) {
const packageName = scriptConfig.ow.package
Expand Down Expand Up @@ -84,7 +86,7 @@ async function deployWsk (scriptConfig, manifestContent, logger, filterEntities)
/* END temporary workaround */

// do the deployment, manifestPath and manifestContent needed for creating a project hash
await runtimeLibUtils.syncProject(packageName, manifestPath, manifestContent, entities, ow, logger, deleteOldEntities)
await runtimeLibUtils.syncProject(packageName, manifestPath, manifestContent, entities, ow, logger, aioConfig.get(AIO_CONFIG_IMS_ORG_ID), deleteOldEntities)
return entities
}

Expand Down
18 changes: 9 additions & 9 deletions test/scripts/deploy.actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ test('deploy full manifest', async () => {
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedDistManifest.packages, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), true)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, true)
})

test('deploy full manifest with package name specified', async () => {
Expand All @@ -137,7 +137,7 @@ test('deploy full manifest with package name specified', async () => {
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedNamedPackage, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('bobby-mcgee', r('/manifest.yml'), { packages: expectedNamedPackage }, mockEntities, { fake: 'ow' }, expect.anything(), true)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('bobby-mcgee', r('/manifest.yml'), { packages: expectedNamedPackage }, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, true)
})

test('use deployConfig.filterEntities to deploy only one action', async () => {
Expand Down Expand Up @@ -176,7 +176,7 @@ test('use deployConfig.filterEntities to deploy only one action', async () => {
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedDistPackagesFiltered, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), false)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, false)
})

test('use deployConfig.filterEntities to deploy only one trigger and one action', async () => {
Expand Down Expand Up @@ -219,7 +219,7 @@ test('use deployConfig.filterEntities to deploy only one trigger and one action'
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedDistPackagesFiltered, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), false)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, false)
})

test('use deployConfig.filterEntities to deploy only one trigger and one action and one rule', async () => {
Expand Down Expand Up @@ -270,7 +270,7 @@ test('use deployConfig.filterEntities to deploy only one trigger and one action
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedDistPackagesFiltered, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), false)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, false)
})

test('use deployConfig.filterEntities to deploy only one action and one api', async () => {
Expand Down Expand Up @@ -321,7 +321,7 @@ test('use deployConfig.filterEntities to deploy only one action and one api', as
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedDistPackagesFiltered, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), false)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, false)
})

test('use deployConfig.filterEntities to deploy only two actions and one sequence', async () => {
Expand Down Expand Up @@ -372,7 +372,7 @@ test('use deployConfig.filterEntities to deploy only two actions and one sequenc
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedDistPackagesFiltered, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), false)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, false)
})

test('use deployConfig.filterEntities to deploy only one pkg dependency', async () => {
Expand Down Expand Up @@ -409,7 +409,7 @@ test('use deployConfig.filterEntities to deploy only one pkg dependency', async
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedDistPackagesFiltered, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), false)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-1.0.0', r('/manifest.yml'), expectedDistManifest, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, false)
})

test('use deployConfig.filterEntities on non existing pkgEntity should work', async () => {
Expand Down Expand Up @@ -463,7 +463,7 @@ test('use deployConfig.filterEntities on non existing pkgEntity should work', as
expect(runtimeLibUtils.processPackage).toHaveBeenCalledWith(expectedDistPackagesFiltered, {}, {}, {}, false, expectedOWOptions)

expect(runtimeLibUtils.syncProject).toHaveBeenCalledTimes(1)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-reduced-1.0.0', r('/manifest.yml'), expectedDistReducedManifest, mockEntities, { fake: 'ow' }, expect.anything(), false)
expect(runtimeLibUtils.syncProject).toHaveBeenCalledWith('sample-app-reduced-1.0.0', r('/manifest.yml'), expectedDistReducedManifest, mockEntities, { fake: 'ow' }, expect.anything(), global.fakeConfig.tvm, false)
})

test('Deploy actions should fail if there are no build files and no filters', async () => {
Expand Down

0 comments on commit 77c47f6

Please sign in to comment.