Commit Graph

1771 Commits

Author SHA1 Message Date
Armel Soro
0f2103e7d7 Recognize devfile.yml and .devfile.yml as Devfiles (#7130) 2023-12-01 12:10:19 +01:00
Armel Soro
5d4a6ef325 Use staging Devfile registry for PR tests (#7129)
* Revert using a DEVFILE_PROXY env var

There is no proxy deployed in the internal test cluster.
As such, this env var no longer makes sense.

* To help troubleshoot, display the resolved Devfile registry URL

* Make interactive tests more resilient with stack versions

They are now able to determine if the "Select version" prompt
should be asked by "odo init" or not:

* Make sure doc automation tests do not rely on hard-coded namespaces

* Allow to run doc automation tests with more parallel Ginkgo nodes

This is possible now that those tests no longer
depend on a single hard-coded namespace.

* Remove occurrences of the DEVFILE_REGISTRY env var in IBM Pipelines scripts

* Reuse logic for determining the Devfile Registry URL in "odo registry" tests

* Clarify what openshiftci-config.sh is used for
2023-10-27 07:54:14 +00:00
dependabot[bot]
d77ca3e95a Go: Bump github.com/devfile/alizer from 1.0.1 to 1.2.1 (#7126)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Armel Soro <asoro@redhat.com>
2023-10-23 18:09:52 +02:00
Philippe Martin
1f2214c08c [ui] Fix Default command checkbox (#7104)
* [ui] Fix Default command checkbox

* Regenerate static ui files
2023-10-02 10:22:38 -04:00
Philippe Martin
10b5e8a8f5 Bump to v3.15.0 (#7096) 2023-09-26 03:39:55 -04:00
Armel Soro
d34fbaed1a Make warning messages more visible (#7097)
* Wrap warning messages to make them more visible

For example, instead of displaying:
```
⚠  You are using "default" project, odo may not work as expected in the default project.
```

We are now displaying:
```
========================================================================================
⚠  You are using "default" project, odo may not work as expected in the default project.
========================================================================================
```

* Display warning message about default project/namespace in a single block

* Add unit test

* Fix sample outputs for doc automation tests

* Revert "Fix sample outputs for doc automation tests"

This reverts commit 98a6554c34.

* Ignore '===' warning header and footer for doc automation tests
2023-09-26 02:53:45 -04:00
Eng Zer Jun
0959b56285 Replace github.com/ghodss/yaml with sigs.k8s.io/yaml (#7005)
At the time of making this commit, the package `github.com/ghodss/yaml`
is no longer actively maintained.

`sigs.k8s.io/yaml` is a permanent fork of `ghodss/yaml` and is actively
maintained by Kubernetes SIG.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-09-22 06:23:09 -04:00
Philippe Martin
0f828ec99f Ignore devstate when existing process name is not odo + delete devstate files with odo delete component (#7090)
* Ignore devstate when existing process name is not odo

* Delete orphan devstate files with odo delete component

* Update unit tests

* Create fake system

* Add unit tests for odo delete component

* Integration tests for odo dev

* Troubleshooting

* First process on Windows is 4

* Use go-ps lib for pidExists
2023-09-20 14:20:53 +02:00
Armel Soro
1ab0178cef Make sure a Deploy command is present in the Devfile before auto-applying components (#7093)
* Add integration test case highlighting the issue

* Make sure a Deploy command is present in the Devfile before auto-applying components

* Fix expected output in 'odo deploy' interactive tests
2023-09-20 14:06:56 +02:00
Armel Soro
9724292dfa [UI] Allow single item deletion from multi-value fields (#7084)
* Support single endpoint deletion from multi-endpoints component

* Support single command deletion from multi-commands component

* Support single key-value item deletion from multi-key-value component

* Support single text item deletion from multi-text component

* Support single volume mount item deletion from multi-volume-mounts component

* Add Cypress test cases

* Git-ignore Cypress screenshots folder

* Generate static UI

* Update Delete icon and add tooltip to it

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Move the "delete endpoint" button closer to the element it is attached to

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Generate static UI

* Revert "Move the "delete endpoint" button closer to the element it is attached to"

This reverts commit 4bf895f272.

* Move the "delete endpoint" buttons closer to the elements they are attached to

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Generate static UI

---------

Co-authored-by: Philippe Martin <phmartin@redhat.com>
2023-09-18 10:17:32 +02:00
Armel Soro
0deb3de931 Fix API Server panic when volume component has no ephemeral field set (#7080)
* Add unit test highlighting the issue

* Safely dereference volume component 'ephemeral' field
2023-09-09 00:18:05 +02:00
Philippe Martin
bfffaa8879 Display icon in metadata (#7078)
* Display metadata icon

* UI static files
2023-09-08 14:45:21 +02:00
Philippe Martin
1d96115c45 [ui] Edit container (#7077)
* [api] patch container

* [ui] edit container

* [ui] Initialize endpoint component

* e2e tests

* static ui files
2023-09-08 11:48:53 +02:00
Philippe Martin
56b868d16c [ui] Update commands (#7073)
* [api] patch exec command

* Common changes for all command types

* [ui] edit exec command

* [api] patch Apply Command

* [ui] edit apply command

* [ui] Update image command

* [api] update composite command

* [ui] Update composite command

* [uui] Make select-container component not valid when (new ...) is selected

* [ui] e2e tests

* static ui files
2023-09-07 10:58:16 +02:00
Armel Soro
00d39889b7 Make sure to run parallel commands part of a composite command in parallel (#7075)
* Make sure to run parallel commands part of a composite command in parallel

* Display warnings in case there are errors when executing pre-stop events

* Fix the command_composite_parallel.go implementation by lowering the case of the sub-command names

Since this passed the Devfile validation logic, we should use the same logic as in command_composite.go
2023-09-06 21:15:01 +02:00
Armel Soro
725a64014a Display Git commit ID in output of odo commands where the version is shown (#7074)
* Display Git commit ID in output of odo commands where the version is displayed

This covers:
- odo init
- odo dev
- odo deploy

Displaying the commit ID (same as in `odo version`) will help quickly pinpoint the exact commit without having to run `odo version`.

See #6131 for more context

* Append the state of the working tree next to the Git commit ID

`git describe` is much more helpful to quickly understand the state of the working tree.

For backward compatibility, we are defaulting to `git rev-parse`,
just in case `git describe` does not work correctly.

* Fix integration tests

* Fix doc automation tests

Strip the Git commit ID from the full odo version string
prior to comparing the outputs.
We still want to compare the tag displayed.
2023-09-06 20:36:13 +02:00
Armel Soro
adc96994d9 [UI] Make sure form validation displays non-valid fields as red in all forms (#7064)
* Add validation to multi-container component

This covers the following forms:
- Add commands when adding a Composite Command

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Add validation to multi-key-value component

This covers the following forms:
- Add Environment variables in Create Container
- Add Deployment annotations in Create Container
- Add Service annotations in Create Container

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Add validation to multi-text component

This covers the following forms:
- Add Command in Create Container
- Add Args in Create Container
- Add Args in Create Image

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Add validation to select-container component

This covers the following forms:
- Select or Create container in Add Exec Command
- Select or create image component in Add Image Command
- Select or create Resource in Add Apply command

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Add validation to volume-mounts component

This covers the following forms:
- Select or Create volume mount in Create container

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Add error helper message for invalid volume size quantities

* Fix Cypress tests

* Generate static UI

* fixup! Add error helper message for invalid volume size quantities

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Generate static UI

---------

Co-authored-by: Philippe Martin <phmartin@redhat.com>
2023-09-05 17:14:37 +02:00
Philippe Martin
3f93ac0744 Warning if version of Devfile is different from 2.2.0 (#7065)
* Warning if version of Devfile is different from 2.2.0

* Fix unit tests
2023-09-05 11:30:51 +02:00
Philippe Martin
a65812143c Add a Devfile dependency for commands (#7063)
* Define Devfile dependency for commands

* Remove MarkDevfileNotNeeded

* More commands not using Devfile

* Tests with invalid devfiles
2023-09-04 18:12:34 +02:00
Philippe Martin
03c109a6e2 [ui] Fix Resource URI button not checked (#7070)
* [u] Fix Resource URI button not checked

* Generate static UI

---------

Co-authored-by: Armel Soro <asoro@redhat.com>
2023-09-04 17:21:31 +02:00
Philippe Martin
8051843d89 [ui] Edit images (#7068)
* [api] Update Image

* [ui] edit images

* static ui files
2023-09-04 15:48:06 +02:00
Philippe Martin
cb8494387d [ui] Edit resources (#7062)
* [ui] Edit Resource

* Add deployByDefault
2023-09-01 16:12:07 +02:00
Philippe Martin
e9dbded83b [ui] Set AutoBuild and DeployByDefault (#7051)
* Get and display autoBuild / deployByDefault

* Set autoBuild / deployByDefault

* Update ui static files

* [api] Add orpahn field to Image/Resource

* Display more info about Build / Deploy at startup

* Update ui static files

* e2e tests

* Update ui static files

* Fix unit tests

* 3-states button for AutoBuild

* 3-states button for DeployByDefault

* static ui files
2023-09-01 10:18:49 +02:00
Philippe Martin
7ff38b7965 [ui] Edit volumes (#7061)
* Update volumes

* Proxy use ipv4

* Static ui files

* e2e tests
2023-08-31 10:49:27 +02:00
Philippe Martin
e59cfa8852 [ui] Complete container creation (#7035)
* API returns more info about container

* Display more info about containers

* Update UI static files

* Fix unit tests

* Get/Set sources configuration

* [ui] create container with sources mount configuration

* e2e tests + ui static files

* Set containers's envvars

* Regenerate UI static files

* Add Annotation to POST /container

* [api] Create Container with Annotations

* [ui] Annotations when creating container

* Regenerate UI static files

* [api] Endpoints when adding container

* [ui] Endpoints when adding container

* Regenerate UI static files
2023-08-29 09:28:03 +02:00
Armel Soro
a9492307d7 Make sure to API Server listens on 127.0.0.1 (#7041)
This ensures the same local address is used for listening and checking if a given port is free.
Otherwise, `net.listen("tcp", ":$port")` would listen on `0.0.0.0:$port`,
and, on some operating systems like Windows 11, `127.0.0.1:$port` is surprisingly considered as free
(see output below). This, as a consequence, made it impossible to run multiple Dev Sessions on Windows.

```
PS C:\Users\asoro> netstat -aon | grep 2000
  TCP    0.0.0.0:20000          0.0.0.0:0              LISTENING       11044
  TCP    127.0.0.1:20001        0.0.0.0:0              LISTENING       11044
  TCP    [::]:20000             [::]:0                 LISTENING       11044
  TCP    [::1]:20000            [::1]:53656            ESTABLISHED     11044
  TCP    [::1]:53656            [::1]:20000            ESTABLISHED     9984
```

Using the same local address for listening and checking if the port is free would be safer.
If we decide to support passing a custom address, we would use that address instead.
2023-08-28 15:49:56 +02:00
dependabot[bot]
319adfa724 Go: Bump github.com/securego/gosec/v2 from 2.15.0 to 2.17.0 (#7033)
* Go: Bump github.com/securego/gosec/v2 from 2.15.0 to 2.17.0

Bumps [github.com/securego/gosec/v2](https://github.com/securego/gosec) from 2.15.0 to 2.17.0.
- [Release notes](https://github.com/securego/gosec/releases)
- [Changelog](https://github.com/securego/gosec/blob/master/.goreleaser.yml)
- [Commits](https://github.com/securego/gosec/compare/v2.15.0...v2.17.0)

---
updated-dependencies:
- dependency-name: github.com/securego/gosec/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Go: Bump github.com/securego/gosec/v2 from 2.15.0 to 2.17.0

Bumps [github.com/securego/gosec/v2](https://github.com/securego/gosec) from 2.15.0 to 2.17.0.
- [Release notes](https://github.com/securego/gosec/releases)
- [Changelog](https://github.com/securego/gosec/blob/master/.goreleaser.yml)
- [Commits](https://github.com/securego/gosec/compare/v2.15.0...v2.17.0)

---
updated-dependencies:
- dependency-name: github.com/securego/gosec/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Ignore gosec error

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
2023-08-28 15:18:08 +02:00
Armel Soro
471928fead Bump version to 3.14.0 (#7038) 2023-08-22 11:38:04 -02:30
Philippe Martin
edf0bf38d4 [ui] Create/Delete volumes (#7029)
* [api/devstate] Add volumes to Devfile content

* Add Volume related endpoints to API

* Create/Delete volumes from the Volumes Tab

* Update UI static files

* API Devstate returns VolumeMounts

* Display volume mounts in containers

* [api] Add VolumeMounts to containers

* [ui] Define container's volume mounts

* [ui] e2e  tests

* Update UI static files

* [ui] create volumes from container / exec command creation

* Update UI static files

* Update container display

* Update UI static files

* Regenerate UI static files
2023-08-21 13:32:55 -02:30
Philippe Martin
fcc1cd880d [ui] Fix Add/Remove events (#7027)
* Fix add/remove events UI

* Update ui static files
2023-08-21 10:00:39 -02:30
Philippe Martin
51c079c83a Do not set Memory limit on podman when cgroup is v1 (#7028) 2023-08-21 09:26:03 -02:30
Philippe Martin
b93a75c11a Move UI out of experimental mode (#7012)
* Make UI not experimental

* Display API and UI URLs

* Remove link to old sources

* Fix integration tests

* Add UI to Usage Data

* Add a "Using the GUI to edit the Devfile" page to doc

* Add link to odo.dev specific page

* Apply suggestions from code review

Co-authored-by: Armel Soro <armel@rm3l.org>

* Change favicon with odo logo

* Display web console URL as part of the Dev status

* Update UI static files

* Document that Comments not supported

* Add UI screenshots

---------

Co-authored-by: Armel Soro <armel@rm3l.org>
2023-08-04 13:02:34 +02:00
Philippe Martin
7c976f1bf1 Remove kubeconfig flag (#7017)
* Remove kubeconfig flag

* Do not check file exists from KUBECONFIG, as KUBECONFIG can be a list of files and this is done by clientcmd library

* Fix odo --help

* Add integration test to check flag is not supported
2023-08-04 11:52:19 +02:00
Philippe Martin
84bfb227c8 Set Save button on top, enable it only when devfile changed (#7015)
* Set Save button on top, enable it only when devfile changed

* Use snackbar to display parse errors

* Do not alert devfile modified when user clicks Save

* Update UI static files
2023-08-03 14:51:46 +02:00
Philippe Martin
4361b9f39a Makes stopped command terminate normally (#7011) 2023-08-02 14:44:04 +02:00
Philippe Martin
d41364e68e odo init filters devfile stacks by supported architectures (#7004)
* Add --architecture flag

* Ask architecture during interactive mode

* Display architectures of detected Devfile

* Fix integration tests

* Fix automated doc

* Fix e2e tests

* Ignore empty lines on doc automation tests

* Update pkg/odo/cli/registry/registry.go

Co-authored-by: Armel Soro <armel@rm3l.org>

* Fix Architectures field in API

* Change "select architectures" prompt

---------

Co-authored-by: Armel Soro <armel@rm3l.org>
2023-08-01 19:36:48 +02:00
Philippe Martin
3cb1f5c66c Fix podman version check (#7010)
* Fix podman version check

* Try to decode podman version output even if command not finished

* Return timeout error if any and decode error
2023-08-01 16:07:41 +02:00
Philippe Martin
49e38f553e Do not display API logs (#7008)
* Do not regenerate apiserver-gen/go/routers.go

* Regenerate after changes done in pr#6989

* Do not regenerate apiserver-gen/go/logger.go

* Change logs

* Fix comments
2023-08-01 11:58:18 +02:00
Philippe Martin
0d1cf6e365 Bump to version 3.13.0 (#7000) 2023-07-24 10:52:16 +02:00
Philippe Martin
fdafabe617 Alert user when Devfile is synced (#6996)
* Alert user when Devfile is synced

* Update UI static files

* Fix UI e2e test
2023-07-21 13:39:46 +02:00
Philippe Martin
9605c92ede Remove API Server from experimental mode, set UI Server as experimental (#6985)
* Remove API Server from experimental mode, set UI Server as experimental

* Adapt api-server integration tests

* Disable --api-server by default in the tests

They are enabled only if `options.StartAPIServer`
is explicitly enabled.
This is to avoid potential port conflicting issue,
especially on Windows - see [1]

[1] https://github.com/redhat-developer/odo/issues/6939

* Error out if `--api-server-port` is set but `--api-server` is false

---------

Co-authored-by: Armel Soro <asoro@redhat.com>
2023-07-21 12:11:08 +02:00
Philippe Martin
251648998c Serve SwaggerUI (#6989)
* Serve SwaggerUI

* Add api server doc

* Copy swagger.yaml when running `make install`

* Check swagger.yaml if up-to-date

* Script to copy swagger-ui files
2023-07-21 10:39:31 +02:00
Armel Soro
a4ee0e4cea Fix potential port conflict issue with the API server tests by using a random server port if --random-ports is set (#6995)
* Let the OS assign a random ephemeral port if `--random-ports` is specified when running `odo dev` or `odo api-server`

This should hopefully fix the potential port conflict flaky
issue we are seeing, especially on Windows.

* Do not allow setting `--random-ports` and a specific port value

This applies to:
- `odo dev --random-ports --api-server --api-server-port=<port>`
- `odo api-server --random-ports --port=<port>`
2023-07-21 09:52:24 +02:00
Philippe Martin
159ca02b89 Add UI telemetry (#6981)
* Load Segment module

* First events

* Add GET /telemetry epoint to API

* Init telemetry with data from API

* Add more tracking

* Update ui static files

* Send telemetry for tab changes

* Update UI static files

* Set IP to 0.0.0.0

* Update UI static files
2023-07-19 18:20:18 +02:00
Armel Soro
8c9bcdeb1f Propagate local Devfile changes to the UI (#6970)
* Add '/notifications' endpoint for subscribing to server-sent events

* Generate server and client

* Try implementing the notification service endpoint

* Revert "Try implementing the notification service endpoint"

This does not seem to work because the generated server always responds
with application/json, and it is not possible to respond with a
different content-type.

This reverts commit cf3ce83677649763b8166c4847501c37246dd757.

* Revert "Generate server and client"

This reverts commit b985c007a0561edbe185adc3b9582e12aa3f072b.

* Revert "Add '/notifications' endpoint for subscribing to server-sent events"

This reverts commit c5c903329f13dbe4ec096d83b1c8624fd622bef3.

* Implement 'GET /notifications' SSE endpoint and logic to detect and notify Devfile changes

* Leverage EventSource to subscribe to Server Sent Events

Here, this is being used to automatically reload the Devfile in the YAML view
whenever the API server notifies of filesystem changes in the Devfile
(and related resources).

* Add Preference Client to apiserver CLI

This is needed to be able to persist Devfiles from the UI to the filesystem

* Add E2E test case

* fixup! Leverage EventSource to subscribe to Server Sent Events

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Limit the round-trips by sending the whole Devfile content in the DevfileUpdated event data

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* [Cypress] Make sure to wait for APi responses after visiting the home page

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Generate static UI

* fixup! [Cypress] Make sure to wait for APi responses after visiting the home page

---------

Co-authored-by: Philippe Martin <phmartin@redhat.com>
2023-07-18 17:02:12 +02:00
Armel Soro
6e725952bd Display information about the running API Server and web UI in odo describe component output (#6964)
* refactor: Set the experimental mode env var in a single place for the '--api-server' related tests

* Add integration tests highlighting the expectations

* Make the state client return the API server ports per platform

'odo dev' might be running on both cluster and podman,
so we might end up with several API servers.

* Make 'odo describe component' return information about the API Server and web UI

This is viewable only when running 'odo describe component'
with the experimental mode enabled.

* fixup! refactor: Set the experimental mode env var in a single place for the '--api-server' related tests

* Unit-test describe#filterByPlatform logic

* Simplify logic for 'describe#filterByPlatform', as suggested in review

Co-authored-by: Philippe Martin <phmartin@redhat.com>

---------

Co-authored-by: Philippe Martin <phmartin@redhat.com>
2023-07-18 16:31:14 +02:00
Philippe Martin
53cb806a65 Add Preference dependency to api-server command (#6974) 2023-07-18 14:44:17 +02:00
Armel Soro
9fd65cd27d Generate static UI files from within a container (#6972)
* Generate static UI files from within a container, for more predictability

For some reason, Angular was not generating the same hash
for the `runtime*.js` file (even with the same content),
causing the 'check-ui-static-files' job to sometimes fail.

Leveraging a container (as we are already doing for the
'generate-apiserver' and 'generate-apifront' tasks)
should allow for more predictable output.

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Generate static UI

---------

Co-authored-by: Philippe Martin <phmartin@redhat.com>
2023-07-18 08:21:50 +02:00
Armel Soro
abdb1c568d Update go.mod with new location of the Alizer library (#6962)
* Update 'go.mod' with new location of the Alizer library

* Downgrade and pin conflicting versions of 'github.com/docker/{cli,distributions}'

Pinning it to the version we had before.
Otherwise, there were issues when running 'go mod tidy':

```
$ go mod tidy
go: downloading github.com/operator-framework/api v0.17.6
go: finding module for package github.com/docker/docker/pkg/term
github.com/redhat-developer/odo/pkg/auth imports
        github.com/openshift/oc/pkg/cli/login imports
                github.com/openshift/oc/pkg/helpers/term imports
                        github.com/docker/docker/pkg/term: module
                        github.com/docker/docker@latest found
                        (v24.0.4+incompatible), but does not contain
                        package github.com/docker/docker/pkg/term

```

* Fix expected output in quickstart guides doc automation tests
2023-07-17 12:57:31 +02:00
Parthvi Vala
abc808bdec Fix oc to odo project translation (#6949)
* Fix oc to odo project translation

Signed-off-by: Parthvi <parthvi.vala@gmail.com>

* Attempt at fixing regression

Signed-off-by: Parthvi <parthvi.vala@gmail.com>

* Add unit test for filteredInformation

Signed-off-by: Parthvi <parthvi.vala@gmail.com>

* Use oc command instead of odo

Signed-off-by: Parthvi <parthvi.vala@gmail.com>
Co-authored-by: Armel Soro <asoro@redhat.com>

---------

Signed-off-by: Parthvi <parthvi.vala@gmail.com>
Co-authored-by: Parthvi Vala <pvala@localhost.localdomain>
Co-authored-by: Armel Soro <asoro@redhat.com>
2023-07-17 12:38:36 +02:00