-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #655 from aws/dev
chore: release 0.49
- Loading branch information
Showing
3 changed files
with
70 additions
and
21 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
test/AWS.Deploy.CLI.IntegrationTests/Helpers/TestEnvironmentVariableManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using AWS.Deploy.Orchestration.Utilities; | ||
|
||
namespace AWS.Deploy.CLI.IntegrationTests.Helpers | ||
{ | ||
public class TestEnvironmentVariableManager : IEnvironmentVariableManager | ||
{ | ||
public readonly Dictionary<string, string> store = new Dictionary<string, string>(); | ||
|
||
public string GetEnvironmentVariable(string variable) | ||
{ | ||
return store.ContainsKey(variable) ? store[variable] : null; | ||
} | ||
|
||
public void SetEnvironmentVariable(string variable, string value) | ||
{ | ||
if (string.Equals(variable, "AWS_DOTNET_DEPLOYTOOL_WORKSPACE")) | ||
store[variable] = value; | ||
else | ||
Environment.SetEnvironmentVariable(variable, value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
using AWS.Deploy.Orchestration.Utilities; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
namespace AWS.Deploy.CLI.IntegrationTests.Helpers | ||
{ | ||
public static class Utilities | ||
{ | ||
/// <summary> | ||
/// This method sets a custom workspace which will be used by the deploy tool to create and run the CDK project and any temporary files during the deployment. | ||
/// It also adds a nuget.config file that references a private nuget-cache. This cache holds the latest (in-development/unreleased) version of AWS.Deploy.Recipes.CDK.Common.nupkg file | ||
/// </summary> | ||
public static void OverrideDefaultWorkspace(ServiceProvider serviceProvider, string customWorkspace) | ||
{ | ||
var environmentVariableManager = serviceProvider.GetRequiredService<IEnvironmentVariableManager>(); | ||
environmentVariableManager.SetEnvironmentVariable("AWS_DOTNET_DEPLOYTOOL_WORKSPACE", customWorkspace); | ||
Directory.CreateDirectory(customWorkspace); | ||
|
||
var nugetCachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".aws-dotnet-deploy", "Projects", "nuget-cache"); | ||
nugetCachePath = nugetCachePath.Replace(Path.DirectorySeparatorChar, '/'); | ||
|
||
var nugetConfigContent = $@" | ||
<?xml version=""1.0"" encoding=""utf-8"" ?> | ||
<configuration> | ||
<packageSources> | ||
<add key=""deploy-tool-cache"" value=""{nugetCachePath}"" /> | ||
</packageSources> | ||
</configuration> | ||
".Trim(); | ||
|
||
File.WriteAllText(Path.Combine(customWorkspace, "nuget.config"), nugetConfigContent); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters