Skip to content

Commit f59f5d3

Browse files
committed
feat(pipeline:update): support changing the environment id. fixes #572
1 parent 6ca5077 commit f59f5d3

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "Adobe Inc.",
66
"bugs": "https://github.com/adobe/aio-cli-plugin-cloudmanager/issues",
77
"dependencies": {
8-
"@adobe/aio-lib-cloudmanager": "^1.13.0",
8+
"@adobe/aio-lib-cloudmanager": "^1.14.0",
99
"@adobe/aio-lib-core-config": "^2.0.0",
1010
"@adobe/aio-lib-core-errors": "^3.0.1",
1111
"@adobe/aio-lib-core-logging": "^1.2.0",

src/commands/cloudmanager/pipeline/update.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ UpdatePipelineCommand.flags = {
5757
...commonFlags.programId,
5858
branch: flags.string({ description: 'the new branch' }),
5959
tag: flags.string({ description: 'the new tag' }),
60-
repositoryId: flags.string({ description: 'the new repositoryId' }),
60+
repositoryId: flags.string({ description: 'the new repository id' }),
61+
devEnvironmentId: flags.string({ description: 'the new dev environment id' }),
62+
stageEnvironmentId: flags.string({ description: 'the new stage environment id' }),
63+
prodEnvironmentId: flags.string({ description: 'the new prod environment id' }),
6164
}
6265

6366
UpdatePipelineCommand.args = [

test/commands/pipeline/update.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,25 @@ test('update-pipeline - correct tag', async () => {
115115
})
116116
await expect(cli.action.stop.mock.calls[0][0]).toBe('updated pipeline ID 10')
117117
})
118+
119+
test('update-pipeline - environments', async () => {
120+
setCurrentOrgId('good')
121+
122+
expect.assertions(8)
123+
124+
const runResult = UpdatePipelineCommand.run(['--programId', '5', '10', '--devEnvironmentId', '42', '--stageEnvironmentId', '43', '--prodEnvironmentId', '44'])
125+
await expect(runResult instanceof Promise).toBeTruthy()
126+
127+
await runResult
128+
await expect(init.mock.calls.length).toEqual(1)
129+
await expect(init).toHaveBeenCalledWith('good', 'test-client-id', 'fake-token', 'https://cloudmanager.adobe.io')
130+
await expect(mockSdk.updatePipeline.mock.calls.length).toEqual(1)
131+
await expect(mockSdk.updatePipeline.mock.calls[0][0]).toEqual('5')
132+
await expect(mockSdk.updatePipeline.mock.calls[0][1]).toEqual('10')
133+
await expect(mockSdk.updatePipeline.mock.calls[0][2]).toMatchObject({
134+
devEnvironmentId: '42',
135+
stageEnvironmentId: '43',
136+
prodEnvironmentId: '44',
137+
})
138+
await expect(cli.action.stop.mock.calls[0][0]).toBe('updated pipeline ID 10')
139+
})

0 commit comments

Comments
 (0)