diff --git a/Makefile b/Makefile
index 396c29d22..eb1bb9cc5 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,7 @@ vet:
.PHONY: sec
sec:
- go run $(COMMON_GOFLAGS) github.com/securego/gosec/v2/cmd/gosec -severity medium -confidence medium -exclude G304,G204,G107 -quiet ./tests/integration/... ./tests/helper... ./tests/e2escenarios/...
+ go run $(COMMON_GOFLAGS) github.com/securego/gosec/v2/cmd/gosec -severity medium -confidence medium -exclude G304,G204,G107 -quiet ./tests/integration/... ./tests/helper... ./tests/e2escenarios/... ./tests/documentation/...
go run $(COMMON_GOFLAGS) github.com/securego/gosec/v2/cmd/gosec -severity medium -confidence medium -exclude G304,G204 -quiet ./cmd/... ./pkg/...
.PHONY: clean
@@ -211,4 +211,9 @@ test-integration: test-integration-no-cluster test-integration-cluster
.PHONY: test-e2e
test-e2e:
- $(RUN_GINKGO) $(GINKGO_FLAGS) --junit-report="test-e2e.xml" tests/e2escenarios
\ No newline at end of file
+ $(RUN_GINKGO) $(GINKGO_FLAGS) --junit-report="test-e2e.xml" tests/e2escenarios
+
+
+.PHONY: test-doc-automation
+test-doc-automation:
+ $(RUN_GINKGO) $(GINKGO_FLAGS) --junit-report="test-doc-automation.xml" tests/documentation/...
\ No newline at end of file
diff --git a/docs/website/docs/_version.mdx b/docs/website/docs/_version.mdx
deleted file mode 100644
index 625cd1250..000000000
--- a/docs/website/docs/_version.mdx
+++ /dev/null
@@ -1,2 +0,0 @@
-` / \__/ odo version: v3.0.0~beta3
- \__/`
\ No newline at end of file
diff --git a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_any_registry_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_any_registry_output.mdx
new file mode 100644
index 000000000..25316bbc9
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_any_registry_output.mdx
@@ -0,0 +1,15 @@
+```console
+$ odo init --devfile nodejs-react --name my-nr-app
+ __
+ / \__ Initializing a new component
+ \__/ \
+ / \__/ odo version: v3.5.0
+ \__/
+
+ ✓ Downloading devfile "nodejs-react" [3s]
+
+Your new component 'my-nr-app' is ready in the current directory.
+To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
+Changes will be directly reflected on the cluster.
+
+```
diff --git a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_specific_registry_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_specific_registry_output.mdx
new file mode 100644
index 000000000..8748b043e
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_specific_registry_output.mdx
@@ -0,0 +1,16 @@
+```console
+$ odo init --name my-spring-app --devfile java-springboot --devfile-registry DefaultDevfileRegistry --starter springbootproject
+ __
+ / \__ Initializing a new component
+ \__/ \
+ / \__/ odo version: v3.5.0
+ \__/
+
+ ✓ Downloading devfile "java-springboot" from registry "DefaultDevfileRegistry" [4s]
+ ✓ Downloading starter project "springbootproject" [874ms]
+
+Your new component 'my-spring-app' is ready in the current directory.
+To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
+Changes will be directly reflected on the cluster.
+
+```
\ No newline at end of file
diff --git a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_url_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_url_output.mdx
new file mode 100644
index 000000000..f90655ffd
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_url_output.mdx
@@ -0,0 +1,16 @@
+```console
+$ odo init --devfile-path https://registry.devfile.io/devfiles/nodejs-angular --name my-nodejs-app --starter nodejs-angular-starter
+ __
+ / \__ Initializing a new component
+ \__/ \
+ / \__/ odo version: v3.5.0
+ \__/
+
+ ✓ Downloading devfile from "https://registry.devfile.io/devfiles/nodejs-angular" [1s]
+ ✓ Downloading starter project "nodejs-angular-starter" [958ms]
+
+Your new component 'my-nodejs-app' is ready in the current directory.
+To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
+Changes will be directly reflected on the cluster.
+
+```
\ No newline at end of file
diff --git a/docs/website/docs/command-reference/docs-mdx/init/interactive_mode_directory_with_sources_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/interactive_mode_directory_with_sources_output.mdx
new file mode 100644
index 000000000..938e6eb60
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/interactive_mode_directory_with_sources_output.mdx
@@ -0,0 +1,34 @@
+```console
+$ odo init
+ __
+ / \__ Initializing a new component
+ \__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
+ / \__/ odo version: v3.5.0
+ \__/
+
+Interactive mode enabled, please answer the following questions:
+Based on the files in the current directory odo detected
+Language: JavaScript
+Project type: Node.js
+Application ports: 8080
+The devfile "nodejs:2.1.1" from the registry "DefaultDevfileRegistry" will be downloaded.
+? Is this correct? Yes
+ ✓ Downloading devfile "nodejs:2.1.1" from registry "DefaultDevfileRegistry" [3s]
+
+↪ Container Configuration "runtime":
+ OPEN PORTS:
+ - 8080
+ - 5858
+ ENVIRONMENT VARIABLES:
+ - DEBUG_PORT = 5858
+
+? Select container for which you want to change configuration? NONE - configuration is correct
+? Enter component name: node-echo
+
+You can automate this command by executing:
+ odo init --name node-echo --devfile nodejs --devfile-registry DefaultDevfileRegistry --devfile-version 2.1.1
+
+Your new component 'node-echo' is ready in the current directory.
+To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
+Changes will be directly reflected on the cluster.
+```
\ No newline at end of file
diff --git a/docs/website/docs/command-reference/docs-mdx/init/interactive_mode_empty_directory_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/interactive_mode_empty_directory_output.mdx
new file mode 100644
index 000000000..14266d037
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/interactive_mode_empty_directory_output.mdx
@@ -0,0 +1,32 @@
+```console
+$ odo init
+ __
+ / \__ Initializing a new component
+ \__/ \ Files: No source code detected, a starter project will be created in the current directory
+ / \__/ odo version: v3.5.0
+ \__/
+
+Interactive mode enabled, please answer the following questions:
+? Select language: Java
+? Select project type: Maven Java
+ ✓ Downloading devfile "java-maven" from registry "DefaultDevfileRegistry" [4s]
+
+↪ Container Configuration "tools":
+ OPEN PORTS:
+ - 8080
+ - 5858
+ ENVIRONMENT VARIABLES:
+ - DEBUG_PORT = 5858
+
+? Select container for which you want to change configuration? NONE - configuration is correct
+? Which starter project do you want to use? springbootproject
+? Enter component name: my-java-maven-app
+ ✓ Downloading starter project "springbootproject" [1s]
+
+You can automate this command by executing:
+ odo init --name my-java-maven-app --devfile java-maven --devfile-registry DefaultDevfileRegistry --starter springbootproject
+
+Your new component 'my-java-maven-app' is ready in the current directory.
+To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
+Changes will be directly reflected on the cluster.
+```
\ No newline at end of file
diff --git a/docs/website/docs/command-reference/docs-mdx/init/latest_versioned_devfile_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/latest_versioned_devfile_output.mdx
new file mode 100644
index 000000000..d43d0f2d5
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/latest_versioned_devfile_output.mdx
@@ -0,0 +1,16 @@
+```console
+$ odo init --devfile go --name my-go-app --devfile-version latest
+ __
+ / \__ Initializing a new component
+ \__/ \
+ / \__/ odo version: v3.5.0
+ \__/
+
+ ✓ Downloading devfile "go:latest" [4s]
+
+Your new component 'my-go-app' is ready in the current directory.
+To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
+Changes will be directly reflected on the cluster.
+To deploy your component to a cluster use "odo deploy".
+
+```
\ No newline at end of file
diff --git a/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx
new file mode 100644
index 000000000..75050b72d
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx
@@ -0,0 +1,7 @@
+```console
+$ odo registry --devfile nodejs-react
+ NAME REGISTRY DESCRIPTION VERSIONS
+ nodejs-react StagingRegistry React is a free and open-source front-en... 2.0.2
+ nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2
+
+```
\ No newline at end of file
diff --git a/docs/website/docs/command-reference/docs-mdx/init/registry_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/registry_output.mdx
new file mode 100644
index 000000000..e8a78edde
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/registry_output.mdx
@@ -0,0 +1,10 @@
+```console
+$ odo preference view
+[...]
+
+Devfile registries:
+ NAME URL SECURE
+ StagingRegistry https://registry.stage.devfile.io No
+ DefaultDevfileRegistry https://registry.devfile.io No
+
+```
\ No newline at end of file
diff --git a/docs/website/docs/command-reference/docs-mdx/init/versioned_devfile_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/versioned_devfile_output.mdx
new file mode 100644
index 000000000..7a0c21da5
--- /dev/null
+++ b/docs/website/docs/command-reference/docs-mdx/init/versioned_devfile_output.mdx
@@ -0,0 +1,16 @@
+```console
+$ odo init --devfile go --name my-go-app --devfile-version 2.0.0
+ __
+ / \__ Initializing a new component
+ \__/ \
+ / \__/ odo version: v3.5.0
+ \__/
+
+ ✓ Downloading devfile "go:2.0.0" [3s]
+
+Your new component 'my-go-app' is ready in the current directory.
+To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
+Changes will be directly reflected on the cluster.
+To deploy your component to a cluster use "odo deploy".
+
+```
diff --git a/docs/website/docs/command-reference/init.md b/docs/website/docs/command-reference/init.md
index 4aa590632..efded0d43 100644
--- a/docs/website/docs/command-reference/init.md
+++ b/docs/website/docs/command-reference/init.md
@@ -29,20 +29,10 @@ odo init
Example
-```console
-$ odo init
-? Select language: java
-? Select project type: Maven Java (java-maven, registry: DefaultDevfileRegistry)
-? Which starter project do you want to use? springbootproject
-? Enter component name: my-java-maven-app
- ✓ Downloading devfile "java-maven" from registry "DefaultDevfileRegistry" [949ms]
- ✓ Downloading starter project "springbootproject" [430ms]
+import EmptyDirOutput from './docs-mdx/init/interactive_mode_empty_directory_output.mdx';
+
+
-Your new component "my-java-maven-app" is ready in the current directory.
-To start editing your component, use "odo dev" and open this folder in your favorite IDE.
-Changes will be directly reflected on the cluster.
-To deploy your component to a cluster use "odo deploy".
-```
#### Directory with sources
@@ -67,40 +57,9 @@ odo init
Example
-```console
-$ odo init
- __
- / \__ Initializing a new component
- \__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
- / \__/ odo version: v3.3.0
- \__/
-
-Interactive mode enabled, please answer the following questions:
-Based on the files in the current directory odo detected
-Language: JavaScript
-Project type: Node.js
-Application ports: 3000
-The devfile "nodejs" from the registry "DefaultDevfileRegistry" will be downloaded.
-? Is this correct? Yes
- ✓ Downloading devfile "nodejs" from registry "DefaultDevfileRegistry" [1s]
-
-↪ Container Configuration "runtime":
- OPEN PORTS:
- - 5858
- - 3000
- ENVIRONMENT VARIABLES:
- - DEBUG_PORT = 5858
-
-? Select container for which you want to change configuration? NONE - configuration is correct
-? Enter component name: nodejs
-
-You can automate this command by executing:
- odo init --name nodejs --devfile nodejs --devfile-registry DefaultDevfileRegistry
+import NonEmptyDirectoryOutput from './docs-mdx/init/interactive_mode_directory_with_sources_output.mdx'
-Your new component 'nodejs' is ready in the current directory.
-To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
-Changes will be directly reflected on the cluster.
-```
+
### Non-interactive mode
@@ -119,41 +78,23 @@ The required `--name` flag indicates how the component initialized by this comma
#### Fetch Devfile from any registry of the list
-In this example, the devfile will be downloaded from the **Staging** registry, which is the first one in the list containing the `nodejs-react` devfile.
+In this example, the devfile will be downloaded from the **StagingRegistry** registry, which is the first one in the list containing the `nodejs-react` devfile.
```shell
odo init --name --devfile [--starter STARTER]
```
Example
-```console
-$ odo preference view
-[...]
+
-Devfile registries:
- NAME URL SECURE
- Staging https://registry.stage.devfile.io No
- DefaultDevfileRegistry https://registry.devfile.io No
+import RegistryListOutput from './docs-mdx/init/registry_list_output.mdx'
-$ odo registry --devfile nodejs-react
- NAME REGISTRY DESCRIPTION VERSIONS
- nodejs-react StagingRegistry React is a free and open-source front-en... 2.0.2
- nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2
+
-$ odo init --devfile nodejs-react --name my-nr-app
- __
- / \__ Initializing a new component
- \__/ \
- / \__/ odo version: v3.4.0
- \__/
+import DevfileFromAnyRegistryOutput from './docs-mdx/init/devfile_from_any_registry_output.mdx'
- ✓ Downloading devfile "nodejs-react" [3s]
+
-Your new component 'my-nr-app' is ready in the current directory.
-To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
-Changes will be directly reflected on the cluster.
-
-```
@@ -163,24 +104,14 @@ In this example, the devfile will be downloaded from the **DefaultDevfileRegistr
Example
-```console
-$ odo preference view
-[...]
+import RegistryOutput from './docs-mdx/init/registry_output.mdx'
-Devfile registries:
- NAME URL SECURE
- Staging https://registry.stage.devfile.io No
- DefaultDevfileRegistry https://registry.devfile.io No
+
-$ odo init --name my-spring-app --devfile java-springboot --devfile-registry DefaultDevfileRegistry --starter springbootproject
- ✓ Downloading devfile "java-springboot" from registry "DefaultDevfileRegistry" [980ms]
- ✓ Downloading starter project "springbootproject" [399ms]
+import DevfileFromSpecificRegistryOutput from './docs-mdx/init/devfile_from_specific_registry_output.mdx';
+
+
-Your new component "my-spring-app" is ready in the current directory.
-To start editing your component, use "odo dev" and open this folder in your favorite IDE.
-Changes will be directly reflected on the cluster.
-To deploy your component to a cluster use "odo deploy".
-```
@@ -192,16 +123,10 @@ odo init --devfile-path --name [--starter STARTER]
Example
-```console
-$ odo init --devfile-path https://registry.devfile.io/devfiles/nodejs-angular --name my-nodejs-app --starter nodejs-angular-starter
- ✓ Downloading devfile from "https://registry.devfile.io/devfiles/nodejs-angular" [415ms]
- ✓ Downloading starter project "nodejs-angular-starter" [484ms]
+import DevfileFromURLOutput from './docs-mdx/init/devfile_from_url_output.mdx';
+
+
-Your new component "my-nodejs-app" is ready in the current directory.
-To start editing your component, use "odo dev" and open this folder in your favorite IDE.
-Changes will be directly reflected on the cluster.
-To deploy your component to a cluster use "odo deploy".
-```
#### Fetch Devfile of a specific version
@@ -213,44 +138,21 @@ odo init --devfile --devfile-version --name
Examples
-```console
-$ odo init --devfile go --name my-go-app --devfile-version 2.0.0
- __
- / \__ Initializing a new component
- \__/ \
- / \__/ odo version: v3.4.0
- \__/
+import VersionedOutput from './docs-mdx/init/versioned_devfile_output.mdx';
- ✓ Downloading devfile "go:2.0.0" [4s]
-
-Your new component 'my-go-app' is ready in the current directory.
-To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
-Changes will be directly reflected on the cluster.
-To deploy your component to a cluster use "odo deploy".
-```
+
+import LatestVersionedOutput from './docs-mdx/init/latest_versioned_devfile_output.mdx';
+
:::note
Use "latest" as the version name to fetch the latest version of a given Devfile.
Example
-```console
-$ odo init --devfile go --name my-go-app --devfile-version latest
- __
- / \__ Initializing a new component
- \__/ \
- / \__/ odo version: v3.4.0
- \__/
+
- ✓ Downloading devfile "go:latest" [4s]
-
-Your new component 'my-go-app' is ready in the current directory.
-To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
-Changes will be directly reflected on the cluster.
-To deploy your component to a cluster use "odo deploy".
-```
-:::
\ No newline at end of file
+:::
diff --git a/docs/website/docs/user-guides/advanced/deploy/docs-mdx/dotnet/dotnet_deploy_output.mdx b/docs/website/docs/user-guides/advanced/deploy/docs-mdx/dotnet/dotnet_deploy_output.mdx
index 72d1efe00..872a6b573 100644
--- a/docs/website/docs/user-guides/advanced/deploy/docs-mdx/dotnet/dotnet_deploy_output.mdx
+++ b/docs/website/docs/user-guides/advanced/deploy/docs-mdx/dotnet/dotnet_deploy_output.mdx
@@ -3,7 +3,7 @@ $ odo deploy
__
/ \__ Deploying the application using my-dotnet-app Devfile
\__/ \ Namespace: odo-dev
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
↪ Building & Pushing Container: quay.io/MYUSERNAME/dotnet-odo-example
diff --git a/docs/website/docs/user-guides/advanced/deploy/docs-mdx/go/go_deploy_output.mdx b/docs/website/docs/user-guides/advanced/deploy/docs-mdx/go/go_deploy_output.mdx
index 49ca7e25b..8eb1c8661 100644
--- a/docs/website/docs/user-guides/advanced/deploy/docs-mdx/go/go_deploy_output.mdx
+++ b/docs/website/docs/user-guides/advanced/deploy/docs-mdx/go/go_deploy_output.mdx
@@ -3,7 +3,7 @@ $ odo deploy
__
/ \__ Deploying the application using my-go-app Devfile
\__/ \ Namespace: odo-dev
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
↪ Building & Pushing Container: quay.io/MYUSERNAME/go-odo-example
diff --git a/docs/website/docs/user-guides/advanced/deploy/docs-mdx/java/java_deploy_output.mdx b/docs/website/docs/user-guides/advanced/deploy/docs-mdx/java/java_deploy_output.mdx
index 5054520f3..888d854a9 100644
--- a/docs/website/docs/user-guides/advanced/deploy/docs-mdx/java/java_deploy_output.mdx
+++ b/docs/website/docs/user-guides/advanced/deploy/docs-mdx/java/java_deploy_output.mdx
@@ -3,7 +3,7 @@ $ odo deploy
__
/ \__ Deploying the application using my-java-app Devfile
\__/ \ Namespace: odo-dev
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
↪ Building & Pushing Container: quay.io/MYUSERNAME/java-odo-example
diff --git a/docs/website/docs/user-guides/advanced/deploy/docs-mdx/nodejs/nodejs_deploy_output.mdx b/docs/website/docs/user-guides/advanced/deploy/docs-mdx/nodejs/nodejs_deploy_output.mdx
index e591da347..2a03dae4d 100644
--- a/docs/website/docs/user-guides/advanced/deploy/docs-mdx/nodejs/nodejs_deploy_output.mdx
+++ b/docs/website/docs/user-guides/advanced/deploy/docs-mdx/nodejs/nodejs_deploy_output.mdx
@@ -3,7 +3,7 @@ $ odo deploy
__
/ \__ Deploying the application using my-nodejs-app Devfile
\__/ \ Namespace: odo-dev
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
↪ Building & Pushing Container: quay.io/MYUSERNAME/nodejs-odo-example
diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_dev_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_dev_output.mdx
index 6ad4d8944..e00d563fe 100644
--- a/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_dev_output.mdx
+++ b/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_dev_output.mdx
@@ -3,7 +3,7 @@ $ odo dev
__
/ \__ Developing using the "my-dotnet-app" Devfile
\__/ \ Namespace: odo-dev
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
↪ Deploying to the cluster in developer mode
diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_init_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_init_output.mdx
index 0f3d439c3..865ea8c3a 100644
--- a/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_init_output.mdx
+++ b/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_init_output.mdx
@@ -3,7 +3,7 @@ $ odo init
__
/ \__ Initializing a new component
\__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
Interactive mode enabled, please answer the following questions:
diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_dev_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_dev_output.mdx
index 3849b2b7c..01270b170 100644
--- a/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_dev_output.mdx
+++ b/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_dev_output.mdx
@@ -3,7 +3,7 @@ $ odo dev
__
/ \__ Developing using the "my-go-app" Devfile
\__/ \ Namespace: odo-dev
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
↪ Deploying to the cluster in developer mode
diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_init_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_init_output.mdx
index 709da001b..5e9a87a8c 100644
--- a/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_init_output.mdx
+++ b/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_init_output.mdx
@@ -3,7 +3,7 @@ $ odo init
__
/ \__ Initializing a new component
\__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
Interactive mode enabled, please answer the following questions:
diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_dev_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_dev_output.mdx
index 1c2d78170..82c987728 100644
--- a/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_dev_output.mdx
+++ b/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_dev_output.mdx
@@ -3,7 +3,7 @@ $ odo dev
__
/ \__ Developing using the "my-java-app" Devfile
\__/ \ Namespace: odo-dev
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
↪ Deploying to the cluster in developer mode
diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_init_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_init_output.mdx
index 69604740b..956b667b2 100644
--- a/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_init_output.mdx
+++ b/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_init_output.mdx
@@ -3,7 +3,7 @@ $ odo init
__
/ \__ Initializing a new component
\__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
Interactive mode enabled, please answer the following questions:
diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_dev_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_dev_output.mdx
index 3185bdd39..7f1b72d56 100644
--- a/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_dev_output.mdx
+++ b/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_dev_output.mdx
@@ -3,7 +3,7 @@ $ odo dev
__
/ \__ Developing using the "my-nodejs-app" Devfile
\__/ \ Namespace: odo-dev
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
↪ Deploying to the cluster in developer mode
diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_init_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_init_output.mdx
index 276f86ccc..022434b5d 100644
--- a/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_init_output.mdx
+++ b/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_init_output.mdx
@@ -3,7 +3,7 @@ $ odo init
__
/ \__ Initializing a new component
\__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
- / \__/ odo version: v3.4.0
+ / \__/ odo version: v3.5.0
\__/
Interactive mode enabled, please answer the following questions:
diff --git a/docs/website/docusaurus.config.js b/docs/website/docusaurus.config.js
index f17c28f02..19c6285f0 100644
--- a/docs/website/docusaurus.config.js
+++ b/docs/website/docusaurus.config.js
@@ -134,6 +134,13 @@ module.exports = {
breadcrumbs: true,
sidebarCollapsible: true,
lastVersion: 'current',
+ exclude: [
+ '**/docs-mdx/**',
+ '**/_*.{js,jsx,ts,tsx,md,mdx}',
+ '**/_*/**',
+ '**/*.test.{js,jsx,ts,tsx}',
+ '**/__tests__/**'
+ ],
versions: {
current: {
label: 'v3',
diff --git a/tests/documentation/command-reference/doc_command_reference_init_test.go b/tests/documentation/command-reference/doc_command_reference_init_test.go
new file mode 100644
index 000000000..443a98db3
--- /dev/null
+++ b/tests/documentation/command-reference/doc_command_reference_init_test.go
@@ -0,0 +1,207 @@
+package docautomation
+
+import (
+ "fmt"
+ "path/filepath"
+ "strings"
+
+ "github.com/google/go-cmp/cmp"
+ . "github.com/onsi/ginkgo/v2"
+ . "github.com/onsi/gomega"
+
+ "github.com/redhat-developer/odo/tests/helper"
+)
+
+var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster), func() {
+ var commonVar helper.CommonVar
+ var commonPath = filepath.Join("command-reference", "docs-mdx", "init")
+ var outputStringFormat = "```console\n$ odo %s\n%s```\n"
+
+ BeforeEach(func() {
+ commonVar = helper.CommonBeforeEach()
+ helper.Chdir(commonVar.Context)
+ Expect(helper.VerifyFileExists(".odo/env/env.yaml")).To(BeFalse())
+ })
+
+ AfterEach(func() {
+ helper.CommonAfterEach(commonVar)
+ })
+ // interactive tests do not provide the same output every time,
+ // so we'll skip these tests until we have more coverage and then investigate a better way to test this
+ Context("Interactive Mode", func() {
+ It("Empty directory", func() {
+ args := []string{"odo", "init"}
+ out, err := helper.RunInteractive(args, []string{"ODO_LOG_LEVEL=0"}, func(ctx helper.InteractiveContext) {
+ helper.ExpectString(ctx, "Select language")
+ helper.SendLine(ctx, "Java")
+
+ helper.ExpectString(ctx, "Select project type")
+ helper.SendLine(ctx, "")
+
+ helper.ExpectString(ctx, "Select container for which you want to change configuration?")
+ helper.SendLine(ctx, "")
+
+ helper.ExpectString(ctx, "Which starter project do you want to use")
+ helper.SendLine(ctx, "")
+
+ helper.ExpectString(ctx, "Enter component name")
+ helper.SendLine(ctx, "my-java-maven-app")
+
+ helper.ExpectString(ctx, "Changes will be directly reflected on the cluster.")
+ })
+ Expect(err).To(BeNil())
+ got := helper.StripAnsi(out)
+ got = helper.StripInteractiveQuestion(got)
+ got = fmt.Sprintf(outputStringFormat, args[1], helper.StripSpinner(got))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "interactive_mode_empty_directory_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+
+ When("the directory is not empty", func() {
+ BeforeEach(func() {
+ helper.CopyExample(filepath.Join("source", "nodejs"), commonVar.Context)
+ })
+
+ It("Directory with sources", func() {
+ args := []string{"odo", "init"}
+ out, err := helper.RunInteractive(args, []string{"ODO_LOG_LEVEL=0"}, func(ctx helper.InteractiveContext) {
+ helper.ExpectString(ctx, "Is this correct?")
+ helper.SendLine(ctx, "")
+
+ helper.ExpectString(ctx, "✓ Downloading devfile \"nodejs:2.1.1\" from registry \"DefaultDevfileRegistry\"")
+
+ helper.ExpectString(ctx, "Select container for which you want to change configuration?")
+ helper.SendLine(ctx, "")
+
+ helper.ExpectString(ctx, "Enter component name")
+ helper.SendLine(ctx, "")
+
+ helper.ExpectString(ctx, "Changes will be directly reflected on the cluster.")
+ })
+ Expect(err).To(BeNil())
+ got := helper.StripAnsi(out)
+ got = helper.StripInteractiveQuestion(got)
+ got = fmt.Sprintf(outputStringFormat, args[1], helper.StripSpinner(got))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "interactive_mode_directory_with_sources_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+ })
+ })
+ Context("Non Interactive Mode", func() {
+
+ It("Fetch Devfile of a specific version", func() {
+ args := []string{"init", "--devfile", "go", "--name", "my-go-app", "--devfile-version", "2.0.0"}
+ out := helper.Cmd("odo", args...).ShouldPass().Out()
+ got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "versioned_devfile_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+
+ It("Fetch Devfile of the latest version", func() {
+ args := []string{"init", "--devfile", "go", "--name", "my-go-app", "--devfile-version", "latest"}
+ out := helper.Cmd("odo", args...).ShouldPass().Out()
+ got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "latest_versioned_devfile_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+
+ It("Fetch Devfile from a URL", func() {
+ args := []string{"init", "--devfile-path", "https://registry.devfile.io/devfiles/nodejs-angular", "--name", "my-nodejs-app", "--starter", "nodejs-angular-starter"}
+ out := helper.Cmd("odo", args...).ShouldPass().Out()
+ got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "devfile_from_url_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+
+ Context("fetching devfile from a registry", func() {
+ When("setting up the registry", func() {
+ const (
+ defaultReg = "DefaultDevfileRegistry"
+ defaultRegURL = "https://registry.devfile.io"
+ stagingReg = "StagingRegistry"
+ stagingRegURL = "https://registry.stage.devfile.io"
+ )
+ BeforeEach(func() {
+ helper.Cmd("odo", "preference", "remove", "registry", defaultReg, "-f").ShouldPass()
+ helper.Cmd("odo", "preference", "add", "registry", defaultReg, defaultRegURL).ShouldPass()
+
+ helper.Cmd("odo", "preference", "add", "registry", stagingReg, stagingRegURL).ShouldPass()
+ })
+
+ AfterEach(func() {
+ helper.Cmd("odo", "preference", "remove", "registry", stagingReg, "-f").ShouldPass()
+ helper.SetDefaultDevfileRegistryAsStaging()
+ })
+
+ removePreferenceKeys := func(docString string) string {
+ return "[...]\n\n" + docString[strings.Index(docString, "Devfile registries"):]
+ }
+ checkRegistriesOutput := func() {
+ args := []string{"preference", "view"}
+ out := helper.Cmd("odo", args...).ShouldPass().Out()
+ got := helper.StripAnsi(out)
+ got = removePreferenceKeys(got)
+ got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "registry_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ }
+
+ It("Fetch Devfile from a specific registry of the list", func() {
+ By("checking for required registries", func() {
+ checkRegistriesOutput()
+ })
+
+ By("checking for the init output", func() {
+ args := []string{"init", "--name", "my-spring-app", "--devfile", "java-springboot", "--devfile-registry", "DefaultDevfileRegistry", "--starter", "springbootproject"}
+ out := helper.Cmd("odo", args...).ShouldPass().Out()
+ got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "devfile_from_specific_registry_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+ })
+ It("Fetch Devfile from any registry of the list", func() {
+ By("checking for required registries", func() {
+ checkRegistriesOutput()
+ })
+
+ By("checking for the registry list output", func() {
+ args := []string{"registry", "--devfile", "nodejs-react"}
+ out := helper.Cmd("odo", args...).ShouldPass().Out()
+ got := helper.StripAnsi(out)
+ got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "registry_list_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+
+ By("checking for the init output", func() {
+ args := []string{"init", "--devfile", "nodejs-react", "--name", "my-nr-app"}
+ out := helper.Cmd("odo", args...).ShouldPass().Out()
+ got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "devfile_from_any_registry_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+ })
+
+ })
+ })
+
+ It("Fetch Devfile from a URL", func() {
+ args := []string{"init", "--devfile-path", "https://registry.devfile.io/devfiles/nodejs-angular", "--name", "my-nodejs-app", "--starter", "nodejs-angular-starter"}
+ out := helper.Cmd("odo", args...).ShouldPass().Out()
+ got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
+ want := helper.GetMDXContent(filepath.Join(commonPath, "devfile_from_url_output.mdx"))
+ diff := cmp.Diff(want, got)
+ Expect(diff).To(BeEmpty())
+ })
+ })
+
+})
diff --git a/tests/documentation/command-reference/doc_command_reference_suite_test.go b/tests/documentation/command-reference/doc_command_reference_suite_test.go
new file mode 100644
index 000000000..139b6db69
--- /dev/null
+++ b/tests/documentation/command-reference/doc_command_reference_suite_test.go
@@ -0,0 +1,11 @@
+package docautomation
+
+import (
+ "testing"
+
+ "github.com/redhat-developer/odo/tests/helper"
+)
+
+func TestDocCommandReferenceAutomation(t *testing.T) {
+ helper.RunTestSpecs(t, "Doc Command Reference Automation Suite")
+}
diff --git a/tests/helper/helper_documentation.go b/tests/helper/helper_documentation.go
new file mode 100644
index 000000000..406ce56eb
--- /dev/null
+++ b/tests/helper/helper_documentation.go
@@ -0,0 +1,108 @@
+package helper
+
+import (
+ "bufio"
+ "os"
+ "path/filepath"
+ "regexp"
+ "runtime"
+ "strings"
+ "unicode"
+
+ . "github.com/onsi/gomega"
+)
+
+const (
+ timePatternInOdo = `(\[[0-9smh]+\])` // e.g. [4s], [1m], [3ms]
+ staticTimeValue = "[1s]"
+ // Credit: https://github.com/acarl005/stripansi/blob/master/stripansi.go
+ ansiPattern = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
+ unicodeSpinnerFrames = "◓◐◑◒"
+)
+
+// ReplaceAllTimeInString replaces the time taken to download a Devfile or a starter project for an odo command with a custom value;
+// this function is helpful because the time value is variable and replacing it with the value in mdx content helps in comparing.
+func ReplaceAllTimeInString(docString string, timeString string) string {
+ reg := regexp.MustCompile(timePatternInOdo)
+ return reg.ReplaceAllString(docString, timeString)
+}
+
+// StripSpinner strips the cmd out string of spaces, spinner statements and spinner frames
+func StripSpinner(docString string) (returnString string) {
+ for _, line := range strings.Split(docString, "\n") {
+ // trim any special character present in the line
+ line = strings.TrimFunc(line, unicode.IsSpace)
+ // This check is to avoid spinner statements in the cmd output
+ // currently it does so for init and dev
+ // e.g. " • Syncing file changes ..."
+ if (strings.HasPrefix(line, "• Downloading") || strings.HasPrefix(line, "• Syncing") || strings.HasPrefix(line, "• Building")) && strings.HasSuffix(line, "...") {
+ continue
+ }
+
+ // for some reason, splitting the docString by \n does not split the spinner frames,
+ // so we perform a side operation to remove the extra spinner frames that are not present in the final output
+ // e.g. "◐ Downloading devfile "java-maven" from registry "DefaultDevfileReg... \n ◓ Downloading devfile "java-maven" from registry "DefaultDevfileReg...\n\n [32m✓[0m Downloading devfile "java-maven" from registry "DefaultDevfileRegistry" [2s]"
+ if strings.ContainsAny(line, unicodeSpinnerFrames) {
+ line = "✓" + strings.SplitAfter(line, "✓")[1]
+ }
+
+ returnString += line + "\n"
+ }
+ // replace all instances of time to [1s], this is also done for mdx out
+ returnString = ReplaceAllTimeInString(returnString, staticTimeValue)
+ return
+}
+
+// GetMDXContent reads the content of MDX files, strips it of extra spaces and returns the string
+// it strips the extra space for an easy comparison
+func GetMDXContent(filePath string) (mdxContent string) {
+ // filename of this file
+ _, filename, _, _ := runtime.Caller(0)
+ // path to the docs directory
+ mdxDir := filepath.Join(filepath.Dir(filename), "..", "..", "docs", "website", "docs")
+
+ readFile, err := os.Open(filepath.Join(mdxDir, filePath))
+ defer func(err error) {
+ if err == nil {
+ readFile.Close()
+ }
+ }(err)
+ Expect(err).ToNot(HaveOccurred())
+
+ fileScanner := bufio.NewScanner(readFile)
+
+ fileScanner.Split(bufio.ScanLines)
+
+ for fileScanner.Scan() {
+ line := fileScanner.Text()
+ line = strings.TrimFunc(line, unicode.IsSpace)
+ mdxContent += line + "\n"
+ }
+
+ // replace all instances of time to [1s], this is also done for cmd out
+ mdxContent = ReplaceAllTimeInString(mdxContent, staticTimeValue)
+ return
+}
+
+// StripAnsi strips the cmd out of ansi values used for fomatting(underline, colored line, etc.) the cmd out;
+// this function should be called before StripSpinner for better results
+// and is essential because mdx content does not support ansi
+// The regex used by this function is copied from https://github.com/acarl005/stripansi/
+func StripAnsi(docString string) (returnString string) {
+ reg, err := regexp.Compile(ansiPattern)
+ Expect(err).To(BeNil())
+ returnString = reg.ReplaceAllString(docString, "")
+ return
+}
+
+// StripInteractiveQuestion strips the extra output from interactive questions, leaving the final output
+// e.g. "? Is this correct? (Y/n) No? Is this correct? No"
+func StripInteractiveQuestion(docString string) (returnString string) {
+ returnString = docString
+ for _, question := range []string{"? Select language:", "? Select project type:", "? Select container for which you want to change configuration?", "? Is this correct?", "? Enter component name:", "? Which starter project do you want to use?"} {
+ if strings.Count(returnString, question) > 1 {
+ returnString = returnString[:strings.Index(returnString, question)] + returnString[strings.LastIndex(returnString, question):]
+ }
+ }
+ return
+}
diff --git a/tests/helper/helper_interactive.go b/tests/helper/helper_interactive.go
index da3110c3b..422c72715 100644
--- a/tests/helper/helper_interactive.go
+++ b/tests/helper/helper_interactive.go
@@ -16,7 +16,7 @@ import (
// InteractiveContext represents the context of an interactive command to be run.
type InteractiveContext struct {
- //Command represents the original command ran
+ // Command represents the original command ran
Command []string
// cp is the internal interface used by the interactive command