Skip to content
Closed
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
1 change: 1 addition & 0 deletions k8s-deployer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const main = async () => {
logger.info("")
logger.info("--------------------- Cleaning up --------------------- ")
logger.info("")

if (config.enableCleanups) {
for (let deployments of artefacts) {
await SuiteHandler.undeployAll(config, file, deployments)
Expand Down
48 changes: 31 additions & 17 deletions k8s-deployer/src/test-suite-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ export const generatePrefixByDate = (date: Date, env: string): Prefix => {
* 2. test app for the graph.
*/
const deployGraph = async (config: Config, workspace: string, testSuiteId: string, graph: Schema.Graph, namespace: Namespace, testAppDirForRemoteTestSuite?: string): Promise<GraphDeploymentResult> => {
const deployments: Array<DeployedComponent> = new Array()
for (let i = 0; i < graph.components.length; i++) {
const componentSpec = graph.components[i]
logger.info("")
logger.info("Deploying graph component (%s of %s) \"%s\" for suite \"%s\"...", i + 1, graph.components.length, componentSpec.name, testSuiteId)
logger.info("")
const commitSha = await Deployer.deployComponent(config, workspace, componentSpec, namespace)
deployments.push(new DeployedComponent(commitSha, componentSpec))
}
logger.info("")

logger.info("%s Deploying test app \"%s\" for suite \"%s\" %s", LOG_SEPARATOR_LINE, graph.testApp.name, testSuiteId, LOG_SEPARATOR_LINE)
logger.info("")

if (testAppDirForRemoteTestSuite) {
// When suite is remote its pitfile is sitting within test app itself.
// We just downloaded pitfile from remote location into workspace
Expand All @@ -63,10 +49,38 @@ const deployGraph = async (config: Config, workspace: string, testSuiteId: strin
)
graph.testApp.location.path = testAppDirForRemoteTestSuite
}
const params = [ testSuiteId ]
const testAppCommitSha = await Deployer.deployComponent(config, workspace, graph.testApp, namespace, params)

logger.info("")
logger.info("Deploying %d component(s) and test app \"%s\" for suite \"%s\" in parallel...", graph.components.length, graph.testApp.name, testSuiteId)
logger.info("")
return new GraphDeploymentResult(deployments, new DeployedComponent(testAppCommitSha, graph.testApp))

// do all component deployments in parallel
const componentPromises = graph.components.map(async (componentSpec, i) => {
logger.info("Deploying graph component (%s of %s) \"%s\" for suite \"%s\"...", i + 1, graph.components.length, componentSpec.name, testSuiteId)
const commitSha = await Deployer.deployComponent(config, workspace, componentSpec, namespace)
logger.info("Graph component (%s of %s) \"%s\" for suite \"%s\" has been deployed.", i + 1, graph.components.length, componentSpec.name, testSuiteId)
return new DeployedComponent(commitSha, componentSpec)
})

const testAppPromise = (async () => {
logger.info("%s Deploying test app \"%s\" for suite \"%s\" %s", LOG_SEPARATOR_LINE, graph.testApp.name, testSuiteId, LOG_SEPARATOR_LINE)
const params = [ testSuiteId ]
const testAppCommitSha = await Deployer.deployComponent(config, workspace, graph.testApp, namespace, params)
logger.info("%s Test app \"%s\" for suite \"%s\" has been deployed. %s", LOG_SEPARATOR_LINE, graph.testApp.name, testSuiteId, LOG_SEPARATOR_LINE)
return new DeployedComponent(testAppCommitSha, graph.testApp)
})()

// Wait for everything to be ready
const [deployments, testApp] = await Promise.all([
Promise.all(componentPromises),
testAppPromise
])

logger.info("")
logger.info("Deployment of %d component(s) and test app \"%s\" for suite \"%s\" complete.", graph.components.length, graph.testApp.name, testSuiteId)
logger.info("")

return new GraphDeploymentResult(deployments, testApp)
}

const downloadPitFile = async (testSuite: Schema.TestSuite, destination: string): Promise<Schema.PitFile> => {
Expand Down