Skip to content

Commit

Permalink
Merge branch 'release/2.23.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Jun 3, 2024
2 parents 360d27f + 9c620cb commit 45b1198
Show file tree
Hide file tree
Showing 359 changed files with 32,152 additions and 7,130 deletions.
456 changes: 442 additions & 14 deletions .editorconfig

Large diffs are not rendered by default.

27 changes: 8 additions & 19 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,11 @@ jobs:
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

attestations: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected]

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
Expand Down Expand Up @@ -76,15 +70,10 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
TAGS: ${{ steps.docker_meta.outputs.tags }}
run: cosign sign --yes "${TAGS}@${DIGEST}"
# Generate artifact attestation
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.build-and-push.outputs.digest }}
push-to-registry: true
4 changes: 4 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ jobs:
path: TestResults
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Install dotnet format
run: dotnet tool update -g dotnet-format
- name: Check Format
run: dotnet format --verify-no-changes --severity error src/
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [2.22.8](https://github.com/Terradue/Stars/compare/2.22.7...2.22.8)
## [2.23.0](https://github.com/Terradue/Stars/compare/2.22.8...2.23.0)

### Merged

- PeruSAT metadata extractor [`#60`](https://github.com/Terradue/Stars/pull/60)
- TERRAPI-27: Assets Filtering for geosquare publication [`#59`](https://github.com/Terradue/Stars/pull/59)
- Sentinel-2 download from Google Cloud Storage [`#54`](https://github.com/Terradue/Stars/pull/54)

### Commits

- dotnet-format [`e89b324`](https://github.com/Terradue/Stars/commit/e89b324f803e4920abc3a9e8211a637cb55f050c)
- Preliminary additions for PeruSAT [`b9fc9d5`](https://github.com/Terradue/Stars/commit/b9fc9d5257b199e58c49200450234272ef7cac02)
- file headers [`d711d61`](https://github.com/Terradue/Stars/commit/d711d61a344ca8a4df3d0e80b28d9ad736931ccb)

## [2.22.8](https://github.com/Terradue/Stars/compare/2.22.7...2.22.8) - 2024-05-23

### Commits

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"template": "keepachangelog",
"unreleased": false,
"hideEmptyReleases": true,
"ignoreCommitPattern": "^(.{0,5}|.*bump.*|ready.*|.*changelog.*|.*formatting.*|.*typo.*)$",
"ignoreCommitPattern": "^(.{0,5}|.*bump.*|ready.*|.*changelog.*|.*formatting.*|.*typo.*|chore:.*)$",
"releaseSummary": true
}
}
6 changes: 4 additions & 2 deletions src/Stars.Console.Tests/BaseCommandLineTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using McMaster.Extensions.CommandLineUtils;
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: BaseCommandLineTests.cs

using Terradue.Stars.Console;
using Xunit;
using Xunit.Abstractions;
Expand Down
7 changes: 4 additions & 3 deletions src/Stars.Console.Tests/Utilities/CommandLineParser.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Nate McMaster.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: CommandLineParser.cs

using System.IO;
using McMaster.Extensions.CommandLineUtils;
Expand Down Expand Up @@ -27,4 +28,4 @@ private static T ParseArgsImpl<T>(IConsole console, string[] args) where T : cla
return app.Model;
}
}
}
}
7 changes: 4 additions & 3 deletions src/Stars.Console.Tests/Utilities/ConventionTestBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Nate McMaster.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: ConventionTestBase.cs

using McMaster.Extensions.CommandLineUtils;
using McMaster.Extensions.CommandLineUtils.Conventions;
Expand All @@ -25,4 +26,4 @@ protected CommandLineApplication<T> Create<T, TConvention>()
return app;
}
}
}
}
6 changes: 5 additions & 1 deletion src/Stars.Console.Tests/Utilities/TestConsole.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: TestConsole.cs

using System;
using System.IO;
using System.Linq;
using System.Reflection;
using Xunit.Abstractions;
using McMaster.Extensions.CommandLineUtils;
using Xunit.Abstractions;
using Xunit.Sdk;

namespace Stars.Console.Tests
Expand Down
4 changes: 4 additions & 0 deletions src/Stars.Console.Tests/Utilities/XunitTextWriter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: XunitTextWriter.cs

using System.IO;
using System.Text;
using Xunit.Abstractions;
Expand Down
8 changes: 6 additions & 2 deletions src/Stars.Console/ConsoleCredentialsManager.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: ConsoleCredentialsManager.cs

using System;
using System.Net;
using McMaster.Extensions.CommandLineUtils;
Expand Down Expand Up @@ -66,7 +70,7 @@ private void PromptSaveCredentials(ICredentials cred, Uri uri, string authType)
private void SaveCredentials(ICredentials cred, Uri uri, string authType)
{
CredentialsConfigurationSection credConfigSection = cred.ToCredentialsConfigurationSection(uri, authType);
consoleUserSettings.AddOrUpdateSetting<CredentialsConfigurationSection>("Credentials:" + Guid.NewGuid().ToString(), credConfigSection);
consoleUserSettings.AddOrUpdateSetting("Credentials:" + Guid.NewGuid().ToString(), credConfigSection);
}

private NetworkCredential PromptCredentials(Uri uri, string authType)
Expand Down Expand Up @@ -119,4 +123,4 @@ private NetworkCredential PromptCredentials(Uri uri, string authType)
return new NetworkCredential(username, pass);
}
}
}
}
9 changes: 6 additions & 3 deletions src/Stars.Console/ConsoleUserSettings.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: ConsoleUserSettings.cs

using System;
using System.IO;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Terradue.Stars.Console
{
internal class ConsoleUserSettings
{
private readonly string userSettingsFilePath = Path.Join(System.Environment.GetEnvironmentVariable("HOME"), ".config", "Stars" , "usersettings.json");
private readonly string userSettingsFilePath = Path.Join(System.Environment.GetEnvironmentVariable("HOME"), ".config", "Stars", "usersettings.json");
private readonly ILogger logger;
private readonly IConfigurationRoot configuration;

Expand Down Expand Up @@ -75,4 +78,4 @@ private void SetValueRecursively<T>(string sectionPathKey, dynamic jsonObj, T va
}
}
}
}
}
39 changes: 21 additions & 18 deletions src/Stars.Console/Operations/BaseOperation.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: BaseOperation.cs

using System;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.Loader;
using System.Threading;
using System.Threading.Tasks;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Terradue.Stars.Services;
using Microsoft.Extensions.Configuration.EnvironmentVariables;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading;

namespace Terradue.Stars.Console.Operations
{
Expand All @@ -38,7 +41,7 @@ internal abstract class BaseOperation

public BaseOperation(IConsole console)
{
this._console = console;
_console = console;
}

protected IServiceProvider ServiceProvider { get; private set; }
Expand All @@ -57,7 +60,7 @@ private string GetBasePath()
{

using var processModule = Process.GetCurrentProcess().MainModule;
return Path.GetDirectoryName(processModule?.FileName);
return Path.GetDirectoryName(processModule?.FileName);
}

public async Task<int> OnExecuteAsync(CancellationToken ct)
Expand Down Expand Up @@ -107,7 +110,7 @@ private ServiceCollection RegisterServices()
// tell the builder to look for the appsettings.json file
builder.AddNewtonsoftJsonFile("/etc/Stars/appsettings.json", optional: true);
foreach (var jsonFilename in Directory.EnumerateFiles(GetBasePath(), "stars-*.json", SearchOption.TopDirectoryOnly))
builder.AddNewtonsoftJsonFile(jsonFilename);
builder.AddNewtonsoftJsonFile(jsonFilename);

if (Directory.Exists("/etc/Stars/conf.d"))
{
Expand All @@ -120,7 +123,7 @@ private ServiceCollection RegisterServices()
//only add secrets in development
if (isDevelopment)
{
var binPath = Path.GetDirectoryName((new System.Uri(Assembly.GetExecutingAssembly().Location)).AbsolutePath);
var binPath = Path.GetDirectoryName((new Uri(Assembly.GetExecutingAssembly().Location)).AbsolutePath);
foreach (var jsonFilename in Directory.EnumerateFiles(binPath, "stars-*.json", SearchOption.TopDirectoryOnly))
builder.AddNewtonsoftJsonFile(jsonFilename);
builder.AddNewtonsoftJsonFile("appsettings.Development.json", optional: true);
Expand All @@ -143,10 +146,10 @@ private ServiceCollection RegisterServices()



collection.AddSingleton<IConfigurationRoot>(Configuration);
collection.AddSingleton(Configuration);

// Add the command line services
collection.AddSingleton<IConsole>(_console);
collection.AddSingleton(_console);
collection.AddSingleton<ILogger>(logger);

// Add Stars Services
Expand All @@ -172,10 +175,10 @@ private ServiceCollection RegisterServices()
private int GetVerbosityLevel()
{
int verbosity = 0;
if ( Verbose )
verbosity ++;
if ( Trace )
if (Verbose)
verbosity++;

if (Trace)
verbosity = 2;

return verbosity;
Expand All @@ -190,12 +193,12 @@ private static void DisposeServices(IServiceProvider serviceProvider)
return;
}

if (serviceProvider is IDisposable)
if (serviceProvider is IDisposable disposable)
{
((IDisposable)serviceProvider).Dispose();
disposable.Dispose();
}

}

}
}
}
49 changes: 25 additions & 24 deletions src/Stars.Console/Operations/CopyOperation.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
// Copyright (c) by Terradue Srl. All Rights Reserved.
// License under the AGPL, Version 3.0.
// File Name: CopyOperation.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Stac;
using Terradue.Stars.Interface;
using Terradue.Stars.Interface.Processing;
using Terradue.Stars.Interface.Router;
using Terradue.Stars.Interface.Router.Translator;
using Terradue.Stars.Interface.Supplier;
using Terradue.Stars.Interface.Supplier.Destination;
using Terradue.Stars.Services;
using Terradue.Stars.Services.Model.Stac;
using Terradue.Stars.Services.Router;
using Terradue.Stars.Services.Plugins;
using Terradue.Stars.Services.Processing;
using Terradue.Stars.Services.Router;
using Terradue.Stars.Services.Store;
using Terradue.Stars.Services.Supplier;
using Terradue.Stars.Services.Supplier.Carrier;
using Terradue.Stars.Services.Translator;
using Terradue.Stars.Services.Supplier;
using Terradue.Stars.Interface.Processing;
using Terradue.Stars.Interface;
using Terradue.Stars.Services;
using Terradue.Stars.Services.Store;
using System.Net;
using Newtonsoft.Json;
using System.Text.RegularExpressions;
using Terradue.Stars.Services.Plugins;
using Stac;
using System.Threading;

namespace Terradue.Stars.Console.Operations
{
Expand Down Expand Up @@ -340,16 +341,16 @@ private PluginList<ISupplier> InitSuppliersEnumerator(IResource route, SupplierF

protected override async Task ExecuteAsync(CancellationToken ct)
{
this.routingService = ServiceProvider.GetService<RouterService>();
this.carrierManager = ServiceProvider.GetService<CarrierManager>();
this.processingManager = ServiceProvider.GetService<ProcessingManager>();
this.storeService = ServiceProvider.GetService<StacStoreService>();
this.translatorManager = ServiceProvider.GetService<TranslatorManager>();
this.supplierManager = ServiceProvider.GetService<SupplierManager>();
this.stacLinkTranslator = ServiceProvider.GetService<StacLinkTranslator>();
this.resourceServiceProvider = ServiceProvider.GetService<IResourceServiceProvider>();
routingService = ServiceProvider.GetService<RouterService>();
carrierManager = ServiceProvider.GetService<CarrierManager>();
processingManager = ServiceProvider.GetService<ProcessingManager>();
storeService = ServiceProvider.GetService<StacStoreService>();
translatorManager = ServiceProvider.GetService<TranslatorManager>();
supplierManager = ServiceProvider.GetService<SupplierManager>();
stacLinkTranslator = ServiceProvider.GetService<StacLinkTranslator>();
resourceServiceProvider = ServiceProvider.GetService<IResourceServiceProvider>();
var stacRouter = ServiceProvider.GetService<StacRouter>();
await this.storeService.InitAsync(ct, !AppendCatalog);
await storeService.InitAsync(ct, !AppendCatalog);
InitRoutingTask();
await PrepareNewRouteAsync(null, storeService.RootCatalogNode, null, null, ct);
routingService.OnRoutingException((res, router, ex, state, ct) => Task.FromResult(OnRoutingException(res, router, ex, state, ct)));
Expand All @@ -372,7 +373,7 @@ protected override async Task ExecuteAsync(CancellationToken ct)
CopyOperationState copyState = state as CopyOperationState;
stacNodes.Add(copyState.CurrentStacObject);
}
storeService.RootCatalogNode.StacCatalog.UpdateLinks(stacNodes.SelectMany<StacNode, IResource>(sn =>
storeService.RootCatalogNode.StacCatalog.UpdateLinks(stacNodes.SelectMany(sn =>
{
if (sn is StacItemNode) return new IResource[] { sn };
if (sn is StacCatalogNode) return sn.GetRoutes(stacRouter);
Expand Down Expand Up @@ -435,4 +436,4 @@ protected override void RegisterOperationServices(ServiceCollection collection)
}
}
}
}
}
Loading

0 comments on commit 45b1198

Please sign in to comment.