-
Notifications
You must be signed in to change notification settings - Fork 632
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
DYN-5709: Pm publish version patch request #15395
base: master
Are you sure you want to change the base?
Conversation
- changed publish package command restrictions - located the place where dll files would cause error on deletion
- dll being loaded doesn't seem to be a problem
- historically, when publishing a new package or a new package version, we would re-build the package anew every time. This creates a number of issues around tempering with loaded resources (removing, overriding, loading, unloading) - we make an assumption, that if a package is installed, the user wants to publish (either as a brand new package, or a version) the actual installed package with its existing files and folder structure - this means that we disable the option to dynamically add/remove files if we publish from locally installed package - which allows us to simply zip the existing folder structure, only amending the Header file as needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-5709
UI Smoke TestsTest: success. 11 passed, 0 failed. |
@dnenov instead of disabling |
// If the current user is the package holder and a package with that name has not been published yet, return true | ||
private bool PackageNotPublishedAndUserIsHolder(Package package, string username) | ||
{ | ||
bool userIsHolder = package.CopyrightHolder != null && package.CopyrightHolder.Equals(username); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the copyright
information coming from the pkg.json
file? What if it's missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about renaming this function as IsPackageUnpublishedAndUserHolder
?
{ | ||
if (!CanPublish) return false; | ||
|
||
return packageManagerClient.DoesCurrentUserOwnPackage(Model, dynamoModel.AuthenticationManager.Username) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the DoesCurrentUserOwnPackage
check mean that the package cannot be republished by someone who hasn't published it before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like only an existing package maintainer or package copyright holder can republish (publish a new version) the package? The code would be clearer if you said something like:
bool isUserOwnerOrHolder = packageManagerClient.DoesCurrentUserOwnPackage(Model, dynamoModel.AuthenticationManager.Username) || PackageNotPublishedAndUserIsHolder(Model, dynamoModel.AuthenticationManager.Username);
return isUserOwnerOrHolder;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait..Copyright Holder should not be able to publish a version or a package, we do not validate copyright holder on server side, any actions related to package publishing either republishing from local copy or publishing a version should be limited to its current maintainers only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood.
vm.IsNewVersion = false; | ||
vm.IsPackageInstalled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this always be true? In the case of publishing a new package, the new package doesn't need to always be loaded, does it?
@@ -2117,9 +2136,9 @@ private void RemoveSingleItem(PackageItemRootViewModel vm, DependencyType fileTy | |||
} | |||
} | |||
|
|||
private bool CanShowAddFileDialogAndAdd() | |||
private bool CanAddFiles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just remove this redundant property (it's just the inverse of IsPackageInstalled
) and use IsPackageInstalled
directly?
this means that we disable the option to add/remove files when publishing from locally installed package what is the process to include new version of the existing dll in your package, or removing existing ones? |
@dnenov I was able to publish the DynamoForma package with these changes 🎉 Thank you! A couple of comments: To @zeusongit's point, I now understand why the publish version workflow was designed the way it is today: One workaround for this could be that we require authors to manually edit the pkg.json file with the newly updated node libraries if they want to publish the package while being loaded correctly. We then completely disable editing node library checks in the UI, we simply display them as read-only. This, however, is not an intuitive option and difficult to message/make discoverable to package authors. On second thoughts I think it's best to revert to the old publish version workflow of allowing adding/removing files (including node library tagging), then publishing the edited package but not reloading it in the same Dynamo session. We could simply message that users would need to restart Dynamo to load the edited package. Thoughts @zeusongit? |
@zeusongit when @dnenov and I discussed this, we found that it makes it very complicated to add or remove files to an already loaded package and then republish it as a new version/package (I think because the new package post-edits is then loaded in the same Dynamo session). We therefore decided to simplify this workflow by disallowing file addition or removal while publishing an already installed package. If this is required, the idea is for the package author to have the package in its final, ready-to-publish state already loaded in Dynamo before publishing it. However, this new approach has its disadvantages as well. Please see my comment above. |
Hi @aparajit-pratap @QilongTang. Thank you for your comments. I was hoping that this line of simplification might be a good one, but it might turn out that it's not. Here are some of my thoughts:
Actually, would it be OK if we had a call around a few more questions? |
Agreed, second option makes sense. But I can think of some ways that may be a problem, like adding binaries which are unchanged and already exist. |
Parking this one after discussion with @zeusongit and @QilongTang. Will pursue a proper context isolation per plugin as a way to move forward. |
@zeusongit why would that be a problem? |
Opening up as a temp solution to the currently broken |
@dnenov This PR is no longer required right? |
Purpose
An urgent request to 'fix' the
Publish version
experience.For review. Needs testing.
User experience
Installed Packages
Edit package details (header); Publish Locally is disabled
'Edit' is still available to preview the package structure, but editing options are disabled
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
Publish
installed package also usesRetainFolderStructure
Publish
andPublish version
now mark the package asinstalled
installed
(IsPackageInstalled
) then we bypass the standard build procedure, and use (zip) the existing package folderinstalled
the editing functionalities of the publish package workflow are disabled, ie. we cannot add/remove files (as this will require a rebuild)installed
we don't allow local installation, only publish online (as the package is already installed after all?)Reviewers
@aparajit-pratap
@mjkkirschner
FYIs
@QilongTang
@zeusongit
@reddyashish