Skip to content

Commit be4212f

Browse files
committed
set ILO_CONTAINER=true in each container
fixes #184 Signed-off-by: Sebastian Hoß <seb@xn--ho-hia.de>
1 parent c7f6558 commit be4212f

File tree

18 files changed

+22
-226
lines changed

18 files changed

+22
-226
lines changed

docs/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enableInlineShortcodes = true
1515
term = ["HTML", "RSS", "ATOM"]
1616

1717
[params]
18-
mainSections = ["community", "compose", "contributors", "devcontainer", "integration", "metrics", "shell", "usage"]
18+
mainSections = ["community", "contributors", "integration", "metrics", "shell", "usage"]
1919
author = "metio.wtf"
2020
email = "https://metio.groups.io/g/main/topics"
2121
matrix = "#talk.metio:matrix.org"

pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,6 @@
280280
<arguments>
281281
<argument>--outdir=${project.build.directory}/generated-picocli-docs</argument>
282282
<argument>wtf.metio.ilo.shell.ShellCommand</argument>
283-
<argument>wtf.metio.ilo.compose.ComposeCommand</argument>
284-
<argument>wtf.metio.ilo.devcontainer.DevcontainerCommand</argument>
285-
<argument>wtf.metio.ilo.devfile.DevfileCommand</argument>
286283
</arguments>
287284
</configuration>
288285
<dependencies>

src/main/java/wtf/metio/ilo/shell/DockerLike.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public final List<String> runArguments(final ShellOptions options) {
6060
projectDir,
6161
of("--workdir", workingDir),
6262
maybe(options.interactive, "--interactive", "--tty"),
63+
of("--env", "ILO_CONTAINER=true"),
6364
withPrefix("--env", OSSupport.expand(options.variables)),
6465
optional("--hostname", OSSupport.expand(options.hostname)),
6566
withPrefix("--publish", OSSupport.expand(options.ports)),

src/main/java/wtf/metio/ilo/shell/ShellRuntime.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public ShellCLI cli() {
4545
* Select a runtime for 'ilo shell'.
4646
*
4747
* @param preferred The runtime to force, or null for auto-selection.
48-
* @return The selected compose runtime.
48+
* @return The selected shell runtime.
4949
*/
5050
public static ShellCLI autoSelect(final ShellRuntime preferred) {
5151
return Optional.ofNullable(preferred)

src/test/java/wtf/metio/ilo/shell/DockerLikeTCK.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void runArguments() {
6060
options.image = "example:test";
6161
options.workingDir = "some/dir";
6262
final var arguments = tool().runArguments(options);
63-
assertEquals(String.format("%s run --rm --workdir %s example:test", name(), options.workingDir), String.join(" ", arguments));
63+
assertEquals(String.format("%s run --rm --workdir %s --env ILO_CONTAINER=true example:test", name(), options.workingDir), String.join(" ", arguments));
6464
}
6565

6666
@Test
@@ -83,7 +83,7 @@ void interactive() {
8383
options.interactive = true;
8484
options.workingDir = "some/dir";
8585
final var arguments = tool().runArguments(options);
86-
assertEquals(String.format("%s run --rm --workdir %s --interactive --tty example:test", name(), options.workingDir), String.join(" ", arguments));
86+
assertEquals(String.format("%s run --rm --workdir %s --interactive --tty --env ILO_CONTAINER=true example:test", name(), options.workingDir), String.join(" ", arguments));
8787
}
8888

8989
@Test
@@ -95,7 +95,7 @@ void hostname() {
9595
options.hostname = "some-test";
9696
options.workingDir = "some/dir";
9797
final var arguments = tool().runArguments(options);
98-
assertEquals(String.format("%s run --rm --workdir %s --hostname some-test example:test", name(), options.workingDir), String.join(" ", arguments));
98+
assertEquals(String.format("%s run --rm --workdir %s --env ILO_CONTAINER=true --hostname some-test example:test", name(), options.workingDir), String.join(" ", arguments));
9999
}
100100

101101
@Test
@@ -106,7 +106,7 @@ void customCommand() {
106106
options.commands = List.of("example:test", "/bin/bash", "-c", "whoami");
107107
options.workingDir = "some/dir";
108108
final var arguments = tool().runArguments(options);
109-
assertEquals(String.format("%s run --rm --workdir %s example:test /bin/bash -c whoami", name(), options.workingDir), String.join(" ", arguments));
109+
assertEquals(String.format("%s run --rm --workdir %s --env ILO_CONTAINER=true example:test /bin/bash -c whoami", name(), options.workingDir), String.join(" ", arguments));
110110
}
111111

112112
@Test
@@ -129,7 +129,7 @@ void runtimeOptions() {
129129
options.workingDir = "some/dir";
130130
options.commands = List.of("--volume=/abc/123:/abc:z", "example:test", "/bin/bash", "-c", "whoami");
131131
final var arguments = tool().runArguments(options);
132-
assertEquals(String.format("%s run --rm --workdir %s --volume=/abc/123:/abc:z example:test /bin/bash -c whoami", name(), options.workingDir), String.join(" ", arguments));
132+
assertEquals(String.format("%s run --rm --workdir %s --env ILO_CONTAINER=true --volume=/abc/123:/abc:z example:test /bin/bash -c whoami", name(), options.workingDir), String.join(" ", arguments));
133133
}
134134

135135
@Test
@@ -141,7 +141,7 @@ void variables() {
141141
options.variables = List.of("KEY=value", "OTHER=value");
142142
options.workingDir = "some/dir";
143143
final var arguments = tool().runArguments(options);
144-
assertEquals(String.format("%s run --rm --workdir %s --env KEY=value --env OTHER=value example:test", name(), options.workingDir), String.join(" ", arguments));
144+
assertEquals(String.format("%s run --rm --workdir %s --env ILO_CONTAINER=true --env KEY=value --env OTHER=value example:test", name(), options.workingDir), String.join(" ", arguments));
145145
}
146146

147147
}

src/test/java/wtf/metio/ilo/shell/ShellCommandTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void dockerLikeMinimal(final String runtime) {
4646
assertCommandLine(
4747
List.of(),
4848
List.of(),
49-
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
49+
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
5050
List.of());
5151
}
5252

@@ -59,7 +59,7 @@ void dockerLikeWithPull(final String runtime) {
5959
assertCommandLine(
6060
List.of(tool, "pull", options.image),
6161
List.of(),
62-
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
62+
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
6363
List.of());
6464
}
6565

@@ -72,7 +72,7 @@ void dockerLikeWithBuild(final String runtime) {
7272
assertCommandLine(
7373
List.of(),
7474
List.of(tool, "build", "--file", options.containerfile, "--tag", options.image),
75-
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
75+
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
7676
List.of());
7777
}
7878

@@ -85,7 +85,7 @@ void dockerLikeWithCleanup(final String runtime) {
8585
assertCommandLine(
8686
List.of(),
8787
List.of(),
88-
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
88+
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
8989
List.of(tool, "rmi", options.image));
9090
}
9191

@@ -101,7 +101,7 @@ void dockerLikeWithDefaults(final String runtime, final SystemProperties propert
101101
assertCommandLine(
102102
List.of(),
103103
List.of(),
104-
List.of(tool, "run", "--rm", "--volume", "/some/folder:/some/folder:z", "--workdir", "/some/folder", "--interactive", "--tty", options.image),
104+
List.of(tool, "run", "--rm", "--volume", "/some/folder:/some/folder:z", "--workdir", "/some/folder", "--interactive", "--tty", "--env", "ILO_CONTAINER=true", options.image),
105105
List.of());
106106
}
107107

@@ -114,7 +114,7 @@ void dockerLikeWithRuntimeOption(final String runtime) {
114114
assertCommandLine(
115115
List.of(),
116116
List.of(),
117-
List.of(tool, "--remote", "run", "--rm", "--workdir", options.workingDir, options.image),
117+
List.of(tool, "--remote", "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
118118
List.of());
119119
}
120120

@@ -128,7 +128,7 @@ void dockerLikeWithRuntimePullOption(final String runtime) {
128128
assertCommandLine(
129129
List.of(tool, "pull", "--all-tags", options.image),
130130
List.of(),
131-
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
131+
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
132132
List.of());
133133
}
134134

@@ -142,7 +142,7 @@ void dockerLikeWithRuntimeBuildOption(final String runtime) {
142142
assertCommandLine(
143143
List.of(),
144144
List.of(tool, "build", "--file", options.containerfile, "--squash-all", "--tag", options.image),
145-
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
145+
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
146146
List.of());
147147
}
148148

@@ -155,7 +155,7 @@ void dockerLikeWithRuntimeRunOption(final String runtime) {
155155
assertCommandLine(
156156
List.of(),
157157
List.of(),
158-
List.of(tool, "run", "--rm", "--quiet", "--workdir", options.workingDir, options.image),
158+
List.of(tool, "run", "--rm", "--quiet", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
159159
List.of());
160160
}
161161

@@ -169,7 +169,7 @@ void dockerLikeWithRuntimeCleanupOption(final String runtime) {
169169
assertCommandLine(
170170
List.of(),
171171
List.of(),
172-
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
172+
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
173173
List.of(tool, "rmi", "--force", options.image));
174174
}
175175

@@ -216,7 +216,7 @@ void failToRun(final String runtime) {
216216
() -> assertEquals(1, exitCode, "exitCode"),
217217
() -> assertIterableEquals(List.of(), executor.pullArguments(), "pullArguments"),
218218
() -> assertIterableEquals(List.of(), executor.buildArguments(), "buildArguments"),
219-
() -> assertIterableEquals(List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image), executor.runArguments(), "runArguments"),
219+
() -> assertIterableEquals(List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image), executor.runArguments(), "runArguments"),
220220
() -> noExecution(executor::cleanupArguments, "cleanupArguments"));
221221
}
222222

@@ -231,7 +231,7 @@ void failToClean(final String runtime) {
231231
() -> assertEquals(1, exitCode, "exitCode"),
232232
() -> assertIterableEquals(List.of(), executor.pullArguments(), "pullArguments"),
233233
() -> assertIterableEquals(List.of(), executor.buildArguments(), "buildArguments"),
234-
() -> assertIterableEquals(List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image), executor.runArguments(), "runArguments"),
234+
() -> assertIterableEquals(List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image), executor.runArguments(), "runArguments"),
235235
() -> assertIterableEquals(List.of(), executor.cleanupArguments(), "cleanupArguments"));
236236
}
237237

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
compose build
1+
shell

src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/.devfile.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/container/devfile.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/example/devfile.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)