Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: [cawemo-migration] Add script to migrate from Cawemo to Web Modeler #329

Conversation

christian-konrad
Copy link
Contributor

@christian-konrad christian-konrad commented Jul 21, 2023

Add script to migrate from Cawemo to Web Modeler

Description

Solves #328

Testing your changes

  • Manual testing against Cawemo and Web Modeler SaaS
  • There is no API for Cawemo to create new files, hence automated tests can't be written

Types of changes

  • Bug fix (non-breaking change which fixes an existing open issue)
  • New feature (non-breaking change which adds functionality to an extension)
  • Breaking change (fix or feature that would cause existing functionality of an extension to change)
  • Documentation update (changes made to an existing piece of documentation)

Checklist:

  • My code adheres to the syntax used by this extension.
  • My pull request requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the Camunda Community Hub documentation.
  • I have read the Pull Request Process documentation.
  • I have added or suggested tests to cover my changes suggested in this pull request.
  • All new and existing CI/CD tests passed.
  • I will /assign myself this issue, and add the relevant [issue labels] to it if they are not automatically generated by Probot.
  • I will tag @camunda-community-hub/devrel in a new comment on this issue if 30 days have passed since my pull request was opened and I have not received a response from the extension's maintainer.

@christian-konrad christian-konrad linked an issue Jul 21, 2023 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Jul 21, 2023

Test Results

  26 files  +  26    26 suites  +26   2m 47s ⏱️ + 2m 47s
214 tests +214  214 ✔️ +214  0 💤 ±0  0 ±0 
332 runs  +332  332 ✔️ +332  0 💤 ±0  0 ±0 

Results for commit 0ccd12c. ± Comparison against base commit 0eb6c15.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@jfriedenstab jfriedenstab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 🚀 A few smaller things I've noticed though.

By the way, the migration does not seem to work yet for DMN diagrams (400 Bad Request is returned from Web Modeler).

cawemo-to-web-modeler-migration/README.md Outdated Show resolved Hide resolved
cawemo-to-web-modeler-migration/README.md Outdated Show resolved Hide resolved
cawemo-to-web-modeler-migration/README.md Outdated Show resolved Hide resolved
NEW_PROJECT_ID=$(jq -r .id <<< "$NEW_PROJECT")

# maps folder IDs to original IDs to not create them twice + create file in right folder
declare -A folderIds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not seem to work in Zsh on macOS:

./migrate-cawemo-to-web-modeler.sh: line 77: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only happens when I run the script directly with ./migrate-cawemo-to-web-modeler.sh, not with zsh migrate-cawemo-to-web-modeler.sh 🤔.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess declare does not exist in sh the shell specified by the shebang at the top of the script.

To align behaviours the first line should be changed to #!/usr/bin/env zsh

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works now when using #!/bin/zsh

@jfriedenstab please verify

echo "⚠ POST https://modeler.cloud.camunda.io/api/beta/files failed with status code $HTTP_STATUS"
echo "[$(date +%s)] ⚠ POST https://modeler.cloud.camunda.io/api/beta/files failed with status code $HTTP_STATUS" >> migration.log
else
echo "\e[1A\e[K$FILE_TREE_SPACES$TREE_SYMBOL ✔ Migrated file ${GREEN}$FILE_NAME${NC} (Type: $FILE_TYPE, ID: $OLD_FILE_ID)."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The character is not displayed correctly:

\e[1A\e[K├── ✔ Migrated file New BPMN Diagram (Type: BPMN, ID: 561e690c-4424-4b9e-a483-bdbec98e8176).

Probably related to this shellcheck warning (see above):
SC2028 (info): echo may not expand escape sequences. Use printf

Only happens when I run the script directly with ./migrate-cawemo-to-web-modeler.sh, not with zsh migrate-cawemo-to-web-modeler.sh 🤔.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works now when using #!/bin/zsh

@jfriedenstab please verify

OLD_FOLDER_ID=$(_folder_jq '.id')

# skip this folder if already created
if [ -z "${folderIds[$OLD_FOLDER_ID]}" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got an error in this line:

./migrate-cawemo-to-web-modeler.sh: line 118: fc98fdfb-0e75: value too great for base (error token is "0e75")

Only happens when I run the script directly with ./migrate-cawemo-to-web-modeler.sh, not with zsh migrate-cawemo-to-web-modeler.sh 🤔.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works now when using #!/bin/zsh

@jfriedenstab please verify

jonathanlukas and others added 6 commits July 31, 2023 07:34
Co-authored-by: Jan Friedenstab <8794084+jfriedenstab@users.noreply.github.com>
Co-authored-by: Jan Friedenstab <8794084+jfriedenstab@users.noreply.github.com>
Co-authored-by: Jan Friedenstab <8794084+jfriedenstab@users.noreply.github.com>
@jonathanlukas jonathanlukas changed the title Add script to migrate from Cawemo to Web Modeler [feature][cawemo-migration] Add script to migrate from Cawemo to Web Modeler Jul 31, 2023
@jonathanlukas jonathanlukas changed the title [feature][cawemo-migration] Add script to migrate from Cawemo to Web Modeler [feature][cawemo-migration]: Add script to migrate from Cawemo to Web Modeler Jul 31, 2023
@ingorichtsmeier
Copy link
Contributor

$ /bin/zsh
-bash: /bin/zsh: No such file or directory

I'm out :-(

@jonathanlukas
Copy link
Collaborator

As the script requires at least bash 4 or zsh to run, should we maybe migrate it to node.js and remove system dependencies? @ingorichtsmeier

@ingorichtsmeier
Copy link
Contributor

migrate it to node.js and remove system dependencies?

node.js is just another system dependency.

What about the system admins in the customer companies that are using Windows? Provide a PowerShell script?

Why not deliver a Spring-Boot Java application?

I haven't taken a look into this section, but what are the requirements to migrate from Cawemo to web modeler?

@jonathanlukas
Copy link
Collaborator

Node.js would be a system-agnostic runtime (just like a jre) that is quite likely to be present on a developer machine.

However, I also like the approach of a spring-boot applicationn (backend).

In the end, the script goes through projects, folders and files in cawemo and recreates the structure including files in web-modeler

We could merge this PR for now so that we have something in place and then go and see whether we migrate it to another platform (given the audience is quite small)

@jonathanlukas jonathanlukas changed the title [feature][cawemo-migration]: Add script to migrate from Cawemo to Web Modeler feature:[cawemo-migration]: Add script to migrate from Cawemo to Web Modeler Aug 9, 2023
@jonathanlukas jonathanlukas changed the title feature:[cawemo-migration]: Add script to migrate from Cawemo to Web Modeler feat:[cawemo-migration]: Add script to migrate from Cawemo to Web Modeler Aug 9, 2023
@jonathanlukas jonathanlukas changed the title feat:[cawemo-migration]: Add script to migrate from Cawemo to Web Modeler feature: [cawemo-migration]: Add script to migrate from Cawemo to Web Modeler Aug 9, 2023
@jonathanlukas jonathanlukas changed the title feature: [cawemo-migration]: Add script to migrate from Cawemo to Web Modeler feature: [cawemo-migration] Add script to migrate from Cawemo to Web Modeler Aug 9, 2023
@shaarmann
Copy link
Collaborator

Hi,
I translated the script for Powershell and will open a pull request once the bash-script has been merged.

Copy link
Collaborator

@jonathanlukas jonathanlukas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script works with zsh, so all good

@jonathanlukas jonathanlukas merged commit a252dcc into main Sep 1, 2023
3 checks passed
@jonathanlukas jonathanlukas deleted the 328-add-script-to-migrate-projects-from-cawemo-to-web-modeler branch September 1, 2023 11:05
@christian-konrad
Copy link
Contributor Author

Thank you @jonathanlukas for taking care as I wasn't able to find the time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

Add script to migrate projects from Cawemo to Web Modeler
6 participants