diff --git a/docs/config.toml b/docs/config.toml index 3a45d28fb..0cc836d3d 100644 --- a/docs/config.toml +++ b/docs/config.toml @@ -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" diff --git a/pom.xml b/pom.xml index 47b6a58ee..b876fd7bb 100644 --- a/pom.xml +++ b/pom.xml @@ -280,9 +280,6 @@ --outdir=${project.build.directory}/generated-picocli-docs wtf.metio.ilo.shell.ShellCommand - wtf.metio.ilo.compose.ComposeCommand - wtf.metio.ilo.devcontainer.DevcontainerCommand - wtf.metio.ilo.devfile.DevfileCommand diff --git a/src/main/java/wtf/metio/ilo/shell/DockerLike.java b/src/main/java/wtf/metio/ilo/shell/DockerLike.java index 1c79285d3..5524830cd 100644 --- a/src/main/java/wtf/metio/ilo/shell/DockerLike.java +++ b/src/main/java/wtf/metio/ilo/shell/DockerLike.java @@ -60,6 +60,7 @@ public final List 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)), diff --git a/src/main/java/wtf/metio/ilo/shell/ShellRuntime.java b/src/main/java/wtf/metio/ilo/shell/ShellRuntime.java index c87070be1..282b414eb 100644 --- a/src/main/java/wtf/metio/ilo/shell/ShellRuntime.java +++ b/src/main/java/wtf/metio/ilo/shell/ShellRuntime.java @@ -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) diff --git a/src/test/java/wtf/metio/ilo/shell/DockerLikeTCK.java b/src/test/java/wtf/metio/ilo/shell/DockerLikeTCK.java index ff2c596c5..5f648f774 100644 --- a/src/test/java/wtf/metio/ilo/shell/DockerLikeTCK.java +++ b/src/test/java/wtf/metio/ilo/shell/DockerLikeTCK.java @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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)); } } diff --git a/src/test/java/wtf/metio/ilo/shell/ShellCommandTest.java b/src/test/java/wtf/metio/ilo/shell/ShellCommandTest.java index 1ec18909c..126425bd4 100644 --- a/src/test/java/wtf/metio/ilo/shell/ShellCommandTest.java +++ b/src/test/java/wtf/metio/ilo/shell/ShellCommandTest.java @@ -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()); } @@ -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()); } @@ -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()); } @@ -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)); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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)); } @@ -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")); } @@ -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")); } diff --git a/src/test/resources/wtf/metio/ilo/cli/RunCommands/nested/.ilo/ilo.rc b/src/test/resources/wtf/metio/ilo/cli/RunCommands/nested/.ilo/ilo.rc index ea8895bdc..1b96f7b4f 100644 --- a/src/test/resources/wtf/metio/ilo/cli/RunCommands/nested/.ilo/ilo.rc +++ b/src/test/resources/wtf/metio/ilo/cli/RunCommands/nested/.ilo/ilo.rc @@ -1 +1 @@ -compose build \ No newline at end of file +shell diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/.devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/.devfile.yaml deleted file mode 100644 index 15bf87dfe..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/.devfile.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2022 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -schemaVersion: 2.1.0 -metadata: - name: devfile-api -attributes: - controller.devfile.io/storage-type: ephemeral -components: - - name: devtools - container: - image: "quay.io/devfile/universal-developer-image:ubi8-latest" - memoryLimit: 2Gi - memoryRequest: 256Mi -commands: - - id: build-crds-and-schemas - exec: - component: devtools - commandLine: ./build.sh - label: Run build of CRDs and schemas - - id: fetch-dependencies-for-go-ls - exec: - component: devtools - commandLine: go mod vendor - label: Fetch dependencies for Go LS - - id: test - exec: - component: devtools - commandLine: go test -v ./... - label: Run tests diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/container/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/container/devfile.yaml deleted file mode 100644 index 8cae7056d..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/container/devfile.yaml +++ /dev/null @@ -1,26 +0,0 @@ -schemaVersion: 2.2.0 -metadata: - name: devfile-container - version: 1.2.3 -components: - - name: maven - container: - image: eclipse/maven-jdk8:latest - volumeMounts: - - name: mavenrepo - path: /root/.m2 - env: - - name: ENV_VAR - value: value - endpoints: - - name: maven-server - targetPort: 3101 - protocol: https - secure: true - exposure: public - memoryRequest: 256M - memoryLimit: 1536M - cpuRequest: 0.1 - cpuLimit: 0.5 - command: ['tail'] - args: ['-f', '/dev/null'] diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/example/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/example/devfile.yaml deleted file mode 100644 index 9ff2c4da5..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/example/devfile.yaml +++ /dev/null @@ -1,28 +0,0 @@ -schemaVersion: 2.2.0 -metadata: - name: devfile-api - version: 1.2.3 -attributes: - controller.devfile.io/storage-type: ephemeral -components: - - name: devtools - container: - image: quay.io/devfile/universal-developer-image:ubi8-latest - memoryLimit: 2Gi - memoryRequest: 256Mi -commands: - - id: build-crds-and-schemas - exec: - component: devtools - commandLine: ./build.sh - label: Run build of CRDs and schemas - - id: fetch-dependencies-for-go-ls - exec: - component: devtools - commandLine: go mod vendor - label: Fetch dependencies for Go LS - - id: test - exec: - component: devtools - commandLine: go test -v ./... - label: Run tests diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image-git/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image-git/devfile.yaml deleted file mode 100644 index dabeef3ef..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image-git/devfile.yaml +++ /dev/null @@ -1,20 +0,0 @@ -schemaVersion: 2.2.0 -metadata: - name: devfile-image - version: 1.2.3 -components: - - name: outerloop-build - image: - imageName: python-image:latest - autoBuild: true - dockerfile: - git: - remotes: - origin: origin - checkoutFrom: - remote: origin - revision: HEAD - args: - - 'MY_ENV=/home/path' - buildContext: . - rootRequired: false diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image-registry/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image-registry/devfile.yaml deleted file mode 100644 index da0da2373..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image-registry/devfile.yaml +++ /dev/null @@ -1,17 +0,0 @@ -schemaVersion: 2.2.0 -metadata: - name: devfile-image - version: 1.2.3 -components: - - name: outerloop-build - image: - imageName: python-image:latest - autoBuild: true - dockerfile: - devfileRegistry: - id: some-id - registryUrl: https://example.com - args: - - 'MY_ENV=/home/path' - buildContext: . - rootRequired: false diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image/devfile.yaml deleted file mode 100644 index cadd7941c..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/image/devfile.yaml +++ /dev/null @@ -1,15 +0,0 @@ -schemaVersion: 2.2.0 -metadata: - name: devfile-image - version: 1.2.3 -components: - - name: outerloop-build - image: - imageName: python-image:latest - autoBuild: true - dockerfile: - uri: docker/Dockerfile - args: - - 'MY_ENV=/home/path' - buildContext: . - rootRequired: false diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/kubernetes-inline/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/kubernetes-inline/devfile.yaml deleted file mode 100644 index 23f051a33..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/kubernetes-inline/devfile.yaml +++ /dev/null @@ -1,20 +0,0 @@ -schemaVersion: 2.2.2 -metadata: - name: devfile-kubernetes-inline - version: 1.2.3 -components: - - name: myk8deploy - kubernetes: - inlined: - apiVersion: batch/v1 - kind: Job - metadata: - name: pi - spec: - template: - spec: - containers: - - name: job - image: myimage - command: ["some", "command"] - restartPolicy: Never diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/openshift/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/openshift/devfile.yaml deleted file mode 100644 index c7b0d7fd7..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/openshift/devfile.yaml +++ /dev/null @@ -1,8 +0,0 @@ -schemaVersion: 2.1.0 -metadata: - name: devfile-openshift - version: 1.2.3 -components: - - name: mysql - openshift: - uri: petclinic.yaml diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/plain/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/plain/devfile.yaml deleted file mode 100644 index 88cad0ff2..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/plain/devfile.yaml +++ /dev/null @@ -1,4 +0,0 @@ -schemaVersion: 2.2.0 -metadata: - name: devfile-sample - version: 2.1.0 diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/variable/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/variable/devfile.yaml deleted file mode 100644 index 772d4da02..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/variable/devfile.yaml +++ /dev/null @@ -1,6 +0,0 @@ -schemaVersion: 2.2.0 -metadata: - name: java-maven - version: 1.1.1 -variables: - javaVersion: 11 diff --git a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/volume/devfile.yaml b/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/volume/devfile.yaml deleted file mode 100644 index 62ee9aef8..000000000 --- a/src/test/resources/wtf/metio/ilo/devfile/DevfileYamlParser/volume/devfile.yaml +++ /dev/null @@ -1,17 +0,0 @@ -schemaVersion: 2.2.0 -metadata: - name: devfile-volume - version: 1.2.3 -components: - - name: mydevfile - container: - image: golang - memoryLimit: 512Mi - mountSources: true - command: ['sleep', 'infinity'] - volumeMounts: - - name: cache - path: /.cache - - name: cache - volume: - size: 2Gi