eclipse-che / che-theia

Eclipse Public License 2.0
125 stars 111 forks source link

fix: ensure names are not > 63 characters #1297

Closed benoitf closed 2 years ago

benoitf commented 2 years ago

What does this PR do?

Make sure generated names are not greater than 63 characters

Screenshot/screencast of this PR

What issues does this PR fix or reference?

https://github.com/eclipse/che/issues/21040 https://issues.redhat.com/browse/CRW-2651

How to test this PR?

  1. Launch CRW registry docker run --rm -it -p 8080:8080 quay.io/crw/pluginregistry-rhel8:2.14

  2. Launch the command

    $ npx @eclipse-che/che-theia-devworkspace-handler --devfile-url:https://github.com/crw-samples/nodejs-configmap/tree/devfilev2 --editor:eclipse/che-theia/latest --plugin-registry-url:http://localhost:8080/v3 --output-file:/tmp/foo.yaml --sidecar-policy:mergeImage
  3. now, create a devWorkspace from the /tmp/foo.yam file oc apply -f /tmp/foo.yaml

and it's failing with

The DevWorkspace "nodejs-configmap" is invalid: spec.template.components.name: Invalid value: "sidecar-merged-registry-redhat-io-codeready-workspaces-plugin-java8-rhel8-2-14": spec.template.components.name in body should be at most 63 chars long

4, now check that with this PR it's fixing the issue go to tools/devworkspace-handler and run yarn

then:

node lib/entrypoint.js --devfile-url:https://github.com/crw-samples/nodejs-configmap/tree/devfilev2 --editor:eclipse/che-theia/latest --plugin-registry-url:http://localhost:8080/v3 --output-file:/tmp/foo2.yaml --sidecar-policy:mergeImage

and create a DevWorkspace from foo2.yaml

$ oc apply -f /tmp/foo2.yaml
devworkspacetemplate.workspace.devfile.io/theia-ide-nodejs-configmap configured
devworkspace.workspace.devfile.io/nodejs-configmap created

and check that there is no more error

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Happy Path Channel

HAPPY_PATH_CHANNEL=stable

Change-Id: I7d60970285e7405698f8528fa447b97920c6b517 Signed-off-by: Florent Benoit fbenoit@redhat.com

codecov[bot] commented 2 years ago

Codecov Report

Merging #1297 (498e4c4) into main (c299f59) will increase coverage by 3.57%. The diff coverage is 44.46%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1297      +/-   ##
==========================================
+ Coverage   32.78%   36.36%   +3.57%     
==========================================
  Files         290      325      +35     
  Lines        9885    10574     +689     
  Branches     1457     1431      -26     
==========================================
+ Hits         3241     3845     +604     
- Misses       6641     6724      +83     
- Partials        3        5       +2     
Impacted Files Coverage Δ
...theia-about/src/browser/about-che-theia-dialog.tsx 0.00% <0.00%> (ø)
...credentials/src/browser/che-credentials-service.ts 0.00% <0.00%> (ø)
...entials/src/browser/credentials-frontend-module.ts 0.00% <0.00%> (ø)
...eia-credentials/src/common/credentials-protocol.ts 0.00% <0.00%> (ø)
...eia-credentials/src/node/che-credentials-server.ts 0.00% <0.00%> (ø)
...s/src/node/che-theia-credentials-backend-module.ts 0.00% <0.00%> (ø)
...ashboard/src/browser/che-theia-dashboard-module.ts 0.00% <0.00%> (ø)
...ia-dashboard/src/browser/theia-dashboard-client.ts 0.00% <0.00%> (ø)
...rowser/src/browser/che-mini-browser-environment.ts 0.00% <0.00%> (ø)
...in-ext/src/browser/che-sidecar-file-system-main.ts 100.00% <ø> (ø)
... and 291 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 05d296b...498e4c4. Read the comment docs.