Skip to content

Commit

Permalink
fix!: manual retry needed if master instance paused (#51)
Browse files Browse the repository at this point in the history
Includes README updates and significant refactoring to move interaction with master environments from code activities to Power Automate.

BREAKING CHANGE: updating to this version requires you to re-enter app registration details on individual environment records. Plug-in steps with secure configuration will be deleted.
  • Loading branch information
ewingjm committed Dec 8, 2020
1 parent 5b0da16 commit 794d325
Show file tree
Hide file tree
Showing 112 changed files with 360 additions and 5,757 deletions.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"powershell",
"-ExecutionPolicy ByPass",
"-File build.ps1",
"--target packs-solution",
"--target pack-solution",
"--DataverseSolution ${input:solution}",
"--SolutionType ${input:solutionType}"
],
Expand Down
105 changes: 63 additions & 42 deletions README.md

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using System.Xml.Linq;
using System.Xml.XPath;
using Nuke.Common;
Expand All @@ -15,10 +13,8 @@
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.Npm;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.EnvironmentInfo;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
Expand Down
2 changes: 0 additions & 2 deletions build/Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.ComponentModel;
using System.Linq;
using Nuke.Common.Tooling;

[TypeConverter(typeof(TypeConverter<Configuration>))]
Expand Down
2 changes: 0 additions & 2 deletions build/SolutionConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;

/// <summary>
/// Configuration for a Dataverse solution.
/// </summary>
Expand Down
78 changes: 2 additions & 76 deletions deploy/PackageTemplate.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
namespace DevelopmentHub.Deployment
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Globalization;
using System.Linq;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Tooling.Connector;
using Microsoft.Xrm.Tooling.PackageDeployment.CrmPackageExtentionBase;
using Newtonsoft.Json;

/// <summary>
/// Import package starter frame.
Expand All @@ -21,8 +19,6 @@ public class PackageTemplate : ImportExtension, IDisposable
private string azureDevOpsProject;
private string azureDevOpsExtractBuildDefinitionId;
private string solutionPublisherPrefix;
private Guid? servicePrincipalClientId;
private string servicePrincipalClientSecret;
private string azureDevOpsConnectionName;
private string approvalsConnectionName;

Expand All @@ -31,7 +27,6 @@ public class PackageTemplate : ImportExtension, IDisposable
private SolutionDeploymentService solutionDeploymentSvc;
private FlowDeploymentService flowDeploymentSvc;
private EnvironmentVariableDeploymentService environmentVariableDeploymentSvc;
private PluginStepDeploymentService pluginStepDeploymentSvc;

/// <inheritdoc/>
public override string GetImportPackageDataFolderName => "PkgFolder";
Expand Down Expand Up @@ -122,38 +117,6 @@ protected string SolutionPublisherPrefix
}
}

/// <summary>
/// Gets a value for the service principal ID used for the Development Hub (if found).
/// </summary>
protected Guid? ServicePrincipalClientId
{
get
{
if (!this.servicePrincipalClientId.HasValue && Guid.TryParse(this.GetSetting<string>(nameof(this.ServicePrincipalClientId)), out var guid))
{
this.servicePrincipalClientId = guid;
}

return this.servicePrincipalClientId;
}
}

/// <summary>
/// Gets a value for the service principal client secret used for the Development Hub (if found).
/// </summary>
protected string ServicePrincipalClientSecret
{
get
{
if (string.IsNullOrEmpty(this.servicePrincipalClientSecret))
{
this.servicePrincipalClientSecret = this.GetSetting<string>(nameof(this.ServicePrincipalClientSecret));
}

return this.servicePrincipalClientSecret;
}
}

/// <summary>
/// Gets a value for the Azure DevOps connection name used for the Development Hub (if found).
/// </summary>
Expand Down Expand Up @@ -256,27 +219,10 @@ protected EnvironmentVariableDeploymentService EnvironmentVariableDeploymentSvc
}
}

/// <summary>
/// Gets an <see cref="PluginStepDeploymentService"/>.
/// </summary>
protected PluginStepDeploymentService PluginStepDeploymentSvc
{
get
{
if (this.pluginStepDeploymentSvc == null)
{
this.pluginStepDeploymentSvc = new PluginStepDeploymentService(this.CrmSvc, this.PackageLog);
}

return this.pluginStepDeploymentSvc;
}
}

/// <inheritdoc/>
public override bool AfterPrimaryImport()
{
this.SetDevelopmentHubEnvironmentVariables();
this.SetDevelopmentHubPluginStepConfigurations();
this.SetDevelopmentHubFlowConnections();

return true;
Expand All @@ -294,7 +240,6 @@ public override bool BeforeImportStage()
/// <inheritdoc/>
public override void InitializeCustomExtension()
{
return;
}

/// <inheritdoc />
Expand Down Expand Up @@ -393,19 +338,11 @@ protected T GetSetting<T>(string key)
return default;
}

private string GetInjectSecureConfigSecureConfiguration()
{
return JsonConvert.SerializeObject(new Dictionary<string, object>
{
{ "ClientId", this.ServicePrincipalClientId },
{ "ClientSecret", this.ServicePrincipalClientSecret },
{ "TenantId", this.CrmSvc.TenantId },
});
}

private void SetDevelopmentHubFlowConnections()
{
this.FlowDeploymentSvc.ActivateFlow(new Guid("db657a26-1d37-eb11-a813-000d3a0b97ca"));
this.FlowDeploymentSvc.ActivateFlow(new Guid("9bc32b76-754b-ea11-a812-000d3a0b8d0b"));
this.FlowDeploymentSvc.ActivateFlow(new Guid("c976585f-06b4-ea11-a812-000d3a86ad99"));

if (!string.IsNullOrEmpty(this.ApprovalsConnectionName))
{
Expand All @@ -418,17 +355,6 @@ private void SetDevelopmentHubFlowConnections()
}
}

private void SetDevelopmentHubPluginStepConfigurations()
{
var secureConfiguration = this.PluginStepDeploymentSvc.CreateSdkMessageProcessingStepSecureConfig(this.GetInjectSecureConfigSecureConfiguration());
var injectConfigPluginSteps = this.PluginStepDeploymentSvc.GetPluginStepsForHandler(new Guid("fdb0db23-769a-e911-a97d-002248010929"), new ColumnSet(false));

foreach (var step in injectConfigPluginSteps)
{
this.PluginStepDeploymentSvc.SetPluginSecureConfiguration(step.Id, secureConfiguration);
}
}

private void SetDevelopmentHubEnvironmentVariables()
{
this.EnvironmentVariableDeploymentSvc.SetEnvironmentVariable("devhub_AzureDevOpsOrganization", this.AzureDevOpsOrganisation);
Expand Down
106 changes: 0 additions & 106 deletions deploy/PluginStepDeploymentService.cs

This file was deleted.

Binary file modified docs/images/development.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/environment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/failedimport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/issue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/solution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/solutionmerge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)CrmPluginRegistrationAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\InArgumentExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)IntegratedWorkflowActivity.cs" />
<Compile Include="$(MSBuildThisFileDirectory)IODataRepositoryFactory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)IRepositoryFactory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Logging\ConsoleLogWriter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Logging\ILogWriter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Logging\Severity.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Logging\TracingServiceLogWriter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ODataRepositoryFactory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RepositoryFactory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WorkflowActivity.cs" />
Expand Down
24 changes: 0 additions & 24 deletions src/common/DevelopmentHub.BusinessLogic/IODataRepositoryFactory.cs

This file was deleted.

Loading

0 comments on commit 794d325

Please sign in to comment.