Skip to content

Commit

Permalink
Merge ff4083c into d6371a4
Browse files Browse the repository at this point in the history
  • Loading branch information
rm3l authored Dec 5, 2022
2 parents d6371a4 + ff4083c commit 0208931
Show file tree
Hide file tree
Showing 611 changed files with 36,283 additions and 37,372 deletions.
2 changes: 2 additions & 0 deletions .wwhrd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ exceptions:
- sigs.k8s.io/yaml/...
# MIT licence - wwhrd is not detecting it correctly
- github.com/ActiveState/vt10x
# This is an indirect dependency. License seems to be missing from release package. See https://github.com/acomagu/bufpipe/issues/8
- github.com/acomagu/bufpipe
67 changes: 64 additions & 3 deletions docs/website/docs/command-reference/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ title: odo init
The `odo init` command is the first command to be executed when you want to bootstrap a new component, using `odo`. If sources already exist,
the command `odo dev` should be considered instead.

This command must be executed from an empty directory, and as a result, the command will download a `devfile.yaml` file and, optionally, a starter project.
This command must be executed from a directory with no `devfile.yaml` file.

The command can be executed in two flavors, either interactive or non-interactive.

## Running the command
### Interactive mode

In interactive mode, you will be guided to:
In interactive mode, the behavior of `odo init` depends on whether the current directory already contains source code or not.

#### Empty directory

If the directory is empty, you will be guided to:
- choose a devfile from the list of devfiles present in the registry or registries referenced (using the `odo registry` command),
- configure the devfile if there is an existing project
- configure the devfile
- choose a starter project referenced by the selected devfile,
- choose a name for the component present in the devfile; this name must follow the [Kubernetes naming convention](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names) and not be all-numeric.

Expand All @@ -41,6 +45,63 @@ To deploy your component to a cluster use "odo deploy".
```
</details>

#### Directory with sources

If the current directory is not empty, `odo init` will make its best to autodetect the type of application and propose you a Devfile that should suit your project.
It will try to detect the following, based on the files in the current directory:
- Language
- Project Type
- Ports used in your application
- A Devfile that should help you start with `odo`

If the information detected does not seem correct to you, you are able to select a different Devfile.

In all cases, you will be guided to:
- configure the devfile
- choose a name for the component present in the devfile; this name must follow the [Kubernetes naming convention](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names) and not be all-numeric.

```console
odo init
```

<details>
<summary>Example</summary>

```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

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.
```
</details>

### Non-interactive mode

Expand Down
28 changes: 17 additions & 11 deletions docs/website/docs/command-reference/json-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ The structures used to return information using JSON output are defined in [the

## odo analyze -o json

The `analyze` command analyzes the files in the current directory to select the best devfiles to use,
from the devfiles in the registries defined in the list of preferred registries with the command `odo preference view`.
The `analyze` command analyzes the files in the current directory and returns the following information:
- the best devfiles to use, from the devfiles in the registries defined in the list of preferred registries with the command `odo preference view`
- the ports used in the application, if that was possible to determine.

The output of this command contains a list of devfile name and registry name:

Expand All @@ -31,14 +32,18 @@ odo analyze -o json
[
{
"devfile": "nodejs",
"devfileRegistry": "DefaultDevfileRegistry"
"devfileRegistry": "DefaultDevfileRegistry",
"ports": [
3000
]
}
]
```
```console
echo $?
```
```console

The exit code should be zero in this case:

```bash
$ echo $?
0
```

Expand All @@ -52,10 +57,11 @@ odo analyze -o json
"message": "No valid devfile found for project in /home/user/my/empty/directory"
}
```
```console
echo $?
```
```console

The command should terminate with a non-zero exit code:

```bash
$ echo $?
1
```

Expand Down
3 changes: 2 additions & 1 deletion docs/website/docs/user-guides/quickstart/_creating_app.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Interactive mode enabled, please answer the following questions:
Based on the files in the current directory odo detected
Language: `}{props.language}{`
Project type: `}{props.name}{`
The devfile "nodejs" from the registry "DefaultDevfileRegistry" will be downloaded.
Application ports: `}{props.port}{`
The devfile "`}{props.name}{`" from the registry "DefaultDevfileRegistry" will be downloaded.
? Is this correct? Yes
✓ Downloading devfile "`}{props.name}{`" from registry "DefaultDevfileRegistry" [501ms]
Current component configuration:
Expand Down
29 changes: 15 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/frapposelli/wwhrd v0.4.0
github.com/fsnotify/fsnotify v1.5.1
github.com/ghodss/yaml v1.0.0
github.com/go-git/go-git/v5 v5.3.0
github.com/go-git/go-git/v5 v5.4.2
github.com/go-openapi/jsonpointer v0.19.5
github.com/go-openapi/jsonreference v0.19.5
github.com/go-openapi/spec v0.19.5
Expand All @@ -36,14 +36,14 @@ require (
github.com/operator-framework/operator-lifecycle-manager v0.21.2
github.com/pborman/uuid v1.2.1
github.com/posener/complete v1.2.3
github.com/redhat-developer/alizer/go v0.0.0-20220714080930-59b004fd4586
github.com/redhat-developer/alizer/go v0.0.0-20221122130008-7537ec85637d
github.com/redhat-developer/service-binding-operator v1.0.1-0.20211222115357-5b7bbba3bfb3
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/securego/gosec/v2 v2.14.0
github.com/segmentio/backo-go v1.0.1-0.20200129164019-23eae7c10bd3
github.com/sethvargo/go-envconfig v0.8.2
github.com/spf13/afero v1.6.0
github.com/spf13/cobra v1.4.0
github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5
github.com/tidwall/gjson v1.14.1
github.com/zalando/go-keyring v0.2.1
Expand Down Expand Up @@ -79,25 +79,26 @@ require (
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/Microsoft/hcsshim v0.8.20 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/RangelReale/osincli v0.0.0-20160924135400-fababb0555f2 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/alexbrainman/sspi v0.0.0-20180613141037-e580b900e9f5 // indirect
github.com/apcera/gssapi v0.0.0-00010101000000-000000000000 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect
github.com/containerd/cgroups v1.0.1 // indirect
github.com/containerd/containerd v1.5.2 // indirect
github.com/containerd/containerd v1.6.3-0.20220401172941-5ff8fce1fcc6 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/creack/pty v1.1.17 // indirect
github.com/danieljoos/wincred v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/docker v20.10.3+incompatible // indirect
github.com/docker/docker v20.10.7+incompatible // indirect
github.com/emicklei/dot v0.15.0 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/emirpasic/gods v1.12.0 // indirect
Expand All @@ -106,7 +107,7 @@ require (
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.1.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
Expand All @@ -124,7 +125,7 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/gookit/color v1.5.2 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-version v1.4.0 // indirect
github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02 // indirect
Expand All @@ -136,7 +137,7 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/klauspost/compress v1.11.13 // indirect
github.com/klauspost/compress v1.15.1 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.6 // indirect
Expand All @@ -147,6 +148,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.1 // indirect
github.com/moby/buildkit v0.10.3 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
Expand All @@ -156,7 +158,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
github.com/openshift/library-go v0.0.0-20220210170159-18f172cff934 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand All @@ -178,7 +180,6 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
go.opencensus.io v0.23.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.0.0-20221012134737-56aed061732a // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
Expand All @@ -189,7 +190,7 @@ require (
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/grpc v1.40.0 // indirect
google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
Expand Down
Loading

0 comments on commit 0208931

Please sign in to comment.