Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Add SkipAutomaticTags Parameter to Publish-Module #452

Merged
merged 4 commits into from
May 12, 2019
Merged

Add SkipAutomaticTags Parameter to Publish-Module #452

merged 4 commits into from
May 12, 2019

Conversation

awickham10
Copy link
Contributor

When using a generic NuGet Server there is a hard coded 4000 character limit. Publish-Module gets a list of exported functions from the module manifest. If there are a lot of functions exported, publishing to a generic NuGet Server fails with an error stating: A nuget package's Tags property may not be more than 4000 characters long. This PR is to resolve issue #344.

The -EnforceMaximumTagLength switch removes commands and resources from being included as tags when present. This switch was added to Publish-Module and Publish-PSArtificateUtility.

I'm open to discussion on how the switch functions. I don't really have much of a preference - I just need the module to publish successfully.

I also wasn't sure where the help documentation was located, so that still needs to be added.

@edyoung
Copy link
Contributor

edyoung commented Mar 23, 2019

Thanks @awickham10 ! Looking at this a bit, I think that the parameter name may be misleading - the effect is not to enforce the parameter length but to skip automatically adding tags to the module. So maybe we could rename the parameter. How about -SkipAutomaticTags? (Sorry, I think the current name might have been my suggestion.)


if ($Tags.Length -gt 4000) {
# warn we're over 4000 characters for standard nuget servers
$tagsString = $Tags -Join " "
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a need to assign to another variable here? Tags is now left as an array and when we write it out to the nuspec file it may just appear as System.Object[] or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

During my testing it seems that since Tags was a parameter defined as a string array it was always kept as an array during the execution. Tags.Length always ended up with a length of 1 (1 element in the array).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point though. I'm going to change this PR to WIP and make sure to validate that further.

Choose a reason for hiding this comment

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

@awickham10
Copy link
Contributor Author

Thanks @awickham10 ! Looking at this a bit, I think that the parameter name may be misleading - the effect is not to enforce the parameter length but to skip automatically adding tags to the module. So maybe we could rename the parameter. How about -SkipAutomaticTags? (Sorry, I think the current name might have been my suggestion.)

SkipAutomaticTags feels a lot better.

I was thinking more on this and I almost wonder if this shouldn't be a setting on the repository. I'm thinking we want people to have a consistent experience on powershellgallery.com and having this as a parameter on Publish-Module people may be more apt to changing it. If it's a default on the repository people may leave it alone unless they absolutely need it.

@awickham10 awickham10 changed the title Add EnforceMaximumTagLength Parameter to Publish-Module WIP: Add EnforceMaximumTagLength Parameter to Publish-Module Mar 23, 2019
@edyoung
Copy link
Contributor

edyoung commented Apr 2, 2019

I actually prefer this over a flag on the repo. If we did that we would still need some way to manage the set of tags in case they are longer than the limit. Let me know if you are ok with merging this.

@jzabroski
Copy link

The whole tags thing is completely nonsense anyway you slice it. It's just public functions. The ONLY TIME this way of searching helped me was finding an obscure Active Directory package called HAWK written by a Microsoft Security engineer.

@edyoung
Copy link
Contributor

edyoung commented May 12, 2019

@awickham10 any chance you can change the param name, then we can merge?

@awickham10
Copy link
Contributor Author

@awickham10 any chance you can change the param name, then we can merge?

Renamed EnforceMaximumTagLength to SkipAutomaticTags.

@awickham10 awickham10 changed the title WIP: Add EnforceMaximumTagLength Parameter to Publish-Module Add EnforceMaximumTagLength Parameter to Publish-Module May 12, 2019
@awickham10 awickham10 changed the title Add EnforceMaximumTagLength Parameter to Publish-Module Add SkipAutomaticTags Parameter to Publish-Module May 12, 2019
Copy link
Contributor

@edyoung edyoung left a comment

Choose a reason for hiding this comment

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

Thanks!

@potatoqualitee
Copy link

Sweet, added -SkipAutomaticTags to my publish routine. Thanks @awickham10 !

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

Successfully merging this pull request may close these issues.

5 participants