Skip to content

Commit

Permalink
Dep upgrade + Feeds secret fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuinox committed Nov 5, 2019
1 parent 043eaee commit dcaa5e9
Show file tree
Hide file tree
Showing 23 changed files with 52 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -255,3 +255,4 @@ Tests/**/TestResult*.xml
/Tests/A1Test/
/Tests/**/Logs/
/Tests/CK.Env.Tests/UniverseZips/
/CodeCakeBuilder/MemoryKey.*.txt
2 changes: 1 addition & 1 deletion CK.Artifact.Model/CK.Artifact.Model.csproj
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="CSemVer" Version="7.0.1" />
<PackageReference Include="CK.ActivityMonitor.SimpleSender" Version="11.1.3--0019-develop" />
<PackageReference Include="CK.ActivityMonitor.SimpleSender" Version="12.1.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions CK.Env.Artifact.NuGet/CK.Env.Artifact.NuGet.csproj
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NuGet.Credentials" Version="5.3.0" />
<PackageReference Include="NuGet.Protocol" Version="5.3.0" />
<PackageReference Include="NuGet.Credentials" Version="5.3.1" />
<PackageReference Include="NuGet.Protocol" Version="5.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion CK.Env.Command/CK.Env.Command.csproj
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CK.ActivityMonitor.SimpleSender" Version="11.1.3--0019-develop" />
<PackageReference Include="CK.ActivityMonitor.SimpleSender" Version="12.1.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion CK.Env.DependencyModel/CK.Env.DependencyModel.csproj
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CK.Setup.Dependency" Version="8.2.2--0019-develop" />
<PackageReference Include="CK.Setup.Dependency" Version="9.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion CK.Env.Sys/CK.Env.Sys.csproj
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<PackageReference Include="CSemVer" Version="7.0.1" />
<PackageReference Include="CK.ActivityMonitor.SimpleSender" Version="11.1.3--0019-develop" />
<PackageReference Include="CK.ActivityMonitor.SimpleSender" Version="12.1.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion CK.Xml.Linq.Extension/CK.Xml.Linq.Extension.csproj
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CK.ActivityMonitor.SimpleSender" Version="11.1.3--0019-develop" />
<PackageReference Include="CK.ActivityMonitor.SimpleSender" Version="12.1.0" />
</ItemGroup>

</Project>
10 changes: 7 additions & 3 deletions CKli/Program.cs
Expand Up @@ -220,7 +220,11 @@ string FirstPadding( int paddingSize, string sourceProviderName, bool missing )
{
bool provided = !string.IsNullOrWhiteSpace( sourceProviderName );
if( missing && provided ) throw new InvalidOperationException( "Cannot be both missing and provided" );
if( missing ) sourceProviderName = "Missing";
if( missing )
{
sourceProviderName = "Missing";
provided = true;
}

return provided
? $"[{sourceProviderName}]" + new string( ' ', paddingSize - sourceProviderName.Length )
Expand Down Expand Up @@ -261,7 +265,7 @@ void RightArrow()
foreach( var k in v.KeyStore.Infos )
{
if( k.SuperKey != null ) continue;
Console.ForegroundColor = k.IsSecretAvailable ? (!string.IsNullOrWhiteSpace( k.SourceProviderName ) ? ConsoleColor.Blue : ConsoleColor.Green) : ConsoleColor.Red;
Console.ForegroundColor = k.IsSecretAvailable ? (!string.IsNullOrWhiteSpace( k.SourceProviderName ) ? ConsoleColor.Cyan : ConsoleColor.Green) : ConsoleColor.Red;
Console.Write( FirstPadding( sourceNameMaxLength, k.SourceProviderName, !k.IsSecretAvailable ) );
WhitePipe();
Console.WriteLine( k.Name );
Expand All @@ -277,7 +281,7 @@ void RightArrow()
{
if( sub.IsSecretAvailable )
{
Console.ForegroundColor = displayedAvailable ? (!string.IsNullOrWhiteSpace( sub.SourceProviderName ) ? ConsoleColor.Blue : ConsoleColor.DarkGreen) : ConsoleColor.Green;
Console.ForegroundColor = displayedAvailable ? (!string.IsNullOrWhiteSpace( sub.SourceProviderName ) ? ConsoleColor.Cyan : ConsoleColor.DarkGreen) : ConsoleColor.Green;
displayedAvailable = true;
}
else
Expand Down
8 changes: 4 additions & 4 deletions CodeCakeBuilder/CodeCakeBuilder.csproj
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
Expand All @@ -11,12 +11,12 @@
<PackageReference Include="Cake.Npm" Version="0.17.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="NuGet.Credentials" Version="5.3.0" />
<PackageReference Include="NuGet.Protocol" Version="5.3.0" />
<PackageReference Include="NuGet.Credentials" Version="5.3.1" />
<PackageReference Include="NuGet.Protocol" Version="5.3.1" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.10.0" />
<PackageReference Include="NUnit.Runners.Net4" Version="2.6.4" />
<PackageReference Include="SimpleGitVersion.Cake" Version="1.0.1" />
<PackageReference Include="CKSetup.Cake" Version="10.0.0-a00-00-0036-develop" />
<PackageReference Include="CKSetup.Cake" Version="10.1.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Plugins/CK.Env.Plugin.CKSetup/CK.Env.Plugin.CKSetup.csproj
Expand Up @@ -10,7 +10,7 @@
<ProjectReference Include="..\CK.Env.Plugin.Basics\CK.Env.Plugin.Basics.csproj" />
<ProjectReference Include="..\..\CK.Env.XTyping\CK.Env.XTyping.csproj" />
<ProjectReference Include="..\..\CK.SimpleKeyVault\CK.SimpleKeyVault.csproj" />
<PackageReference Include="CKSetup.Core" Version="10.0.0-a00-00-0036-develop" />
<PackageReference Include="CKSetup.Core" Version="10.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Expand Up @@ -58,9 +58,10 @@ class NPMAzureRepository : NPMRepositoryBase, INPMAzureRepository
/// </summary>
public override string SecretKeyName => AzureDevOpsAPIHelper.GetSecretKeyName( Organization );

protected override Registry CreateRegistry( IActivityMonitor m )
protected override Registry CreateRegistry( IActivityMonitor m, bool throwOnError )
{
string pat = ResolveSecret( m, true );
string pat = ResolveSecret( m, throwOnError );
if( string.IsNullOrWhiteSpace( pat ) ) return null;
return new Registry( Client.HttpClient, "CKli", pat, new Uri( Url ) );
}

Expand Down
4 changes: 2 additions & 2 deletions Plugins/CK.Env.Plugin.NPM/ArtifactRepository/NPMClient.cs
Expand Up @@ -114,8 +114,8 @@ public IArtifactRepository CreateRepository( in XElementReader r )
return new NPMFeed( scope, url, creds, () =>
{
Registry registry =
repositories.OfType<NPMAzureRepository>().FirstOrDefault( repo => repo.Scope == scope )?.GetRegistry( m )
?? repositories.OfType<NPMStandardRepository>().FirstOrDefault( repo => repo.Url.Equals( url, StringComparison.OrdinalIgnoreCase ) )?.GetRegistry( m );
repositories.OfType<NPMAzureRepository>().FirstOrDefault( repo => repo.Scope == scope )?.GetRegistry( m, false )
?? repositories.OfType<NPMStandardRepository>().FirstOrDefault( repo => repo.Url.Equals( url, StringComparison.OrdinalIgnoreCase ) )?.GetRegistry( m, false );
if( registry != null ) return registry;
string secret = creds.IsSecretKeyName ?
Expand Down
Expand Up @@ -63,16 +63,17 @@ abstract class NPMRepositoryBase
public bool HandleArtifactType( in ArtifactType artifactType ) => artifactType == NPMClient.NPMType;

/// <summary>
/// Resolves the target NPM registry. Never null.
/// Resolves the target NPM registry.
/// </summary>
public Registry GetRegistry( IActivityMonitor m ) => _registry ?? (_registry = CreateRegistry( m ));
public Registry GetRegistry( IActivityMonitor m, bool throwOnError = true ) => _registry ?? (_registry = CreateRegistry( m, throwOnError ));

/// <summary>
/// Creates the registry or throws on error.
/// Creates the registry.
/// </summary>
/// <param name="m">The monitor to use.</param>
/// <param name="throwOnError">If true, throw when the <see cref="Registry"/> cannot be instantied.</param>
/// <returns>The initialized registry.</returns>
protected abstract Registry CreateRegistry( IActivityMonitor m );
protected abstract Registry CreateRegistry( IActivityMonitor m, bool throwOnError );

/// <summary>
/// Overridden to return the <see cref="UniqueRepositoryName"/> string.
Expand Down Expand Up @@ -111,7 +112,7 @@ public virtual string ResolveSecret( IActivityMonitor m, bool throwOnEmpty = fal
/// <returns>True if found, false otherwise.</returns>
public virtual Task<bool> ExistsAsync( IActivityMonitor m, string packageId, SVersion version )
{
return GetRegistry( m ).ExistAsync( m, packageId, version );
return GetRegistry( m, true ).ExistAsync( m, packageId, version );
}

/// <summary>
Expand All @@ -129,7 +130,7 @@ async Task<bool> PushPackagesAsync( IActivityMonitor m, IEnumerable<LocalNPMPack
var pushed = new List<LocalNPMPackageFile>();
foreach( LocalNPMPackageFile file in files )
{
if( await GetRegistry( m ).ExistAsync( m, file.Instance.Artifact.Name, file.Instance.Version ) )
if( await GetRegistry( m, true ).ExistAsync( m, file.Instance.Artifact.Name, file.Instance.Version ) )
{
m.Info( $"Package '{file.Instance}' already in '{ToString()}'. Push skipped." );
skipped.Add( file );
Expand All @@ -139,7 +140,7 @@ async Task<bool> PushPackagesAsync( IActivityMonitor m, IEnumerable<LocalNPMPack
string firstDistTag = file.Instance.Version.PackageQuality.GetLabels()[0].ToString();
using( FileStream fileStream = File.OpenRead( file.FullPath ) )
{
if( GetRegistry( m ).Publish( m,
if( GetRegistry( m, true ).Publish( m,
tarballPath: file.FullPath,
isPublic: arePublicArtifacts,
scope: file.PackageScope,
Expand All @@ -160,7 +161,7 @@ async Task<bool> PushPackagesAsync( IActivityMonitor m, IEnumerable<LocalNPMPack
{
foreach( var label in file.Instance.Version.PackageQuality.GetLabels().Skip( 1 ) )
{
success &= await GetRegistry( m ).AddDistTag( m, file.Instance.Artifact.Name, file.Instance.Version, label.ToString() );
success &= await GetRegistry( m, true ).AddDistTag( m, file.Instance.Artifact.Name, file.Instance.Version, label.ToString() );
}
}
if( success )
Expand Down
Expand Up @@ -29,12 +29,14 @@ class NPMStandardRepository : NPMRepositoryBase, INPMStandardRepository
/// </summary>
public bool UsePassword { get; }

protected override Registry CreateRegistry( IActivityMonitor m )
protected override Registry CreateRegistry( IActivityMonitor m, bool throwOnError )
{
var u = new Uri( Url );
string secret = ResolveSecret( m, throwOnError );
if( secret == null ) return null;
return UsePassword
? new Registry( Client.HttpClient, "CKli", ResolveSecret( m, true ), u )
: new Registry( Client.HttpClient, ResolveSecret( m, true ), u );
? new Registry( Client.HttpClient, "CKli", secret, u )
: new Registry( Client.HttpClient, secret, u );
}
}
}
2 changes: 1 addition & 1 deletion Plugins/CK.Env.Plugin.NPM/Registry.cs
Expand Up @@ -417,7 +417,7 @@ async Task<bool> LogErrors( IActivityMonitor m, HttpResponseMessage res )
}
else
{
m.Error( "Unable to authenticate, need: " + string.Join( ",", auth ) );
m.Error( "Unable to authenticate, need: " + string.Join( ", ", auth ) );
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion Tests/CK.Env.Artifact.Tests/CK.Env.Artifact.Tests.csproj
Expand Up @@ -10,7 +10,7 @@
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.11.1--0021-develop" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions Tests/CK.Env.FileSystem.Tests/CK.Env.FileSystem.Tests.csproj
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.11.1--0021-develop" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="FluentAssertions" Version="5.9.0" />
Expand Down
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CK.Testing.Monitoring" Version="0.11.1--0021-develop" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.13.0" />
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
2 changes: 1 addition & 1 deletion Tests/CK.Env.Tests/CK.Env.Tests.csproj
Expand Up @@ -6,7 +6,7 @@
<IsPackable>False</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CK.Testing.Monitoring" Version="0.11.1--0021-develop" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.13.0" />
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
6 changes: 3 additions & 3 deletions Tests/CK.Env.XTyping.Tests/CK.Env.XTyping.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -10,7 +10,7 @@
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.11.1--0021-develop" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.13.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CK.Testing.Monitoring" Version="0.11.1--0021-develop" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
Expand Down
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CK.Testing.Monitoring" Version="0.11.1--0021-develop" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.13.0" />
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down
2 changes: 1 addition & 1 deletion Tests/Npm.Net.Tests/Npm.Net.Tests.csproj
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CK.Testing.Monitoring" Version="0.11.1--0021-develop" />
<PackageReference Include="CK.Testing.Monitoring" Version="0.13.0" />
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
Expand Down

0 comments on commit dcaa5e9

Please sign in to comment.