Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enableInlineShortcodes = true
term = ["HTML", "RSS", "ATOM"]

[params]
mainSections = ["community", "compose", "contributors", "devcontainer", "integration", "metrics", "shell", "usage"]
mainSections = ["community", "contributors", "integration", "metrics", "shell", "usage"]
author = "metio.wtf"
email = "https://metio.groups.io/g/main/topics"
matrix = "#talk.metio:matrix.org"
Expand Down
3 changes: 0 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,6 @@
<arguments>
<argument>--outdir=${project.build.directory}/generated-picocli-docs</argument>
<argument>wtf.metio.ilo.shell.ShellCommand</argument>
<argument>wtf.metio.ilo.compose.ComposeCommand</argument>
<argument>wtf.metio.ilo.devcontainer.DevcontainerCommand</argument>
<argument>wtf.metio.ilo.devfile.DevfileCommand</argument>
</arguments>
</configuration>
<dependencies>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/wtf/metio/ilo/shell/DockerLike.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public final List<String> runArguments(final ShellOptions options) {
projectDir,
of("--workdir", workingDir),
maybe(options.interactive, "--interactive", "--tty"),
of("--env", "ILO_CONTAINER=true"),
withPrefix("--env", OSSupport.expand(options.variables)),
optional("--hostname", OSSupport.expand(options.hostname)),
withPrefix("--publish", OSSupport.expand(options.ports)),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/wtf/metio/ilo/shell/ShellRuntime.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ShellCLI cli() {
* Select a runtime for 'ilo shell'.
*
* @param preferred The runtime to force, or null for auto-selection.
* @return The selected compose runtime.
* @return The selected shell runtime.
*/
public static ShellCLI autoSelect(final ShellRuntime preferred) {
return Optional.ofNullable(preferred)
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/wtf/metio/ilo/shell/DockerLikeTCK.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void runArguments() {
options.image = "example:test";
options.workingDir = "some/dir";
final var arguments = tool().runArguments(options);
assertEquals(String.format("%s run --rm --workdir %s example:test", name(), options.workingDir), String.join(" ", arguments));
assertEquals(String.format("%s run --rm --workdir %s --env ILO_CONTAINER=true example:test", name(), options.workingDir), String.join(" ", arguments));
}

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

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

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

@Test
Expand All @@ -129,7 +129,7 @@ void runtimeOptions() {
options.workingDir = "some/dir";
options.commands = List.of("--volume=/abc/123:/abc:z", "example:test", "/bin/bash", "-c", "whoami");
final var arguments = tool().runArguments(options);
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));
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));
}

@Test
Expand All @@ -141,7 +141,7 @@ void variables() {
options.variables = List.of("KEY=value", "OTHER=value");
options.workingDir = "some/dir";
final var arguments = tool().runArguments(options);
assertEquals(String.format("%s run --rm --workdir %s --env KEY=value --env OTHER=value example:test", name(), options.workingDir), String.join(" ", arguments));
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));
}

}
24 changes: 12 additions & 12 deletions src/test/java/wtf/metio/ilo/shell/ShellCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void dockerLikeMinimal(final String runtime) {
assertCommandLine(
List.of(),
List.of(),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
List.of());
}

Expand All @@ -59,7 +59,7 @@ void dockerLikeWithPull(final String runtime) {
assertCommandLine(
List.of(tool, "pull", options.image),
List.of(),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
List.of());
}

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

Expand All @@ -85,7 +85,7 @@ void dockerLikeWithCleanup(final String runtime) {
assertCommandLine(
List.of(),
List.of(),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
List.of(tool, "rmi", options.image));
}

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

Expand All @@ -114,7 +114,7 @@ void dockerLikeWithRuntimeOption(final String runtime) {
assertCommandLine(
List.of(),
List.of(),
List.of(tool, "--remote", "run", "--rm", "--workdir", options.workingDir, options.image),
List.of(tool, "--remote", "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
List.of());
}

Expand All @@ -128,7 +128,7 @@ void dockerLikeWithRuntimePullOption(final String runtime) {
assertCommandLine(
List.of(tool, "pull", "--all-tags", options.image),
List.of(),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
List.of());
}

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

Expand All @@ -155,7 +155,7 @@ void dockerLikeWithRuntimeRunOption(final String runtime) {
assertCommandLine(
List.of(),
List.of(),
List.of(tool, "run", "--rm", "--quiet", "--workdir", options.workingDir, options.image),
List.of(tool, "run", "--rm", "--quiet", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
List.of());
}

Expand All @@ -169,7 +169,7 @@ void dockerLikeWithRuntimeCleanupOption(final String runtime) {
assertCommandLine(
List.of(),
List.of(),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, options.image),
List.of(tool, "run", "--rm", "--workdir", options.workingDir, "--env", "ILO_CONTAINER=true", options.image),
List.of(tool, "rmi", "--force", options.image));
}

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
compose build
shell

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading