Skip to content

Commit

Permalink
Add print statements to test builder flow
Browse files Browse the repository at this point in the history
  • Loading branch information
snehapar9 committed Sep 19, 2023
1 parent bf8364c commit d9b03f9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
15 changes: 11 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5367,7 +5367,7 @@ var ContainerAppHelper = /** @class */ (function () {
*/
ContainerAppHelper.prototype.determineRuntimeStackAsync = function (appSourcePath) {
return __awaiter(this, void 0, void 0, function () {
var dockerTool, dockerCommand, oryxRuntimeTxtPath, command, runtimeStack, err_17;
var dockerTool, dockerCommand, exitCode, oryxRuntimeTxtPath, command, runtimeStack, err_17;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
Expand All @@ -5379,16 +5379,23 @@ var ContainerAppHelper = /** @class */ (function () {
case 2:
dockerTool = _a.sent();
dockerCommand = "run --rm -v " + appSourcePath + ":/app " + ORYX_CLI_IMAGE + " /bin/bash -c \"oryx dockerfile /app | head -n 1 | sed 's/ARG RUNTIME=//' >> /app/oryx-runtime.txt\"";
return [4 /*yield*/, exec.exec('docker', ['run', '--rm', '-v', appSourcePath + ":/app", "" + ORYX_CLI_IMAGE, '/bin/bash', '-c', "\"oryx dockerfile /app | head -n 1 | sed 's/ARG RUNTIME=//' >> /app/oryx-runtime.txt\""])
return [4 /*yield*/, exec.exec('docker', [dockerCommand])
// new Utility().executeAndthrowIfError(
// `${dockerTool}`,
// `${dockerCommand}`,
// `Unable to determine the runtime stack needed for the provided application source.`
// );
// Read the temp file to get the runtime stack into a variable
];
case 3:
_a.sent();
exitCode = _a.sent();
// new Utility().executeAndthrowIfError(
// `${dockerTool}`,
// `${dockerCommand}`,
// `Unable to determine the runtime stack needed for the provided application source.`
// );
if (exitCode != 0) {
throw new Error("Unable to determine the runtime stack needed for the provided application source.");
}
oryxRuntimeTxtPath = path.join(appSourcePath, 'oryx-runtime.txt');
command = "head -n 1 " + oryxRuntimeTxtPath;
if (IS_WINDOWS_AGENT) {
Expand Down
15 changes: 11 additions & 4 deletions src/ContainerAppHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ var ContainerAppHelper = /** @class */ (function () {
*/
ContainerAppHelper.prototype.determineRuntimeStackAsync = function (appSourcePath) {
return __awaiter(this, void 0, void 0, function () {
var dockerTool, dockerCommand, oryxRuntimeTxtPath, command, runtimeStack, err_17;
var dockerTool, dockerCommand, exitCode, oryxRuntimeTxtPath, command, runtimeStack, err_17;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
Expand All @@ -604,16 +604,23 @@ var ContainerAppHelper = /** @class */ (function () {
case 2:
dockerTool = _a.sent();
dockerCommand = "run --rm -v " + appSourcePath + ":/app " + ORYX_CLI_IMAGE + " /bin/bash -c \"oryx dockerfile /app | head -n 1 | sed 's/ARG RUNTIME=//' >> /app/oryx-runtime.txt\"";
return [4 /*yield*/, exec.exec('docker', ['run', '--rm', '-v', appSourcePath + ":/app", "" + ORYX_CLI_IMAGE, '/bin/bash', '-c', "\"oryx dockerfile /app | head -n 1 | sed 's/ARG RUNTIME=//' >> /app/oryx-runtime.txt\""])
return [4 /*yield*/, exec.exec('docker', [dockerCommand])
// new Utility().executeAndthrowIfError(
// `${dockerTool}`,
// `${dockerCommand}`,
// `Unable to determine the runtime stack needed for the provided application source.`
// );
// Read the temp file to get the runtime stack into a variable
];
case 3:
_a.sent();
exitCode = _a.sent();
// new Utility().executeAndthrowIfError(
// `${dockerTool}`,
// `${dockerCommand}`,
// `Unable to determine the runtime stack needed for the provided application source.`
// );
if (exitCode != 0) {
throw new Error("Unable to determine the runtime stack needed for the provided application source.");
}
oryxRuntimeTxtPath = path.join(appSourcePath, 'oryx-runtime.txt');
command = "head -n 1 " + oryxRuntimeTxtPath;
if (IS_WINDOWS_AGENT) {
Expand Down
5 changes: 4 additions & 1 deletion src/ContainerAppHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,15 @@ export class ContainerAppHelper {
const dockerTool: string = await io.which("docker", true);
// Use 'oryx dockerfile' command to determine the runtime stack to use and write it to a temp file
const dockerCommand: string = `run --rm -v ${appSourcePath}:/app ${ORYX_CLI_IMAGE} /bin/bash -c "oryx dockerfile /app | head -n 1 | sed 's/ARG RUNTIME=//' >> /app/oryx-runtime.txt"`;
await exec.exec('docker', ['run', '--rm', '-v', `${appSourcePath}:/app`, `${ORYX_CLI_IMAGE}`, '/bin/bash', '-c', `"oryx dockerfile /app | head -n 1 | sed 's/ARG RUNTIME=//' >> /app/oryx-runtime.txt"`])
const exitCode = await exec.exec('docker', [dockerCommand])
// new Utility().executeAndthrowIfError(
// `${dockerTool}`,
// `${dockerCommand}`,
// `Unable to determine the runtime stack needed for the provided application source.`
// );
if (exitCode != 0) {
throw new Error(`Unable to determine the runtime stack needed for the provided application source.`);
}

// Read the temp file to get the runtime stack into a variable
const oryxRuntimeTxtPath = path.join(appSourcePath, 'oryx-runtime.txt');
Expand Down

0 comments on commit d9b03f9

Please sign in to comment.