Skip to content

Commit a123138

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feature/adaptCobiGenTemplates
2 parents 5b27486 + 4fcbd6b commit a123138

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

documentation/Functions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,11 @@ image: Path to an image to be displayed in the katacoda step.
232232

233233
***
234234

235+
235236
### adaptTemplatesCobiGen
236237
#### parameter
237238
* No parameters
238239
#### example
239240
adaptTemplatesCobiGen()
240241

241242
***
242-
243-

runners/katacoda/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,28 @@ export class Katacoda extends Runner {
343343
return null;
344344
}
345345

346+
346347
runAdaptTemplatesCobiGen(step: Step, command: Command): RunResult {
347348
this.steps.push({
348349
"title": "Adapt cobiGen templates",
349350
"text": "step" + this.stepsCount + ".md"
350351
});
351352
this.renderTemplate("adaptTemplatesCobiGen.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter});
352353
return null;
353-
354+
}
355+
356+
runDockerCompose(step: Step, command: Command) : RunResult {
357+
let terminal = this.getTerminal('runDockerCompose');
358+
let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), command.parameters[0]), terminal.terminalId, terminal.isRunning);
359+
360+
this.steps.push({
361+
"title": "Execute Docker Compose",
362+
"text": "step" +this.stepsCount + ".md"
363+
});
364+
365+
this.renderTemplate("dockerCompose.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, port: command.parameters[1].port});
366+
return null;
367+
354368
}
355369

356370
private renderTemplate(name: string, targetPath: string, variables) {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<%= text; %>
2+
3+
<%= cdCommand; %>
4+
5+
<% if(!interrupt){ %>
6+
Now run docker-compose.
7+
<% } else { %>
8+
The docker container is already running.
9+
Usually you would type "Ctrl + C" and rerun the same command in this terminal to rebuild the app, but for now click on the command to stop and relaunch it automatically.
10+
<% } %>
11+
12+
`docker-compose up`{{execute T<%= terminalId; %> <% if (interrupt) { %>interrupt<% } %>}}
13+
14+
This will take some time.
15+
16+
<% if(port){ %>
17+
Then you can open the following link to use the app.
18+
https://[[HOST_SUBDOMAIN]]-<%= port %>-[[KATACODA_HOST]].environments.katacoda.com/
19+
<% } %>
20+
<%= textAfter; %>

0 commit comments

Comments
 (0)