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

Add module prefix for Publish-PSResource #1690

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/code/ContainerRegistryServerAPICalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,15 +1129,18 @@ private static Collection<KeyValuePair<string, string>> GetDefaultHeaders(string
internal bool PushNupkgContainerRegistry(string psd1OrPs1File,
string outputNupkgDir,
string packageName,
string modulePrefix,
NuGetVersion packageVersion,
ResourceType resourceType,
Hashtable parsedMetadataHash,
Hashtable dependencies,
Hashtable parsedMetadataHash,
Hashtable dependencies,
out ErrorRecord errRecord)
{
_cmdletPassedIn.WriteDebug("In ContainerRegistryServerAPICalls::PushNupkgContainerRegistry()");
string fullNupkgFile = System.IO.Path.Combine(outputNupkgDir, packageName + "." + packageVersion.ToNormalizedString() + ".nupkg");
string packageNameLowercase = packageName.ToLower();

string pkgNameForUpload = string.IsNullOrEmpty(modulePrefix) ? packageName : modulePrefix + "/" + packageName;
string packageNameLowercase = pkgNameForUpload.ToLower();

// Get access token (includes refresh tokens)
_cmdletPassedIn.WriteVerbose($"Get access token for container registry server.");
Expand Down Expand Up @@ -1179,8 +1182,8 @@ internal bool PushNupkgContainerRegistry(string psd1OrPs1File,
return false;
}

// Create and upload manifest
TryCreateAndUploadManifest(fullNupkgFile, nupkgDigest, configDigest, packageName, resourceType, metadataJson, configFilePath, packageVersion, containerRegistryAccessToken, out errRecord);
// Create and upload manifest
TryCreateAndUploadManifest(fullNupkgFile, nupkgDigest, configDigest, packageName, modulePrefix, resourceType, metadataJson, configFilePath, packageVersion, containerRegistryAccessToken, out errRecord);
if (errRecord != null)
{
return false;
Expand All @@ -1195,7 +1198,7 @@ internal bool PushNupkgContainerRegistry(string psd1OrPs1File,
/// </summary>
private string UploadNupkgFile(string packageNameLowercase, string containerRegistryAccessToken, string fullNupkgFile, out ErrorRecord errRecord)
{
_cmdletPassedIn.WriteDebug("In ContainerRegistryServerAPICalls::UploadNupkgFile()");
_cmdletPassedIn.WriteDebug("In ContainerRegistryServerAPICalls::UploadNupkgFile()");
_cmdletPassedIn.WriteVerbose("Start uploading blob");
string nupkgDigest = string.Empty;
errRecord = null;
Expand Down Expand Up @@ -1349,6 +1352,7 @@ private bool TryCreateAndUploadManifest(string fullNupkgFile,
string nupkgDigest,
string configDigest,
string packageName,
string modulePrefix,
ResourceType resourceType,
string metadataJson,
string configFilePath,
Expand All @@ -1358,7 +1362,9 @@ private bool TryCreateAndUploadManifest(string fullNupkgFile,
{
_cmdletPassedIn.WriteDebug("In ContainerRegistryServerAPICalls::TryCreateAndUploadManifest()");
errRecord = null;
string packageNameLowercase = packageName.ToLower();

string pkgNameForUpload = string.IsNullOrEmpty(modulePrefix) ? packageName : modulePrefix + "/" + packageName;
string packageNameLowercase = pkgNameForUpload.ToLower();
FileInfo nupkgFile = new FileInfo(fullNupkgFile);
var fileSize = nupkgFile.Length;
var fileName = System.IO.Path.GetFileName(fullNupkgFile);
Expand Down
Loading
Loading