janus-idp / backstage-plugins

Plugins for Backstage
https://janus-idp.io
Apache License 2.0
149 stars 147 forks source link

Orchestrator: `export-dynamic` command does not work #1396

Closed schultzp2020 closed 7 months ago

schultzp2020 commented 7 months ago

Describe the bug

The Orchestrator plugin's export-dynamic command does not work

Expected Behavior

The Orchestrator plugin's export-dynamic command does work

What are the steps to reproduce this bug?

  1. Run yarn run --cwd ./plugins/orchestrator export-dynamic
$ yarn export-dynamic --clean
yarn run v1.22.21
$ janus-cli package export-dynamic-plugin && yarn export-workflow-editor-envelope:dynamic --clean
Loaded config from app-config.yaml
  614.72 kB  dist-scalprum\static\2294.f620bcde.chunk.js
  517 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_clean.3ae7426f.chunk.js
  515 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_step21.e5f4cd73.chunk.js
  515 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_flix.42706e4e.chunk.js
  510 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_golo.79b0358f.chunk.js
...
  507 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_prolog.fbf0f87e.chunk.js
  506 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_roboconf.d211d6f4.chunk.js
  500 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_awk.03874d49.chunk.js
  491 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_json.7edc4320.chunk.js
  488 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_properties.abe8ae1b.chunk.js
  472 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_parser3.d0a8e307.chunk.js
  468 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_gherkin.4038e6be.chunk.js
  443 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_dockerfile.8fa65e3d.chunk.js
  431 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_profile.b8bad4e0.chunk.js
  431 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_dust.e0652965.chunk.js
  427 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_subunit.bafced91.chunk.js
  424 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_dsconfig.21fa2f60.chunk.js
  421 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_csp.844dead7.chunk.js
  413 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_diff.9edeb8b2.chunk.js
  410 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_ebnf.f65e72f4.chunk.js
  402 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_tap.6d649b6e.chunk.js
  384 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_phpTemplate.e48288ba.chunk.js
  376 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_brainfuck.1c5b872e.chunk.js
  374 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_taggerscript.b28dc403.chunk.js
  359 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_leaf.e49a9352.chunk.js
  347 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_fix.c0a0c2ec.chunk.js
  337 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_mojolicious.3f861bb1.chunk.js
  336 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_ldif.c6b291c9.chunk.js
  336 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_bnf.e89c6e82.chunk.js
  323 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_shell.afd0e966.chunk.js
  315 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_nodeRepl.a341bf97.chunk.js
  312 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_juliaRepl.5c0668e1.chunk.js
  311 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_pythonRepl.5ef5ad61.chunk.js
  306 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_erb.cff8c376.chunk.js
  296 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_clojureRepl.459e8c23.chunk.js
  277 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_vbscriptHtml.942bc280.chunk.js
  255 B      dist-scalprum\static\react-syntax-highlighter_languages_highlight_plaintext.9779bc97.chunk.js
$ yarn export-workflow-editor-envelope --env envelopeParentFolder=./dist-scalprum --clean
$ rm -rf dist/workflow-editor-envelope/ && webpack --config workflow-editor-envelope/webpack.config.js --env envelopeParentFolder=./dist-scalprum --clean
[webpack-cli] Error: Unknown option '--clean'
[webpack-cli] Run 'webpack --help' to see available commands and options
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.        
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.        
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Versions of software used and environment

davidfestal commented 7 months ago

I have no idea what the second part of the export-dynamic script is: yarn export-workflow-editor-envelope:dynamic --clean... I've never had the need for this in other frontend plugins for RHDH.

pkliczewski commented 7 months ago

cc @batzionb

batzionb commented 7 months ago

cc @caponetto

caponetto commented 7 months ago

The --clean flag is being appended at the end but it affects the second part (extended) of the command. If things are being appended to the default commands, it means we cannot extend them. Is it correct @davidfestal?

davidfestal commented 7 months ago

If things are being appended to the default commands, it means we cannot extend them. Is it correct @davidfestal?

It was not designed with this extend-approach in mind yes.

Can you share about what yarn export-workflow-editor-envelope:dynamic is expected to do ?

davidfestal commented 7 months ago

Would this comment help building the composite export-dynamic script you need: https://github.com/yarnpkg/yarn/issues/5207#issuecomment-690583826 ?

batzionb commented 7 months ago

the second part is supposed to build files for the kie tools editor but we are changing this anyhow so I can remove it

caponetto commented 7 months ago

If things are being appended to the default commands, it means we cannot extend them. Is it correct @davidfestal?

It was not designed with this extend-approach in mind yes.

Can you share about what yarn export-workflow-editor-envelope:dynamic is expected to do ?

It builds additional static stuff related to the workflow editor. We have a task to remove that extended part from the export-dynamic command and serve the files from the backend plugin (see FLPATH-889). Let me know if the issue here is a blocker. If so, we can remove the second part of the command and wait for FLPATH-889.

batzionb commented 7 months ago

@schultzp2020 I didn't manage to reproduce this, is this issue on main? I ran on main branch: yarn run --cwd=./plugins/orchestrator export-dynamic it just built it it didn't run clean

caponetto commented 7 months ago

@batzionb I can reproduce it only if I append --clean at the end of the command.

caponetto commented 7 months ago

Would this comment help building the composite export-dynamic script you need: yarnpkg/yarn#5207 (comment) ?

Looks like this works:

- "export-dynamic": "janus-cli package export-dynamic-plugin && yarn export-workflow-editor-envelope:dynamic",
+ "export-dynamic": "f() { janus-cli package export-dynamic-plugin \"$@\" && yarn export-workflow-editor-envelope:dynamic; }; f",

with yarn --cwd ./plugins/orchestrator export-dynamic --clean

schultzp2020 commented 7 months ago

Would this comment help building the composite export-dynamic script you need: yarnpkg/yarn#5207 (comment) ?

Looks like this works:

- "export-dynamic": "janus-cli package export-dynamic-plugin && yarn export-workflow-editor-envelope:dynamic",
+ "export-dynamic": "f() { janus-cli package export-dynamic-plugin \"$@\" && yarn export-workflow-editor-envelope:dynamic; }; f",

with yarn --cwd ./plugins/orchestrator export-dynamic --clean

This does not work on windows.

batzionb commented 7 months ago

@schultzp2020 Is this a blocker for anything right now? It'll be solved in FLPATH-889

schultzp2020 commented 7 months ago

@schultzp2020 Is this a blocker for anything right now? It'll be solved in FLPATH-889

Somewhat, this bug significantly complicates the maintenance of the plugins repository since we frequently need to regenerate the lockfiles, although it's not a critical issue.

batzionb commented 7 months ago

resolved in https://github.com/janus-idp/backstage-plugins/pull/1403

caponetto commented 7 months ago

Thanks @batzionb!

Given the circumstances, we were able to remove the extended part of the command but it'd be nice if we could extend the commands in a platform-agnostic way. Let's keep that in mind if we ever need to do it again.

batzionb commented 7 months ago

@schultzp2020 Can you please verify and close the issue?

schultzp2020 commented 7 months ago

lgtm