Skip to content

Commit

Permalink
feat: [KTD-3526] test project directory path check
Browse files Browse the repository at this point in the history
  • Loading branch information
damwu1 committed May 10, 2024
1 parent 9103d34 commit 7d0a980
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion k8s-deployer/scripts/start-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ fi
if [ "${DO_NOT_CREATE_PROJECT_DIR}" == "" ]; then DO_NOT_CREATE_PROJECT_DIR="false"; fi
if [ "${DO_NOT_CREATE_PROJECT_DIR}" == "true" ];
then
export DO_NOT_CREATE_PROJECT_DIR
PROJECT_DIR="${PROJECT_DIR}/*"
fi

Expand Down
12 changes: 6 additions & 6 deletions k8s-deployer/src/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ export const deployComponent = async (
} else {
logger.info("Reading commit sha of local project: '%s'", appDir)

if (process.env.DO_NOT_CREATE_PROJECT_DIR === "true") spec.location.path = "."; // only if creating project directory is not required

if (spec.location.path) {
appDir = spec.location.path
logger.info("The application directory will be taken from 'location.path' attribute: '%s' of '%s'", appDir, spec.name)
} else {
appDir = spec.id
const currentPath = await Shell.exec(`pwd`);
console.log('😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈', currentPath);
appDir = fs.existsSync(spec.id) ? spec.id : ''
logger.info("The application directory will be taken from 'id' attribute: '%s' of '%s'", appDir, spec.name)
}
commitSha = await Shell.exec(`cd ${ appDir } && git log --pretty=format:"%h" -1`)
Expand All @@ -229,14 +229,14 @@ export const undeployComponent = async (workspace: string, namespace: Namespace,
const spec = deploymentInfo.component
let appDir = `${workspace}/${ spec.id }`

if (process.env.DO_NOT_CREATE_PROJECT_DIR === "true") spec.location.path = "." // only if creating project directory is not required

if (spec.location.type === LocationType.Local) {
if (spec.location.path) {
appDir = spec.location.path
logger.info("The application directory will be taken from 'location.path' attribute: '%s' of '%s'", appDir, spec.name)
} else {
appDir = spec.id
const currentPath = await Shell.exec(`pwd`);
console.log('😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈😈', currentPath);
appDir = fs.existsSync(spec.id) ? spec.id : ''
logger.info("The application directory will be taken from 'id' attribute: '%s' of '%s'", appDir, spec.name)
}
}
Expand Down
14 changes: 7 additions & 7 deletions k8s-deployer/src/test-suite-handler.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as fs from "fs"

import { Config } from "./config.js"
import * as Deployer from "./deployer.js"
import * as K8s from "./k8s.js"
import { LOG_SEPARATOR_LINE, logger } from "./logger.js"
import { DeployedComponent, DeployedTestSuite, GraphDeploymentResult, Namespace, Prefix, Schema } from "./model.js"
import * as Deployer from "./deployer.js"
import { Config } from "./config.js"
import * as PifFileLoader from "./pitfile/pitfile-loader.js"
import * as K8s from "./k8s.js"
import * as TestRunner from "./test-app-client/test-runner.js"
import * as Shell from "./shell-facade.js"
import { PodLogTail } from "./pod-log-tail.js"
import * as Shell from "./shell-facade.js"
import * as TestRunner from "./test-app-client/test-runner.js"

export const generatePrefix = (env: string): Prefix => {
return generatePrefixByDate(new Date(), env)
Expand Down Expand Up @@ -137,7 +137,7 @@ const deployLocal = async (
logger.info("process.env.MOCK_NS=%s", process.env.MOCK_NS)
}

logger.info("NAMEPSACE IN USE=%s, process.env.MOCK_NS=%s", ns, process.env.MOCK_NS)
logger.info("NAMESPACE IN USE=%s, process.env.MOCK_NS=%s", ns, process.env.MOCK_NS)

await deployLockManager(config, workspace, ns, pitfile.lockManager.enabled, testSuite.id)
logger.info("")
Expand Down Expand Up @@ -234,7 +234,7 @@ export const processTestSuite = async (
// By default assume processing strategy to be "deploy all then run tests one by one"

logger.info("")
logger.info("--------------- Processig %s ---------------", testSuite.id)
logger.info("--------------- Processing %s ---------------", testSuite.id)
logger.info("")
const list = await deployAll(prefix, config, pitfile, seqNumber, testSuite)

Expand Down

0 comments on commit 7d0a980

Please sign in to comment.