Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions runners/katacoda/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ export class Katacoda extends Runner {

let imageDirectory = path.join(this.playbookPath, "images");
if(fs.existsSync(imageDirectory)) {
this.assetManager.registerDirectory(imageDirectory, "", "", true);
this.assetManager.registerDirectory(imageDirectory, "", "", true, false);
}

// copy all assets from temp/setup in assets folder
this.assetManager.registerDirectory(path.join(this.tempPathTutorial, "setup"), "setup", "/root/setup", true);
this.assetManager.registerDirectory(path.join(this.tempPathTutorial, "setup"), "setup", "/root/setup", true, true);
this.assetManager.copyAssets();

// write index file, required for katacoda to load the tutorial
Expand Down Expand Up @@ -478,7 +478,7 @@ export class Katacoda extends Runner {
fs.appendFileSync(setupFile, "##########\n");
}

this.assetManager.registerFile(setupFile, "setup/setup.txt", "/root/setup", false);
this.assetManager.registerFile(setupFile, "setup/setup.txt", "/root/setup", false, true);
}

private changeCurrentDir(targetDir:string, terminalId?: number, isRunning?: boolean):string{
Expand Down
18 changes: 10 additions & 8 deletions runners/katacoda/katacodaAssetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,29 @@ export class KatacodaAssetManager {
this.assetDirectory = assetDir;
}

registerFile(filepathSource: string, filepathTarget: string, katacodaDirectory: string, copyFile: boolean) {
registerFile(filepathSource: string, filepathTarget: string, katacodaDirectory: string, copyFile: boolean, copyIntoKatacodaEnvironment: boolean) {
this.assetData.push({
sourcePath: filepathSource,
targetPath: filepathTarget,
katacodaDirectory: katacodaDirectory,
copyFile: copyFile
});

this.katacodaAssets.push({
file: filepathTarget.replace(/\\/g, "/"),
target: katacodaDirectory.replace(/\\/g, "/")
})
if(copyIntoKatacodaEnvironment) {
Comment thread
GuentherJulian marked this conversation as resolved.
Outdated
this.katacodaAssets.push({
file: filepathTarget.replace(/\\/g, "/"),
target: katacodaDirectory.replace(/\\/g, "/")
})
}
}

registerDirectory(directorySource: string, filepathTarget: string, katacodaDirectory: string, copyFile: boolean) {
registerDirectory(directorySource: string, filepathTarget: string, katacodaDirectory: string, copyFile: boolean, copyIntoKatacodaEnvironment: boolean) {
let dir = fs.readdirSync(directorySource);
dir.forEach(file => {
if(fs.lstatSync(path.join(directorySource, file)).isDirectory()) {
this.registerDirectory(path.join(directorySource, file), filepathTarget, katacodaDirectory, copyFile);
this.registerDirectory(path.join(directorySource, file), filepathTarget, katacodaDirectory, copyFile, copyIntoKatacodaEnvironment);
} else {
this.registerFile(path.join(directorySource, file), path.join(filepathTarget, file), katacodaDirectory, copyFile);
this.registerFile(path.join(directorySource, file), path.join(filepathTarget, file), katacodaDirectory, copyFile, copyIntoKatacodaEnvironment);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion runners/katacoda/katacodaTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class KatacodaTools {
},
"environment": environment,
"backend": {
"imageid": "ubuntu:1804"
"imageid": "ubuntu:2004"
}
}
return indexJsonObject;
Expand Down