Skip to content

Commit

Permalink
chore: add beta warning for integration requiring manual step
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlaud committed Dec 19, 2024
1 parent fb20b36 commit dbe8d97
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/commands/workflows/connections/integrate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ux} from '@oclif/core'
import {commonApiRelatedArgs} from '../../../common/args.js'
import {input} from '@inquirer/prompts'
import {confirm, input} from '@inquirer/prompts'
import {BaseCommand} from '../../../base-command.js'
import {nonSourceIntegrations} from '../../../command-helpers/connections/type-params-mapping.js'
import {createIntegrationForConnection} from '../../../api/integrations.js'
Expand Down Expand Up @@ -44,6 +44,10 @@ export default class Workflows extends BaseCommand<typeof Workflows> {
},
ValidationType.UUID,
)
} else {
await confirm({
message: `During Universal Broker Early Access, the ${selectedConnection.type}-typed integration must first be manually Brokered via the UI. Have you manually brokered the connection?`,
})
}
const connectionIntegration = await createIntegrationForConnection(
tenantId,
Expand All @@ -58,7 +62,7 @@ export default class Workflows extends BaseCommand<typeof Workflows> {
this.log(
ux.colorize(
'cyan',
`Connection ${connectionIntegration.data.id} (type: ${selectedConnection.type}) integrated with integration ${integrationId} on Org ${orgId}.`,
`Connection ${connectionIntegration.data.id} (type: ${selectedConnection.type}) integrated with integration ${connectionIntegration.data.id} on Org ${orgId}.`,
),
)
this.log(ux.colorize('red', 'Connection Integrate Workflow completed.'))
Expand Down
15 changes: 14 additions & 1 deletion test/test-utils/nock-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ export const beforeStep = () => {
required: {
key: 'value',
},
type: 'github',
type: 'nexus',
validations: [{key: 'value'}],
},
},
Expand Down Expand Up @@ -538,6 +538,19 @@ export const beforeStep = () => {
}
return [201, response]
})
.post(
`${urlPrefixTenantId}/brokers/connections/${connectionId4}/orgs/${orgId4}/integration?version=2024-02-08~experimental`,
)
.reply((uri, body) => {
const response = apiResponseSchema
response.data = {
id: connectionId4,
integration_type: 'nexus',
org_id: orgId4,
type: 'broker-integration',
}
return [201, response]
})
.patch(
`${urlPrefixTenantIdAndInstallId}/deployments/00000000-0000-0000-0000-000000000000/connections/00000000-0000-0000-0000-000000000000?version=2024-02-08~experimental`,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {captureOutput} from '@oclif/test'
import {expect} from 'chai'
import {stdin as fstdin} from 'mock-stdin'

import Connections from '../../../src/commands/workflows/connections/integrate'
import {beforeStep, connectionId4, integrationId4, orgId4, snykToken} from '../../test-utils/nock-utils'
import {sendScenario} from '../../test-utils/stdin-utils'

describe('deployment workflows', () => {
const stdin = fstdin()
before(beforeStep)

it('runs workflow deployment create', async () => {
// @ts-ignore
const cfg: Config = {}
const integrateConnection = new Connections([], cfg)
const {stdout, stderr, error} = await captureOutput(
async () => {
sendScenario(stdin, [snykToken, 'n', orgId4, orgId4, orgId4, 'y'])
return integrateConnection.run()
},
{print: false},
)

expect(stdout).to.contain(
`Connection ${connectionId4} (type: nexus) integrated with integration ${integrationId4} on Org ${orgId4}.`,
)
expect(error).to.be.undefined
expect(stdout).to.contain('Connection Integrate Workflow completed.')
})
})

0 comments on commit dbe8d97

Please sign in to comment.