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

fix: Update Adp writer deploy scripts #2362

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

GDamyanov
Copy link
Contributor

fix for #2361
Update deployment related scripts generated from the writer in @sap-ux/adp-tooling for Adp Projects

@GDamyanov GDamyanov self-assigned this Sep 12, 2024
@GDamyanov GDamyanov requested a review from a team as a code owner September 12, 2024 13:48
Copy link

changeset-bot bot commented Sep 12, 2024

🦋 Changeset detected

Latest commit: 2b1a2b6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@sap-ux/adp-tooling Patch
@sap-ux/create Patch
@sap-ux/preview-middleware Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

})
};

if (!isAppStudio()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you always add this please, so that projects are ready for usage everywhere.
Even if you run in AppStudio, you have the url and auth type. The url is part of the destination configuration and the authtype is always reentranceTicket since we only add the task for ABAP cloud systems.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For BAS we don't need this configuration, because we are using destinations.

Copy link
Contributor

Choose a reason for hiding this comment

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

A project generated in BAS and then checked into e.g. github, could be checked out in VSCode and it should also work there as well. Just because it is generated in BAS, does not necessarily mean it only used in BAS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a3c9caa

},
"scripts": {
"build": "ui5 build --exclude-task generateFlexChangesBundle generateComponentPreload minify --clean-dest",
"start": "<%= locals.options?.fioriTools ? 'fiori run' : 'ui5 serve' %> --open /test/flp.html#app-preview",
"start-editor": "<%= locals.options?.fioriTools ? 'fiori run' : 'ui5 serve' %> --open /test/adaptation-editor.html"<%if (locals.deploy) {%>,
"deploy": "ui5 build --config ui5-deploy.yaml --exclude-task <%= locals.options?.fioriTools ? 'deploy-to-abap' : 'abap-deploy-task' %> generateFlexChangesBundle generateComponentPreload --clean-dest && <%= locals.options?.fioriTools ? 'fiori deploy' : 'deploy' %> --config ui5-deploy.yaml",
"undeploy": "<%= locals.options?.fioriTools ? 'fiori undeploy' : 'undeploy' %> --config ui5-deploy.yaml --lrep \"apps/<%= app.reference %>/appVariants/<%= app.id %>/\"",
"deploy": "npm run build && fiori deploy --config ui5-deploy.yaml && rimraf archive.zip",
Copy link
Contributor

Choose a reason for hiding this comment

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

The deploy process should not generate an archive.zip if not explicitly requested, therefore, I am confused that you require rimraf here.
If it does generate an archive.zip then there is a regression that needs an investigation.

Copy link
Contributor

Choose a reason for hiding this comment

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

You also need to add the IF again because you only have the fiori deploy command if the Fiori tools are added, otherwise, you need to use ui5 build

Copy link
Contributor

Choose a reason for hiding this comment

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

@tobiasqueck in SAP Fiori tools, the package.json deploy script is appended as follows;

"deploy": "npm run build && fiori deploy --config ui5-deploy.yaml && rimraf archive.zip",

During the deploy task, there is a zip generated on the fly. However, a user can specify a path to an already generated zip which will obviously bypass this zip generation task.

https://github.com/SAP/open-ux-tools/blob/main/packages/deploy-tooling/src/cli/archive.ts#L82

Copy link
Contributor Author

@GDamyanov GDamyanov Sep 18, 2024

Choose a reason for hiding this comment

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

I checked in "@sap-ux/abap-deploy-config-writer" module and it is always generating the same scripts like in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well ... I still don't understand the usage of rimraf because as @longieirl said, the zip is generated on the fly, so nothing needs to be deleted.
The deploy config generated is only generating things for the Fiori tools, while the adp writer already supports both, Fiori tools and a "pure" open source version, so instead of introducing a regression in the adp-writer, this needs to be improved in the deploy-config writer, and then, maybe reused here instead of copying an implementation

Copy link
Contributor

Choose a reason for hiding this comment

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

@tobiasqueck the archive remains if there is any exception thrown during the process! I think this is more of a cleanup task.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a3c9caa

},
\\"scripts\\": {
\\"build\\": \\"ui5 build --exclude-task generateFlexChangesBundle generateComponentPreload minify --clean-dest\\",
\\"start\\": \\"fiori run --open /test/flp.html#app-preview\\",
\\"start-editor\\": \\"fiori run --open /test/adaptation-editor.html\\",
\\"deploy\\": \\"ui5 build --config ui5-deploy.yaml --exclude-task deploy-to-abap generateFlexChangesBundle generateComponentPreload --clean-dest && fiori deploy --config ui5-deploy.yaml\\",
\\"undeploy\\": \\"fiori undeploy --config ui5-deploy.yaml --lrep \\\\\\"apps/the.original.app/appVariants/my.test.app/\\\\\\"\\",
\\"deploy\\": \\"npm run build && fiori deploy --config ui5-deploy.yaml && rimraf archive.zip\\",
Copy link
Contributor

@longieirl longieirl Oct 14, 2024

Choose a reason for hiding this comment

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

.gitignore should also exclude the archive.zip from source control which I think from looking at the snapshots, is appended i.e. *.zip

Copy link
Contributor

@longieirl longieirl left a comment

Choose a reason for hiding this comment

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

From my understanding of ADP, changes look good.
Changeset is good
Test coverage is good.
Requires another review from a developer with more ADP experience.

},
"scripts": {
"build": "ui5 build --exclude-task generateFlexChangesBundle generateComponentPreload minify --clean-dest",
"start": "<%= locals.options?.fioriTools ? 'fiori run' : 'ui5 serve' %> --open /test/flp.html#app-preview",
"start-editor": "<%= locals.options?.fioriTools ? 'fiori run' : 'ui5 serve' %> --open /test/adaptation-editor.html"<%if (locals.deploy) {%>,
"deploy": "ui5 build --config ui5-deploy.yaml --exclude-task <%= locals.options?.fioriTools ? 'deploy-to-abap' : 'abap-deploy-task' %> generateFlexChangesBundle generateComponentPreload --clean-dest && <%= locals.options?.fioriTools ? 'fiori deploy' : 'deploy' %> --config ui5-deploy.yaml",
"undeploy": "<%= locals.options?.fioriTools ? 'fiori undeploy' : 'undeploy' %> --config ui5-deploy.yaml --lrep \"apps/<%= app.reference %>/appVariants/<%= app.id %>/\"",
"deploy": "npm run build && <%= locals.options?.fioriTools ? 'fiori deploy' : 'deploy' %> --config ui5-deploy.yaml && rimraf archive.zip",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is quite a change. Before your change, the the build configuration from the ui5-deploy.yaml was used for building the sources, now it is using the ui5.yaml. Are you sure about that?

So, maybe something like npm run build -- --config ui5-deploy.yaml && <%= locals.options?.fioriTools ? 'fiori deploy' : 'deploy' %> --config ui5-deploy.yaml && rimraf archive.zip is the better option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well we don't need ui5-deploy.yaml for build, we need it only for deployment.

Copy link

sonarcloud bot commented Nov 11, 2024

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

Successfully merging this pull request may close these issues.

3 participants