Skip to content

Commit 332c159

Browse files
giuliovRob Osborneaok-foss
authored
Release/1.1 (#240)
* fix typos in messages * Squashed commit of the following: commit 80e7206 Author: George Roberts <[email protected]> Date: Mon Feb 8 10:51:21 2021 -0600 Remove test log line commit bf4d89d Author: George Roberts <[email protected]> Date: Sat Feb 6 23:26:55 2021 -0600 Remove some extraneous logging commit db994e3 Author: George Roberts <[email protected]> Date: Sat Feb 6 23:16:06 2021 -0600 Fix tests commit c5945cd Author: George Roberts <[email protected]> Date: Sat Feb 6 22:57:14 2021 -0600 Fix bypassrules value commit 59f338d Author: George Roberts <[email protected]> Date: Sat Feb 6 22:54:45 2021 -0600 Support for .bypassrules directive * fixed an issue which caused removing work item links to fail * Fix ".check revision false" directive disappearing on rule upload * change log * Add tests to check more double assignment cases * Fixes #229 - double assignment and reset to original value Alternative implementation to PR #236 * Fixes spurious upgrade message noted in #225 * trigger build * Fully async Co-authored-by: Rob Osborne <[email protected]> Co-authored-by: Alexander Omelchuk <[email protected]>
1 parent 9af9105 commit 332c159

28 files changed

+254
-186
lines changed

Next-Release-ChangeLog.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,29 @@ This release fixes a number of issues and introduce an additional CLI command.
33

44
CLI Commands and Options
55
========================
6-
- Removed annoying messages about new version check.
7-
- Deprecation warning on missing `--resourceGroup` option.
8-
- Changed `IDataProtectionProvider.CreateProtector` purpose string to prevent clashes.
9-
- New `update.mappings` command.
6+
- Fixes spurious upgrade message noted in #225.
107

118

129
Docker and Azure Function Hosting
1310
========================
14-
- Retry after Http 429 using Polly, address #71.
15-
- Harden Azure resources (see #225).
11+
No changes.
1612

1713

1814
Rule Language
1915
========================
20-
No changes.
16+
- Added support for `.bypassrules` directive (#83, #228).
17+
- Fixes #231 (Directive check revision false missing after `update.rule`).
2118

2219

2320
Rule Interpreter Engine
2421
========================
25-
- Address #185 by removing field when set to null value.
26-
- Impersonation does not work when a rule updates the same work item bug (#206).
22+
- Fixes #229 (Updating a work item field with impersonation enabled fails with the message: _Remove requires Value to be null_).
23+
- Fixes #234 (_Object reference not set_ when removing a work item link).
2724

2825

2926
Build, Test, Documentation
3027
========================
31-
- Terraform and PowerShell scripts to setup a dev VM.
32-
- Use latest GitVersion.
33-
- Drop log streaming in favour of reading the application log file: integration tests should become more reliable.
28+
- SonarCloud now requires Java 11.
3429

3530

3631
File Hashes

src/.build-trigger

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
.

src/aggregator-cli/Instances/FunctionRuntimePackage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ internal FunctionRuntimePackage(ILogger logger)
5757
logger.WriteVerbose($"Found {gitHubVersion.Name} on {gitHubVersion.When} in GitHub.");
5858

5959
SemVersion.TryParse(gitHubVersion.Name.Substring(1), out var latest);
60-
var current = new SemVersion(
61-
Assembly.GetEntryAssembly().GetName().Version);
60+
var asmVer = Assembly.GetEntryAssembly().GetName().Version;
61+
var current = new SemVersion(asmVer.Major, asmVer.Minor, asmVer.Build);
6262

6363
bool upgrade = latest.CompareTo(current) > 0;
6464
return upgrade

src/aggregator-cli/Mappings/UpdateMappingsCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
namespace aggregator.cli
66
{
77

8-
[Verb("update.mappings", HelpText = "Updates existing mappings from old to new Aggrergator Instance.")]
8+
[Verb("update.mappings", HelpText = "Updates existing mappings from old to new Aggregator Instance.")]
99
class UpdateMappingsCommand : CommandBase
1010
{
1111
[Option('s', "sourceInstance", Required = true, HelpText = "Source Aggregator instance name.")]
1212
public string SourceInstance { get; set; }
1313

14-
[Option('d', "destInstance", Required = true, HelpText = "Destionation Aggregator instance name.")]
14+
[Option('d', "destInstance", Required = true, HelpText = "Destination Aggregator instance name.")]
1515
public string DestInstance { get; set; }
1616

1717
[Option('g', "resourceGroup", Required = false, Default = "", HelpText = "Azure Resource Group hosting the Aggregator instance.")]

src/aggregator-cli/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Diagnostics;
44
using System.Threading;
5+
using System.Threading.Tasks;
56
using aggregator.cli.Instances;
67
using CommandLine;
78
using CommandLine.Text;
@@ -35,7 +36,7 @@ emulates the event on the rule
3536
*/
3637
public static class Program
3738
{
38-
public static int Main(string[] args)
39+
public static async Task<int> Main(string[] args)
3940
{
4041
var mainTimer = new Stopwatch();
4142
mainTimer.Start();
@@ -63,7 +64,7 @@ void cancelEventHandler(object sender, ConsoleCancelEventArgs e)
6364
{
6465
var tempLogger = new ConsoleLogger(false);
6566
var verChecker = new FunctionRuntimePackage(tempLogger);
66-
(bool upgrade, string newversion) = verChecker.IsCliUpgradable().Result;
67+
(bool upgrade, string newversion) = await verChecker.IsCliUpgradable();
6768
if (upgrade)
6869
{
6970
// bug user

src/aggregator-cli/Rules/AggregatorRules.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ internal async Task<bool> AddAsync(InstanceName instance, string ruleName, strin
164164
if (preprocessedRule.Impersonate)
165165
{
166166
_logger.WriteInfo($"Configure {ruleName} to execute impersonated.");
167-
ok &= await ConfigureAsync(instance, ruleName, impersonate: true, cancellationToken: cancellationToken);
167+
ok &= await ConfigureAsync(instance, ruleName, impersonate: true, bypassrules: false, cancellationToken: cancellationToken);
168168
if (ok)
169169
{
170170
_logger.WriteInfo($"Updated {ruleName} configuration successfully.");
@@ -339,7 +339,7 @@ internal async Task<bool> RemoveAsync(InstanceName instance, string name, Cancel
339339
return true;
340340
}
341341

342-
internal async Task<bool> ConfigureAsync(InstanceName instance, string name, bool? disable = null, bool? impersonate = null, CancellationToken cancellationToken = default)
342+
internal async Task<bool> ConfigureAsync(InstanceName instance, string name, bool? disable = null, bool? impersonate = null, bool? bypassrules = null, CancellationToken cancellationToken = default)
343343
{
344344
var webFunctionApp = await GetWebApp(instance, cancellationToken);
345345
var configuration = await AggregatorConfiguration.ReadConfiguration(webFunctionApp);
@@ -355,6 +355,11 @@ internal async Task<bool> ConfigureAsync(InstanceName instance, string name, boo
355355
ruleConfig.Impersonate = impersonate.Value;
356356
}
357357

358+
if (bypassrules.HasValue)
359+
{
360+
ruleConfig.BypassRules = impersonate.Value;
361+
}
362+
358363
ruleConfig.WriteConfiguration(webFunctionApp);
359364

360365
return true;

src/aggregator-cli/Rules/ConfigureRuleCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ internal override async Task<int> RunAsync(CancellationToken cancellationToken)
4444
var disable = GetDisableStatus(Disable, Enable);
4545
var impersonate = GetEnableStatus(DisableImpersonateExecution, EnableImpersonateExecution);
4646

47-
var ok = await rules.ConfigureAsync(instance, Name, disable, impersonate, cancellationToken);
47+
var ok = await rules.ConfigureAsync(instance, Name, disable, impersonate, false, cancellationToken);
4848
return ok ? ExitCodes.Success : ExitCodes.Failure;
4949
}
5050

src/aggregator-ruleng/IRule.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ public interface IRule
1818
/// <remarks>Setter public for CLI</remarks>
1919
bool ImpersonateExecution { get; set; }
2020

21+
/// <summary>
22+
/// WorkItem creation/updates will bypass rules
23+
/// Assumes PAT or Account Permission is high enough
24+
/// </summary>
25+
/// <remarks>Setter public for CLI</remarks>
26+
bool BypassRules { get; set; }
27+
2128
///<summary>
2229
/// Configuration data picked by the directive parser that may influence a rule behaviour.
2330
///</summary>

src/aggregator-ruleng/Language/IPreprocessedRule.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace aggregator.Engine.Language
55
{
66
public interface IPreprocessedRule
77
{
8+
bool BypassRules { get; set; }
89
bool Impersonate { get; set; }
910
IRuleSettings Settings { get; }
1011
RuleLanguage Language { get; }

src/aggregator-ruleng/Language/PreprocessedRule.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ internal class PreprocessedRule : IPreprocessedRule
88
{
99
public PreprocessedRule()
1010
{
11+
BypassRules = false;
1112
Impersonate = false;
1213
Settings = new RuleSettings();
1314
Language = RuleLanguage.Unknown;
@@ -20,6 +21,8 @@ public PreprocessedRule()
2021

2122
public bool Impersonate { get; set; }
2223

24+
public bool BypassRules { get; set; }
25+
2326
public IRuleSettings Settings { get; private set; }
2427

2528
public RuleLanguage Language { get; internal set; }

0 commit comments

Comments
 (0)