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

Issue with missing *.dtprog.user #6

Open
wants to merge 18 commits into
base: integration
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,7 @@ paket-files/
*.sln.iml

# Build artifacts/
**/build/
**/build/
/src/build.zip
/src/Version/Version.cs
/src/after.ssis-build.sln.targets
10 changes: 3 additions & 7 deletions src/SsisBuild.Core.Tests/DeployArgumentsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public void Pass_New_AllArguments()
var workingFolder = Fakes.RandomString();
var deploymentFilePath = Fakes.RandomString();
var serverInstance = Fakes.RandomString();
var serverInstanceUserID = Fakes.RandomString();
var serverInstancePassword = Fakes.RandomString();
var catalog = Fakes.RandomString();
var folder = Fakes.RandomString();
var projectName = Fakes.RandomString();
Expand All @@ -39,14 +37,12 @@ public void Pass_New_AllArguments()


// Execute
var deployArguments = new DeployArguments(workingFolder, deploymentFilePath, serverInstance, catalog, folder, projectName, projectPassword, eraseSensitiveInfo, serverInstanceUserID, serverInstancePassword);
var deployArguments = new DeployArguments(workingFolder, deploymentFilePath, serverInstance, catalog, folder, projectName, projectPassword, eraseSensitiveInfo);

// Assert
Assert.Equal(workingFolder, deployArguments.WorkingFolder);
Assert.Equal(deploymentFilePath, deployArguments.DeploymentFilePath);
Assert.Equal(serverInstance, deployArguments.ServerInstance);
Assert.Equal(serverInstanceUserID, deployArguments.ServerInstanceUserID);
Assert.Equal(serverInstancePassword, deployArguments.ServerInstancePassword);
Assert.Equal(catalog, deployArguments.Catalog);
Assert.Equal(folder, deployArguments.Folder);
Assert.Equal(projectName, deployArguments.ProjectName);
Expand All @@ -60,7 +56,7 @@ public void Fail_New_MissingServerInstance()
// Setup

// Execute
var exception = Record.Exception(() => new DeployArguments(null, null, null, Fakes.RandomString(), Fakes.RandomString(), Fakes.RandomString(), null, Fakes.RandomBool(), null, null));
var exception = Record.Exception(() => new DeployArguments(null, null, null, Fakes.RandomString(), Fakes.RandomString(), Fakes.RandomString(), null, Fakes.RandomBool()));

// Assert
Assert.NotNull(exception);
Expand All @@ -74,7 +70,7 @@ public void Fail_New_MissingFolder()
// Setup

// Execute
var exception = Record.Exception(() => new DeployArguments(null, null, Fakes.RandomString(), Fakes.RandomString(), null, Fakes.RandomString(), null, Fakes.RandomBool(), null, null));
var exception = Record.Exception(() => new DeployArguments(null, null, Fakes.RandomString(), Fakes.RandomString(), null, Fakes.RandomString(), null, Fakes.RandomBool()));

// Assert
Assert.NotNull(exception);
Expand Down
1 change: 1 addition & 0 deletions src/SsisBuild.Core.Tests/PackageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void Fail_InvalidProtectionLevel()
}

[Fact]
[Obsolete]
public void Fail_NoProtectionLevel()
{
// Setup
Expand Down
1 change: 1 addition & 0 deletions src/SsisBuild.Core.Tests/ProjectManifestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public void Pass_SetProtectionLevel(ProtectionLevel protectionLevel, int version
[Theory]
[InlineData(ProtectionLevel.EncryptAllWithUserKey)]
[InlineData(ProtectionLevel.EncryptSensitiveWithUserKey)]
[Obsolete]
public void Fail_UserKeyProtectionLevel(ProtectionLevel protectionLevel)
{
// Setup
Expand Down
3 changes: 3 additions & 0 deletions src/SsisBuild.Core/Builder/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public void Build(IBuildArguments buildArguments)
// Load and process project
_project.LoadFromDtproj(projectPath, buildArguments.Configuration, buildArguments.Password);

_logger.LogMessage("-------------------------------------------------------------------------------");
_logger.LogMessage($"Finished loading project files from {projectPath}.");

// replace parameter values
foreach (var buildArgumentsParameter in buildArguments.Parameters)
{
Expand Down
14 changes: 1 addition & 13 deletions src/SsisBuild.Core/Deployer/DeployArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ namespace SsisBuild.Core.Deployer
{
public class DeployArguments : IDeployArguments
{
public DeployArguments(string workingFolder, string deploymentFilePath, string serverInstance, string catalog, string folder, string projectName, string projectPassword, bool eraseSensitiveInfo, string serverInstanceUserID, string serverInstancePassword)
public DeployArguments(string workingFolder, string deploymentFilePath, string serverInstance, string catalog, string folder, string projectName, string projectPassword, bool eraseSensitiveInfo)
{
DeploymentFilePath = deploymentFilePath;
ServerInstance = serverInstance;
ServerInstanceUserID = serverInstanceUserID;
ServerInstancePassword = serverInstancePassword;
Catalog = catalog;
Folder = folder;
ProjectName = projectName;
Expand All @@ -39,10 +37,6 @@ public DeployArguments(string workingFolder, string deploymentFilePath, string s

public string ServerInstance { get; }

public string ServerInstanceUserID { get; }

public string ServerInstancePassword { get; }

public string Catalog { get; }

public string Folder { get; }
Expand All @@ -60,12 +54,6 @@ public void Validate()

if (string.IsNullOrWhiteSpace(Folder))
throw new MissingRequiredArgumentException(nameof(Folder));

if (string.IsNullOrWhiteSpace(ServerInstancePassword) && !string.IsNullOrWhiteSpace(ServerInstanceUserID))
throw new MissingRequiredArgumentException(nameof(ServerInstancePassword));

if (string.IsNullOrWhiteSpace(ServerInstanceUserID) && !string.IsNullOrWhiteSpace(ServerInstancePassword))
throw new MissingRequiredArgumentException(nameof(ServerInstanceUserID));
}
}
}
19 changes: 5 additions & 14 deletions src/SsisBuild.Core/Deployer/Deployer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ public void Deploy(IDeployArguments deployArguments)
catalog, deployArguments.Folder,
projectName,
deployArguments.ProjectPassword,
deployArguments.EraseSensitiveInfo,
deployArguments.ServerInstanceUserID,
deployArguments.ServerInstancePassword
deployArguments.EraseSensitiveInfo
),
parametersToDeploy,
deploymentProtectionLevel);
Expand All @@ -90,23 +88,16 @@ public void Deploy(IDeployArguments deployArguments)
{
ApplicationName = "SSIS Deploy",
DataSource = deployArguments.ServerInstance,
InitialCatalog = catalog
};

if (string.IsNullOrWhiteSpace(deployArguments.ServerInstanceUserID))
{
connectionString.IntegratedSecurity = true;
} else {
connectionString.UserID = deployArguments.ServerInstanceUserID;
connectionString.Password = deployArguments.ServerInstancePassword;
}
InitialCatalog = catalog,
IntegratedSecurity = true
}.ConnectionString;

using (var zipStream = new MemoryStream())
{
_project.Save(zipStream, deploymentProtectionLevel, deployArguments.ProjectPassword);
zipStream.Flush();

_catalogTools.DeployProject(connectionString.ConnectionString, deployArguments.Folder, projectName, deployArguments.EraseSensitiveInfo, parametersToDeploy, zipStream);
_catalogTools.DeployProject(connectionString, deployArguments.Folder, projectName, deployArguments.EraseSensitiveInfo, parametersToDeploy, zipStream);
}

_logger.LogMessage("");
Expand Down
2 changes: 0 additions & 2 deletions src/SsisBuild.Core/Deployer/IDeployArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public interface IDeployArguments
string WorkingFolder { get; }
string DeploymentFilePath { get; }
string ServerInstance { get; }
string ServerInstanceUserID { get; }
string ServerInstancePassword { get; }
string Catalog { get; }
string Folder { get; }
string ProjectName { get; }
Expand Down
14 changes: 2 additions & 12 deletions src/SsisBuild.Core/Deployer/SsisDeployPowershell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,10 @@ public class SsisDeployPowershell : PSCmdlet
)]
public string DeploymentFilePath { get; set; }

[Parameter(HelpMessage = "Required. Full Name of the target SQL Server instance.",
[Parameter(HelpMessage= "Required. Full Name of the target SQL Server instance.",
Mandatory = true)]
public string ServerInstance { get; set; }

[Parameter(HelpMessage = "Required. Full Name of the target SQL Server instance.",
Mandatory = true)]
public string ServerInstanceUserID { get; set; }

[Parameter(HelpMessage = "Required. Full Name of the target SQL Server instance.",
Mandatory = true)]
public string ServerInstancePassword { get; set; }

[Parameter(HelpMessage = "Name of the SSIS Catalog on the target server. If not supplied, then SSISDB value is used.")]
public string Catalog { get; set; }

Expand Down Expand Up @@ -79,9 +71,7 @@ protected override void ProcessRecord()
string.IsNullOrWhiteSpace(Folder) ? null : Folder,
string.IsNullOrWhiteSpace(ProjectName) ? null : ProjectName,
string.IsNullOrWhiteSpace(ProjectPassword) ? null : ProjectPassword,
EraseSensitiveInfo,
string.IsNullOrWhiteSpace(ServerInstanceUserID) ? null : ServerInstanceUserID,
string.IsNullOrWhiteSpace(ServerInstancePassword) ? null : ServerInstancePassword
EraseSensitiveInfo
);

_deployer = _deployer ?? new Deployer();
Expand Down
1 change: 1 addition & 0 deletions src/SsisBuild.Core/ProjectManagement/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public void LoadFromDtproj(string filePath, string configurationName, string pas
}

var userConfigurationFilePath = $"{filePath}.user";

if (File.Exists(userConfigurationFilePath))
{
var userConfiguration = new UserConfiguration(configurationName);
Expand Down
4 changes: 2 additions & 2 deletions src/SsisBuild.Core/ProjectManagement/ProjectFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ private XmlDocument PrepareXmlToSave(ProtectionLevel protectionLevel, string pas
var xmlToSave = new XmlDocument();
xmlToSave.LoadXml(FileXmlDocument.OuterXml);

if (!new []
if (!new[]
{
ProtectionLevel.DontSaveSensitive,
ProtectionLevel.EncryptSensitiveWithUserKey,
ProtectionLevel.EncryptAllWithPassword,
ProtectionLevel.EncryptSensitiveWithPassword,
ProtectionLevel.ServerStorage
}.Contains(protectionLevel))
throw new InvalidProtectionLevelException(protectionLevel);


if (protectionLevel == ProtectionLevel.EncryptAllWithPassword)
{
EncryptElement(xmlToSave.DocumentElement, password);
Expand Down
4 changes: 2 additions & 2 deletions src/SsisBuild.Core/ProjectManagement/ProjectManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ protected override IList<IParameter> ExtractParameters()
{
foreach (XmlNode packageParameterXmlNode in packageParameterXmlNodes)
{
var packageName = packageParameterXmlNode.SelectSingleNode("../../@SSIS:Name", NamespaceManager).Value;
var packageName = packageParameterXmlNode.SelectSingleNode("../../SSIS:Properties/SSIS:Property[@SSIS:Name = \"Name\"]", NamespaceManager)?.InnerText;

parameters.Add(new ProjectParameter(packageName.Remove(packageName.Length - 5), packageParameterXmlNode));
parameters.Add(new ProjectParameter(packageName, packageParameterXmlNode));
}
}

Expand Down
18 changes: 1 addition & 17 deletions src/SsisDeploy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class Program
nameof(DeployArguments.ProjectName),
nameof(DeployArguments.ProjectPassword),
nameof(DeployArguments.ServerInstance),
nameof(DeployArguments.ServerInstanceUserID),
nameof(DeployArguments.ServerInstancePassword),
};


Expand Down Expand Up @@ -71,8 +69,6 @@ internal static DeployArguments ParseCommandLineArguments(string[] args)

string deploymentFilePath = null;
string serverInstance = null;
string ServerInstanceUserID = null;
string ServerInstancePassword = null;
string catalog = null;
string folder = null;
string projectName = null;
Expand Down Expand Up @@ -122,20 +118,12 @@ internal static DeployArguments ParseCommandLineArguments(string[] args)
projectPassword = args[argPos++ + 1];
break;

case nameof(DeployArguments.ServerInstanceUserID):
ServerInstanceUserID = args[argPos++ + 1];
break;

case nameof(DeployArguments.ServerInstancePassword):
ServerInstancePassword = args[argPos++ + 1];
break;

default:
throw new InvalidTokenException(argName);
}
}

return new DeployArguments(Environment.CurrentDirectory, deploymentFilePath, serverInstance, catalog, folder, projectName, projectPassword, eraseSensitiveInfo, ServerInstanceUserID, ServerInstancePassword);
return new DeployArguments(Environment.CurrentDirectory, deploymentFilePath, serverInstance, catalog, folder, projectName, projectPassword, eraseSensitiveInfo);
}


Expand All @@ -157,10 +145,6 @@ private static void Usage()
"",
" -ServerInstance: Required. Full Name of the target SQL Server instance.",
"",
" -ServerInstanceUserID: User in case SQL Server Authentication is used (e.g. SSIS in ADFv2)",
"",
" -ServerInstancePassword: Password in case SQL Server Authentication is used (e.g. SSIS in ADFv2)",
"",
" -Catalog: Required. Name of the SSIS Catalog on the target server.",
"",
" -Folder: Required. Deployment folder within destination catalog.",
Expand Down
13 changes: 13 additions & 0 deletions src/ps-config/ssis-build.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@{
SolutionName="ssis-build"
SqlVersion="130"
SSASVersion="130"
EnableNuGetPackageRestore=$true
IgnorePackageVersioning=$False
Nuget = @(
@{
Source = "http://nuget.laterooms.io/nuget"
ApiKey = "creat10n"
}
);
}