Skip to content

Commit

Permalink
Merge pull request #214 from JeremiahSanders/release/1.14.0
Browse files Browse the repository at this point in the history
Release/1.14.0
  • Loading branch information
JeremiahSanders authored Feb 14, 2025
2 parents 0c6b4df + 74a1634 commit 50ec3c6
Show file tree
Hide file tree
Showing 31 changed files with 1,231 additions and 319 deletions.
64 changes: 36 additions & 28 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ indent_size = 2
# Organize usings
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
file_header_template = # this. and Me. preferences
file_header_template = # this. and Me. preferences

dotnet_style_qualification_for_event = false:silent
dotnet_style_qualification_for_field = false:silent
Expand Down Expand Up @@ -287,63 +287,63 @@ dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase

dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interfaces.required_modifiers =
dotnet_naming_symbols.interfaces.required_modifiers =

dotnet_naming_symbols.enums.applicable_kinds = enum
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.enums.required_modifiers =
dotnet_naming_symbols.enums.required_modifiers =

dotnet_naming_symbols.events.applicable_kinds = event
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.events.required_modifiers =
dotnet_naming_symbols.events.required_modifiers =

dotnet_naming_symbols.methods.applicable_kinds = method
dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.methods.required_modifiers =
dotnet_naming_symbols.methods.required_modifiers =

dotnet_naming_symbols.properties.applicable_kinds = property
dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.properties.required_modifiers =
dotnet_naming_symbols.properties.required_modifiers =

dotnet_naming_symbols.public_fields.applicable_kinds = field
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
dotnet_naming_symbols.public_fields.required_modifiers =
dotnet_naming_symbols.public_fields.required_modifiers =

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_fields.required_modifiers =
dotnet_naming_symbols.private_fields.required_modifiers =

dotnet_naming_symbols.private_static_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_static_fields.required_modifiers = static

dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
dotnet_naming_symbols.types_and_namespaces.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.non_field_members.required_modifiers =

dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
dotnet_naming_symbols.type_parameters.required_modifiers =
dotnet_naming_symbols.type_parameters.required_modifiers =

dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_constant_fields.required_modifiers = const

dotnet_naming_symbols.local_variables.applicable_kinds = local
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
dotnet_naming_symbols.local_variables.required_modifiers =
dotnet_naming_symbols.local_variables.required_modifiers =

dotnet_naming_symbols.local_constants.applicable_kinds = local
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
dotnet_naming_symbols.local_constants.required_modifiers = const

dotnet_naming_symbols.parameters.applicable_kinds = parameter
dotnet_naming_symbols.parameters.applicable_accessibilities = *
dotnet_naming_symbols.parameters.required_modifiers =
dotnet_naming_symbols.parameters.required_modifiers =

dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
Expand All @@ -359,49 +359,52 @@ dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readon

dotnet_naming_symbols.local_functions.applicable_kinds = local_function
dotnet_naming_symbols.local_functions.applicable_accessibilities = *
dotnet_naming_symbols.local_functions.required_modifiers =
dotnet_naming_symbols.local_functions.required_modifiers =

# Naming styles

dotnet_naming_style.pascalcase.required_prefix =
dotnet_naming_style.pascalcase.required_suffix =
dotnet_naming_style.pascalcase.word_separator =
dotnet_naming_style.pascalcase.required_prefix =
dotnet_naming_style.pascalcase.required_suffix =
dotnet_naming_style.pascalcase.word_separator =
dotnet_naming_style.pascalcase.capitalization = pascal_case

dotnet_naming_style.ipascalcase.required_prefix = I
dotnet_naming_style.ipascalcase.required_suffix =
dotnet_naming_style.ipascalcase.word_separator =
dotnet_naming_style.ipascalcase.required_suffix =
dotnet_naming_style.ipascalcase.word_separator =
dotnet_naming_style.ipascalcase.capitalization = pascal_case

dotnet_naming_style.tpascalcase.required_prefix = T
dotnet_naming_style.tpascalcase.required_suffix =
dotnet_naming_style.tpascalcase.word_separator =
dotnet_naming_style.tpascalcase.required_suffix =
dotnet_naming_style.tpascalcase.word_separator =
dotnet_naming_style.tpascalcase.capitalization = pascal_case

dotnet_naming_style._camelcase.required_prefix = _
dotnet_naming_style._camelcase.required_suffix =
dotnet_naming_style._camelcase.word_separator =
dotnet_naming_style._camelcase.required_suffix =
dotnet_naming_style._camelcase.word_separator =
dotnet_naming_style._camelcase.capitalization = camel_case

dotnet_naming_style.camelcase.required_prefix =
dotnet_naming_style.camelcase.required_suffix =
dotnet_naming_style.camelcase.word_separator =
dotnet_naming_style.camelcase.required_prefix =
dotnet_naming_style.camelcase.required_suffix =
dotnet_naming_style.camelcase.word_separator =
dotnet_naming_style.camelcase.capitalization = camel_case

# ReSharper properties
resharper_arguments_literal = named
resharper_arguments_string_literal = named
resharper_autodetect_indent_settings = true
resharper_blank_lines_before_control_transfer_statements = 1
resharper_blank_lines_between_using_groups = 1
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_ifelse = required
resharper_braces_for_while = required
resharper_braces_redundant = false
resharper_csharp_case_block_braces = next_line_shifted_2
resharper_csharp_wrap_after_declaration_lpar = true
resharper_csharp_wrap_after_invocation_lpar = true
resharper_csharp_wrap_arguments_style = chop_if_long
resharper_csharp_wrap_before_invocation_rpar = true
resharper_csharp_wrap_parameters_style = chop_if_long
resharper_default_value_when_type_not_evident = default_expression
resharper_enforce_line_ending_style = true
resharper_formatter_off_tag = @formatter:off
Expand All @@ -411,10 +414,12 @@ resharper_for_built_in_types = use_explicit_type
resharper_for_other_types = use_explicit_type
resharper_for_simple_types = use_explicit_type
resharper_keep_existing_declaration_block_arrangement = false
resharper_keep_existing_embedded_block_arrangement = true
resharper_keep_existing_embedded_block_arrangement = false
resharper_keep_existing_enum_arrangement = true
resharper_keep_existing_initializer_arrangement = false
resharper_keep_existing_linebreaks = false
resharper_keep_existing_linebreaks = true
resharper_keep_existing_primary_constructor_declaration_parens_arrangement = true
resharper_keep_user_linebreaks = true
resharper_max_array_initializer_elements_on_line = 1
resharper_modifiers_order = public private protected internal static extern new virtual abstract sealed override readonly unsafe volatile async file required
resharper_parentheses_group_non_obvious_operations = none, arithmetic, relational, conditional
Expand All @@ -423,7 +428,10 @@ resharper_place_simple_initializer_on_single_line = false
resharper_space_within_single_line_array_initializer_braces = false
resharper_use_heuristics_for_body_style = false
resharper_use_indent_from_vs = false
resharper_wrap_before_first_method_call = true
resharper_wrap_before_primary_constructor_declaration_lpar = false
resharper_wrap_before_primary_constructor_declaration_rpar = true
resharper_wrap_chained_method_calls = chop_always

# ReSharper inspection severities
resharper_arrange_accessor_owner_body_highlighting = none
Expand Down
2 changes: 1 addition & 1 deletion .project-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cicee",
"description": "Runs continuous integration workloads via docker-compose, locally or on a build server.",
"title": "Continuous Integration Containerized Execution Environment (CICEE)",
"version": "1.13.0",
"version": "1.14.0",
"ciEnvironment": {
"variables": [
{
Expand Down
13 changes: 13 additions & 0 deletions bin/cicee-local-compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -o errexit # Fail or exit immediately if there is an error.
set -o nounset # Fail if an unset variable is used.
set -o pipefail # Fail pipelines if any command errors, not just the last one.

# Build a local CICEE executable and use its exec command to invoke 'ci/bin/compose.sh'.

# Context
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
SCRIPT_LOCATION="$(dirname "${BASH_SOURCE[0]}")"

"${SCRIPT_LOCATION}/cicee-local.sh" exec --harness direct --project-root "${PROJECT_ROOT}" --command "ci/bin/compose.sh" --verbosity "Verbose"
13 changes: 13 additions & 0 deletions bin/cicee-local-validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -o errexit # Fail or exit immediately if there is an error.
set -o nounset # Fail if an unset variable is used.
set -o pipefail # Fail pipelines if any command errors, not just the last one.

# Build a local CICEE executable and use its exec command to invoke 'ci/bin/validate.sh'.

# Context
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
SCRIPT_LOCATION="$(dirname "${BASH_SOURCE[0]}")"

"${SCRIPT_LOCATION}/cicee-local.sh" exec --harness direct --project-root "${PROJECT_ROOT}" --command "ci/bin/validate.sh" --verbosity "Verbose"
25 changes: 25 additions & 0 deletions bin/cicee-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -o errexit # Fail or exit immediately if there is an error.
set -o nounset # Fail if an unset variable is used.
set -o pipefail # Fail pipelines if any command errors, not just the last one.

# Execute the normal cicee-exec.sh entrypoint (normally used by CICEE) from current source, providing the variables which CICEE would normally provide.

# Context
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
LOCAL_CICEE_TEMP_DIR="${TMPDIR}/cicee-entrypoint"

function __generate_cicee_binary(){
targetFramework="net8.0"
# Publish the application so we can work with CICEE similarly to other projects
# NOTE: Previous implementations used `dotnet run -- lib`. This stopped working.
# When using `dotnet run` the raw output to STDOUT is prefixed with invisible control characters. Those characters trigger file not found responses from `source <path>`.
# However, if the DLL is executed with `dotnet <dll>` then the output of STDOUT lacks the control characters and it can be loaded with `source`.
rm -rf "${LOCAL_CICEE_TEMP_DIR}" &&
mkdir -p "${LOCAL_CICEE_TEMP_DIR}" &&
dotnet publish "${PROJECT_ROOT}/src" --framework "${targetFramework}" --output "${LOCAL_CICEE_TEMP_DIR}"
}

# Now run 'exec' using the Direct harness
__generate_cicee_binary && dotnet "${LOCAL_CICEE_TEMP_DIR}/cicee.dll" $@
Empty file modified ci/example.env.local.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/Cicee.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PropertyGroup>
<Authors>jds</Authors>
<Company/>
<Copyright>Copyright (c) 2024 Jeremiah Sanders</Copyright>
<Copyright>Copyright (c) 2025 Jeremiah Sanders</Copyright>
<Description>Continuous Integration Containerized Execution Environment</Description>
<PackageId>cicee</PackageId>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
55 changes: 50 additions & 5 deletions src/Commands/Exec/ExecCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,73 @@ private static Option<string> ServiceCommandOption()
};
}

private static Option<ExecInvocationHarness> InvocationHarnessOption()
{
return new Option<ExecInvocationHarness>(
new[]
{
"--harness",
"-h"
},
() => ExecInvocationHarness.Script,
description:
"Invocation harness. Determines if CICEE directly invokes Docker commands or uses a shell script to invoke Docker commands."
)
{
IsRequired = false
};
}

private static Option<ExecVerbosity> VerbosityOption()
{
return new Option<ExecVerbosity>(
new[]
{
"--verbosity",
"-v"
},
() => ExecVerbosity.Normal,
description:
"Execution progress verbosity. Only applicable when using 'Direct' harness."
)
{
IsRequired = false
};
}

public static Command Create(CommandDependencies dependencies)
{
Option<string> projectRoot = ProjectRootOption.Create(dependencies);
Option<string> serviceCommand = ServiceCommandOption();
Option<string?> serviceEntrypoint = ServiceEntrypointOption();
Option<string?> image = ImageOption();
Option<ExecInvocationHarness> harness = InvocationHarnessOption();
Option<ExecVerbosity> verbosity = VerbosityOption();
Command command = new(name: "exec", description: "Execute a command in a containerized execution environment.")
{
projectRoot, serviceCommand, serviceEntrypoint, image
projectRoot,
serviceCommand,
serviceEntrypoint,
image,
harness,
verbosity
};
command.SetHandler<string, string?, string?, string?>(
(rootValue, commandValue, entrypointValue, imageValue) => ExecEntrypoint.HandleAsync(
command.SetHandler<string, string?, string?, string?, ExecInvocationHarness, ExecVerbosity>(
(rootValue, commandValue, entrypointValue, imageValue, harnessValue, verbosityValue) => ExecEntrypoint.HandleAsync(
dependencies,
rootValue,
commandValue,
entrypointValue,
imageValue
imageValue,
harnessValue,
verbosityValue
),
projectRoot,
serviceCommand,
serviceEntrypoint,
image
image,
harness,
verbosity
);
return command;
}
Expand Down
24 changes: 15 additions & 9 deletions src/Commands/Exec/ExecEntrypoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ namespace Cicee.Commands.Exec;

public static class ExecEntrypoint
{
public static async Task<int> HandleAsync(CommandDependencies dependencies, string projectRoot, string? command,
string? entrypoint, string? image)
public static async Task<int> HandleAsync(
CommandDependencies dependencies,
string projectRoot,
string? command,
string? entrypoint,
string? image,
ExecInvocationHarness harness,
ExecVerbosity verbosity
)
{
return (await ExecHandling.HandleAsync(dependencies, new ExecRequest(projectRoot, command, entrypoint, image)))
.TapFailure(
exception =>
{
dependencies.StandardErrorWriteLine(exception.ToExecutionFailureMessage());
}
).ToExitCode();
ExecHandler handler = new(dependencies);
ExecRequest request = new(projectRoot, command, entrypoint, image, harness, verbosity);

return (await handler.HandleAsync(request))
.TapFailure(exception => dependencies.StandardErrorWriteLine(exception.ToExecutionFailureMessage()))
.ToExitCode();
}
}
Loading

0 comments on commit 50ec3c6

Please sign in to comment.