@@ -301,6 +301,7 @@ private Stream InstallVersion(
301301 string packageVersion ,
302302 out ErrorRecord errRecord )
303303 {
304+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::InstallVersion()" ) ;
304305 errRecord = null ;
305306 string packageNameLowercase = packageName . ToLower ( ) ;
306307 string accessToken = string . Empty ;
@@ -371,6 +372,7 @@ private Stream InstallVersion(
371372 /// </summary>
372373 internal string GetContainerRegistryAccessToken ( out ErrorRecord errRecord )
373374 {
375+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetContainerRegistryAccessToken()" ) ;
374376 string accessToken = string . Empty ;
375377 string containerRegistryAccessToken = string . Empty ;
376378 string tenantID = string . Empty ;
@@ -387,7 +389,6 @@ internal string GetContainerRegistryAccessToken(out ErrorRecord errRecord)
387389 _cmdletPassedIn . WriteVerbose ( "Access token retrieved." ) ;
388390
389391 tenantID = repositoryCredentialInfo . SecretName ;
390- _cmdletPassedIn . WriteVerbose ( $ "Tenant ID: { tenantID } ") ;
391392 }
392393 else
393394 {
@@ -437,6 +438,7 @@ internal string GetContainerRegistryAccessToken(out ErrorRecord errRecord)
437438 /// </summary>
438439 internal bool IsContainerRegistryUnauthenticated ( string containerRegistyUrl , out ErrorRecord errRecord )
439440 {
441+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::IsContainerRegistryUnauthenticated()" ) ;
440442 errRecord = null ;
441443 string endpoint = $ "{ containerRegistyUrl } /v2/";
442444 HttpResponseMessage response ;
@@ -463,6 +465,7 @@ internal bool IsContainerRegistryUnauthenticated(string containerRegistyUrl, out
463465 /// </summary>
464466 internal string GetContainerRegistryRefreshToken ( string tenant , string accessToken , out ErrorRecord errRecord )
465467 {
468+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetContainerRegistryRefreshToken()" ) ;
466469 string content = string . Format ( containerRegistryRefreshTokenTemplate , Registry , tenant , accessToken ) ;
467470 var contentHeaders = new Collection < KeyValuePair < string , string > > { new KeyValuePair < string , string > ( "Content-Type" , "application/x-www-form-urlencoded" ) } ;
468471 string exchangeUrl = string . Format ( containerRegistryOAuthExchangeUrlTemplate , Registry ) ;
@@ -480,6 +483,7 @@ internal string GetContainerRegistryRefreshToken(string tenant, string accessTok
480483 /// </summary>
481484 internal string GetContainerRegistryAccessTokenByRefreshToken ( string refreshToken , out ErrorRecord errRecord )
482485 {
486+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetContainerRegistryAccessTokenByRefreshToken()" ) ;
483487 string content = string . Format ( containerRegistryAccessTokenTemplate , Registry , refreshToken ) ;
484488 var contentHeaders = new Collection < KeyValuePair < string , string > > { new KeyValuePair < string , string > ( "Content-Type" , "application/x-www-form-urlencoded" ) } ;
485489 string tokenUrl = string . Format ( containerRegistryOAuthTokenUrlTemplate , Registry ) ;
@@ -501,6 +505,7 @@ internal string GetContainerRegistryAccessTokenByRefreshToken(string refreshToke
501505 /// </summary>
502506 private string GetDigestFromManifest ( JObject manifest , out ErrorRecord errRecord )
503507 {
508+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetDigestFromManifest()" ) ;
504509 errRecord = null ;
505510 string digest = String . Empty ;
506511
@@ -544,6 +549,7 @@ private string GetDigestFromManifest(JObject manifest, out ErrorRecord errRecord
544549 /// </summary>
545550 internal JObject GetContainerRegistryRepositoryManifest ( string packageName , string version , string containerRegistryAccessToken , out ErrorRecord errRecord )
546551 {
552+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetContainerRegistryRepositoryManifest()" ) ;
547553 // example of manifestUrl: https://psgetregistry.azurecr.io/hello-world:3.0.0
548554 string manifestUrl = string . Format ( containerRegistryManifestUrlTemplate , Registry , packageName , version ) ;
549555 var defaultHeaders = GetDefaultHeaders ( containerRegistryAccessToken ) ;
@@ -556,6 +562,7 @@ internal JObject GetContainerRegistryRepositoryManifest(string packageName, stri
556562 /// </summary>
557563 internal async Task < HttpContent > GetContainerRegistryBlobAsync ( string packageName , string digest , string containerRegistryAccessToken )
558564 {
565+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetContainerRegistryBlobAsync()" ) ;
559566 string blobUrl = string . Format ( containerRegistryBlobDownloadUrlTemplate , Registry , packageName , digest ) ;
560567 var defaultHeaders = GetDefaultHeaders ( containerRegistryAccessToken ) ;
561568 return await GetHttpContentResponseJObject ( blobUrl , defaultHeaders ) ;
@@ -585,6 +592,7 @@ internal JObject FindContainerRegistryImageTags(string packageName, string versi
585592 * }
586593 * }]
587594 */
595+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::FindContainerRegistryImageTags()" ) ;
588596 string resolvedVersion = string . Equals ( version , "*" , StringComparison . OrdinalIgnoreCase ) ? null : $ "/{ version } ";
589597 string findImageUrl = string . Format ( containerRegistryFindImageVersionUrlTemplate , Registry , packageName , resolvedVersion ) ;
590598 var defaultHeaders = GetDefaultHeaders ( containerRegistryAccessToken ) ;
@@ -596,6 +604,7 @@ internal JObject FindContainerRegistryImageTags(string packageName, string versi
596604 /// </summary>
597605 internal Hashtable GetContainerRegistryMetadata ( string packageName , string exactTagVersion , string containerRegistryAccessToken , out ErrorRecord errRecord )
598606 {
607+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetContainerRegistryMetadata()" ) ;
599608 Hashtable requiredVersionResponse = new Hashtable ( ) ;
600609
601610 var foundTags = FindContainerRegistryManifest ( packageName , exactTagVersion , containerRegistryAccessToken , out errRecord ) ;
@@ -712,6 +721,7 @@ internal Hashtable GetContainerRegistryMetadata(string packageName, string exact
712721 /// </summary>
713722 internal JObject FindContainerRegistryManifest ( string packageName , string version , string containerRegistryAccessToken , out ErrorRecord errRecord )
714723 {
724+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::FindContainerRegistryManifest()" ) ;
715725 var createManifestUrl = string . Format ( containerRegistryManifestUrlTemplate , Registry , packageName , version ) ;
716726 _cmdletPassedIn . WriteDebug ( $ "GET manifest url: { createManifestUrl } ") ;
717727
@@ -724,6 +734,7 @@ internal JObject FindContainerRegistryManifest(string packageName, string versio
724734 /// </summary>
725735 internal ContainerRegistryInfo GetMetadataProperty ( JObject foundTags , string packageName , out ErrorRecord errRecord )
726736 {
737+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetMetadataProperty()" ) ;
727738 errRecord = null ;
728739 ContainerRegistryInfo serverPkgInfo = null ;
729740
@@ -803,6 +814,7 @@ internal ContainerRegistryInfo GetMetadataProperty(JObject foundTags, string pac
803814 /// </summary>
804815 internal async Task < HttpResponseMessage > UploadManifest ( string packageName , string packageVersion , string configPath , bool isManifest , string containerRegistryAccessToken )
805816 {
817+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::UploadManifest()" ) ;
806818 try
807819 {
808820 var createManifestUrl = string . Format ( containerRegistryManifestUrlTemplate , Registry , packageName , packageVersion ) ;
@@ -817,6 +829,7 @@ internal async Task<HttpResponseMessage> UploadManifest(string packageName, stri
817829
818830 internal async Task < HttpContent > GetHttpContentResponseJObject ( string url , Collection < KeyValuePair < string , string > > defaultHeaders )
819831 {
832+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetHttpContentResponseJObject()" ) ;
820833 try
821834 {
822835 HttpRequestMessage request = new HttpRequestMessage ( HttpMethod . Get , url ) ;
@@ -834,6 +847,7 @@ internal async Task<HttpContent> GetHttpContentResponseJObject(string url, Colle
834847 /// </summary>
835848 internal JObject GetHttpResponseJObjectUsingDefaultHeaders ( string url , HttpMethod method , Collection < KeyValuePair < string , string > > defaultHeaders , out ErrorRecord errRecord )
836849 {
850+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetHttpResponseJObjectUsingDefaultHeaders()" ) ;
837851 try
838852 {
839853 errRecord = null ;
@@ -883,6 +897,7 @@ internal JObject GetHttpResponseJObjectUsingDefaultHeaders(string url, HttpMetho
883897 /// </summary>
884898 internal JObject GetHttpResponseJObjectUsingContentHeaders ( string url , HttpMethod method , string content , Collection < KeyValuePair < string , string > > contentHeaders , out ErrorRecord errRecord )
885899 {
900+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetHttpResponseJObjectUsingContentHeaders()" ) ;
886901 errRecord = null ;
887902 try
888903 {
@@ -1122,17 +1137,20 @@ internal bool PushNupkgContainerRegistry(string psd1OrPs1File,
11221137 Hashtable dependencies ,
11231138 out ErrorRecord errRecord )
11241139 {
1140+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::PushNupkgContainerRegistry()" ) ;
11251141 string fullNupkgFile = System . IO . Path . Combine ( outputNupkgDir , packageName + "." + packageVersion . ToNormalizedString ( ) + ".nupkg" ) ;
11261142 string packageNameLowercase = packageName . ToLower ( ) ;
11271143
11281144 // Get access token (includes refresh tokens)
1145+ _cmdletPassedIn . WriteVerbose ( $ "Get access token for container registry server.") ;
11291146 var containerRegistryAccessToken = GetContainerRegistryAccessToken ( out errRecord ) ;
11301147 if ( errRecord != null )
11311148 {
11321149 return false ;
11331150 }
11341151
11351152 // Upload .nupkg
1153+ _cmdletPassedIn . WriteVerbose ( $ "Upload .nupkg file: { fullNupkgFile } ") ;
11361154 string nupkgDigest = UploadNupkgFile ( packageNameLowercase , containerRegistryAccessToken , fullNupkgFile , out errRecord ) ;
11371155 if ( errRecord != null )
11381156 {
@@ -1148,6 +1166,7 @@ internal bool PushNupkgContainerRegistry(string psd1OrPs1File,
11481166
11491167 // Create config.json file
11501168 var configFilePath = System . IO . Path . Combine ( outputNupkgDir , "config.json" ) ;
1169+ _cmdletPassedIn . WriteVerbose ( $ "Create config.json file at path: { configFilePath } ") ;
11511170 string configDigest = CreateConfigFile ( configFilePath , out errRecord ) ;
11521171 if ( errRecord != null )
11531172 {
@@ -1178,6 +1197,7 @@ internal bool PushNupkgContainerRegistry(string psd1OrPs1File,
11781197 /// </summary>
11791198 private string UploadNupkgFile ( string packageNameLowercase , string containerRegistryAccessToken , string fullNupkgFile , out ErrorRecord errRecord )
11801199 {
1200+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::UploadNupkgFile()" ) ;
11811201 _cmdletPassedIn . WriteVerbose ( "Start uploading blob" ) ;
11821202 string nupkgDigest = string . Empty ;
11831203 errRecord = null ;
@@ -1240,6 +1260,7 @@ private string UploadNupkgFile(string packageNameLowercase, string containerRegi
12401260 /// </summary>
12411261 private void CreateAndUploadEmptyFile ( string outputNupkgDir , string pkgNameLower , string containerRegistryAccessToken , out ErrorRecord errRecord )
12421262 {
1263+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::CreateAndUploadEmptyFile()" ) ;
12431264 _cmdletPassedIn . WriteVerbose ( "Create an empty file" ) ;
12441265 string emptyFileName = "empty" + Guid . NewGuid ( ) . ToString ( ) + ".txt" ;
12451266 var emptyFilePath = System . IO . Path . Combine ( outputNupkgDir , emptyFileName ) ;
@@ -1290,6 +1311,7 @@ private void CreateAndUploadEmptyFile(string outputNupkgDir, string pkgNameLower
12901311 /// </summary>
12911312 private string CreateConfigFile ( string configFilePath , out ErrorRecord errRecord )
12921313 {
1314+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::CreateConfigFile()" ) ;
12931315 string configFileDigest = string . Empty ;
12941316 _cmdletPassedIn . WriteVerbose ( "Create the config file" ) ;
12951317 while ( File . Exists ( configFilePath ) )
@@ -1336,6 +1358,7 @@ private bool TryCreateAndUploadManifest(string fullNupkgFile,
13361358 string containerRegistryAccessToken ,
13371359 out ErrorRecord errRecord )
13381360 {
1361+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::TryCreateAndUploadManifest()" ) ;
13391362 errRecord = null ;
13401363 string packageNameLowercase = packageName . ToLower ( ) ;
13411364 FileInfo nupkgFile = new FileInfo ( fullNupkgFile ) ;
@@ -1377,6 +1400,7 @@ private string CreateManifestContent(
13771400 ResourceType resourceType ,
13781401 string metadata )
13791402 {
1403+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::CreateManifestContent()" ) ;
13801404 StringBuilder stringBuilder = new StringBuilder ( ) ;
13811405 StringWriter stringWriter = new StringWriter ( stringBuilder ) ;
13821406 JsonTextWriter jsonWriter = new JsonTextWriter ( stringWriter ) ;
@@ -1436,6 +1460,7 @@ private string CreateManifestContent(
14361460 /// </summary>
14371461 private string CreateDigest ( string fileName , out ErrorRecord errRecord )
14381462 {
1463+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::CreateDigest()" ) ;
14391464 errRecord = null ;
14401465 string digest = string . Empty ;
14411466 FileInfo fileInfo = new FileInfo ( fileName ) ;
@@ -1457,8 +1482,6 @@ private string CreateDigest(string fileName, out ErrorRecord errRecord)
14571482 }
14581483
14591484 digest = stringBuilder . ToString ( ) ;
1460- // Write the name and hash value of the file to the console.
1461- _cmdletPassedIn . WriteVerbose ( $ "{ fileInfo . Name } : { digest } ") ;
14621485 }
14631486 catch ( IOException ex )
14641487 {
@@ -1490,6 +1513,7 @@ private string CreateDigest(string fileName, out ErrorRecord errRecord)
14901513 /// </summary>
14911514 private string CreateMetadataContent ( ResourceType resourceType , Hashtable parsedMetadata , out ErrorRecord errRecord )
14921515 {
1516+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::CreateMetadataContent()" ) ;
14931517 errRecord = null ;
14941518 string jsonString = string . Empty ;
14951519
@@ -1533,6 +1557,7 @@ private string CreateMetadataContent(ResourceType resourceType, Hashtable parsed
15331557 /// </summary>
15341558 internal async Task < string > GetStartUploadBlobLocation ( string packageName , string containerRegistryAccessToken )
15351559 {
1560+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetStartUploadBlobLocation()" ) ;
15361561 try
15371562 {
15381563 var defaultHeaders = GetDefaultHeaders ( containerRegistryAccessToken ) ;
@@ -1550,6 +1575,7 @@ internal async Task<string> GetStartUploadBlobLocation(string packageName, strin
15501575 /// </summary>
15511576 internal async Task < HttpResponseMessage > EndUploadBlob ( string location , string filePath , string digest , bool isManifest , string containerRegistryAccessToken )
15521577 {
1578+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::EndUploadBlob()" ) ;
15531579 try
15541580 {
15551581 var endUploadUrl = string . Format ( containerRegistryEndUploadTemplate , Registry , location , digest ) ;
@@ -1571,6 +1597,7 @@ internal async Task<HttpResponseMessage> EndUploadBlob(string location, string f
15711597 /// </summary>
15721598 private Hashtable [ ] FindPackagesWithVersionHelper ( string packageName , VersionType versionType , VersionRange versionRange , NuGetVersion requiredVersion , bool includePrerelease , bool getOnlyLatest , out ErrorRecord errRecord )
15731599 {
1600+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::FindPackagesWithVersionHelper()" ) ;
15741601 string accessToken = string . Empty ;
15751602 string tenantID = string . Empty ;
15761603 string registryUrl = Repository . Uri . ToString ( ) ;
@@ -1624,6 +1651,7 @@ private Hashtable[] FindPackagesWithVersionHelper(string packageName, VersionTyp
16241651 /// </summary>
16251652 private SortedDictionary < NuGet . Versioning . SemanticVersion , string > GetPackagesWithRequiredVersion ( List < JToken > allPkgVersions , VersionType versionType , VersionRange versionRange , NuGetVersion specificVersion , string packageName , bool includePrerelease , out ErrorRecord errRecord )
16261653 {
1654+ _cmdletPassedIn . WriteDebug ( "In ContainerRegistryServerAPICalls::GetPackagesWithRequiredVersion()" ) ;
16271655 errRecord = null ;
16281656 // we need NuGetVersion to sort versions by order, and string pkgVersionString (which is the exact tag from the server) to call GetContainerRegistryMetadata() later with exact version tag.
16291657 SortedDictionary < NuGet . Versioning . SemanticVersion , string > sortedPkgs = new SortedDictionary < SemanticVersion , string > ( VersionComparer . Default ) ;
0 commit comments