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

Release version 0.7.2 #1328

Merged
merged 49 commits into from
May 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
41e8c19
chore(deps): bump jackson from 2.17.0 to 2.17.1
dependabot[bot] May 6, 2024
caf79a2
chore: deps file
wolf4ood May 6, 2024
913b4b3
fix: add notice.md to docker build for Mock Connector (#1287)
paullatzelsperger May 6, 2024
99c50cd
Merge pull request #1283 from eclipse-tractusx/dependabot/gradle/main…
wolf4ood May 6, 2024
5bca63b
chore(deps): bump flyway from 10.11.1 to 10.12.0
dependabot[bot] May 6, 2024
5fa5da4
chore: deps file
wolf4ood May 7, 2024
ae770d8
chore: deps file
wolf4ood May 7, 2024
7094827
Merge pull request #1282 from eclipse-tractusx/dependabot/gradle/main…
wolf4ood May 7, 2024
e636310
chore(deps): bump aws from 2.25.40 to 2.25.46
dependabot[bot] May 7, 2024
bfe30be
chore: deps file
wolf4ood May 7, 2024
598f08c
Merge pull request #1289 from eclipse-tractusx/dependabot/gradle/main…
wolf4ood May 7, 2024
ae43c7f
chore(deps): bump com.azure:azure-identity from 1.12.0 to 1.12.1
dependabot[bot] May 7, 2024
7e16ca4
chore: deps file
wolf4ood May 7, 2024
b0bf36c
Merge pull request #1280 from eclipse-tractusx/dependabot/gradle/main…
wolf4ood May 7, 2024
545917e
chore: rename sokrates/plato => consumer/provider
wolf4ood May 8, 2024
cf1ac5d
Merge pull request #1290 from wolf4ood/chore/tests_renaming
wolf4ood May 8, 2024
fd92b43
chore: add more iatp tests on spoofing credentials
wolf4ood Apr 29, 2024
395bbe3
Merge pull request #1291 from wolf4ood/chore/more_iatp_tests
wolf4ood May 8, 2024
d525ec0
chore(deps): bump aquasecurity/trivy-action from 0.19.0 to 0.20.0
dependabot[bot] May 13, 2024
8a6163c
chore(deps): bump mikefarah/yq from 4.43.1 to 4.44.1
dependabot[bot] May 13, 2024
f62d664
chore(deps): bump testcontainers from 1.19.7 to 1.19.8
dependabot[bot] May 13, 2024
09a5a9f
chore: deps file
wolf4ood May 13, 2024
f94c3aa
Merge pull request #1297 from eclipse-tractusx/dependabot/gradle/main…
wolf4ood May 13, 2024
2fcc111
chore(deps): bump aws from 2.25.46 to 2.25.50
dependabot[bot] May 13, 2024
cf5796a
chore: deps file
wolf4ood May 13, 2024
8a966f8
Merge pull request #1296 from eclipse-tractusx/dependabot/gradle/main…
wolf4ood May 13, 2024
841533b
Merge pull request #1294 from eclipse-tractusx/dependabot/github_acti…
wolf4ood May 13, 2024
c71e98e
Merge pull request #1293 from eclipse-tractusx/dependabot/github_acti…
wolf4ood May 13, 2024
6f1af11
chore(deps): bump thomaseizinger/create-pull-request from 1.3.1 to 1.4.0
dependabot[bot] May 13, 2024
69677e4
Merge pull request #1292 from eclipse-tractusx/dependabot/github_acti…
wolf4ood May 13, 2024
9307fd8
chore: disable dim int test (#1300)
wolf4ood May 13, 2024
c6b1b31
feat: make auto_refresh default to true (#1301)
paullatzelsperger May 14, 2024
b47551b
fix: make azure vault related variables in deployment chart optional …
maciej-umanski May 14, 2024
ba2d4d3
chore: harmonize settings names (with backwards compat) (#1307)
paullatzelsperger May 14, 2024
6a27157
chore(deps): bump EDC to 0.6.4 (#1308)
paullatzelsperger May 14, 2024
e037eba
fix: add checks on accessTokenData not found in AuthTokenAudienceRule…
wolf4ood May 15, 2024
95370e4
build(deps): align eclipse-temurin versions to 22.0.1_8-jre-alpine (#…
ndr-brt May 16, 2024
47b2aff
feat(ci): add multi-t pushk8s versions test (#1314)
paullatzelsperger May 17, 2024
724b40d
docs: switch upstream openapi spec fetch from SH to GP (#1317)
ndr-brt May 17, 2024
cfe7299
chore(deps): bump aws from 2.25.50 to 2.25.55 (#1322)
dependabot[bot] May 20, 2024
9785be0
chore(deps): bump flyway from 10.12.0 to 10.13.0 (#1311)
dependabot[bot] May 20, 2024
924e99a
chore(deps): bump com.azure:azure-security-keyvault-secrets from 4.8.…
dependabot[bot] May 20, 2024
846ed09
Update gradle.properties
paullatzelsperger May 22, 2024
d366110
chore: updates edc to 0.7.0 (#1323)
wolf4ood May 22, 2024
d621224
fix(ci): add Mocked EDC to automatic artefact release (#1324)
paullatzelsperger May 22, 2024
a33c1a2
chore: updates policies examples (#1326)
wolf4ood May 23, 2024
f207da4
chore: manually bump the previous version
paullatzelsperger May 23, 2024
292b53c
Prepare release 0.7.2
eclipse-tractusx-bot May 23, 2024
8899023
Merge branch 'releases' into release/0.7.2
paullatzelsperger May 23, 2024
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
Prev Previous commit
Next Next commit
chore: harmonize settings names (with backwards compat) (#1307)
* chore: harmonize settings names (with backwards compat)

* update test settings

* checkstyle
  • Loading branch information
paullatzelsperger authored May 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit ba2d4d37b839411dd25da26b29a350142259273f
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

package org.eclipse.tractusx.edc.core.utils;

import org.eclipse.edc.spi.EdcException;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.jetbrains.annotations.NotNull;

public class ConfigUtil {

public static final String DEPRECATION_WARNING = "Deprecated property used: '%s'. Please consider using the new property '%s' instead.";

public static void missingMandatoryProperty(Monitor monitor, String missingConfig) {
throw new EdcException("Mandatory config value missing: '%s'. This runtime is not operational.".formatted(missingConfig));
}

public static String propertyCompatibility(ServiceExtensionContext context, String config, String deprecatedConfig, String defaultValue) {
var value = context.getSetting(config, null);
if (value == null) {
value = context.getSetting(deprecatedConfig, null);
if (value == null) {
return defaultValue;
}
context.getMonitor().warning(DEPRECATION_WARNING.formatted(deprecatedConfig, config));
}
return value;
}

public static int propertyCompatibility(ServiceExtensionContext context, String config, String deprecatedConfig, int defaultValue) {
var value = context.getConfig().getInteger(config, null);
if (value == null) {
value = context.getConfig().getInteger(deprecatedConfig, null);
if (value == null) {
return defaultValue;
}
context.getMonitor().warning(DEPRECATION_WARNING.formatted(deprecatedConfig, config));
}
return value;
}

public static long propertyCompatibility(ServiceExtensionContext context, String config, String deprecatedConfig, long defaultValue) {
var value = context.getConfig().getLong(config, null);
if (value == null) {
value = context.getConfig().getLong(deprecatedConfig, null);
if (value == null) {
return defaultValue;
}
context.getMonitor().warning(DEPRECATION_WARNING.formatted(deprecatedConfig, config));
}
return value;
}

@NotNull
public static String propertyCompatibility(ServiceExtensionContext context, String config, String deprecatedConfig) {
var value = context.getSetting(config, null);
if (value == null) {
value = context.getConfig().getString(deprecatedConfig);
context.getMonitor().warning(DEPRECATION_WARNING.formatted(deprecatedConfig, config));
}
return value;
}

public static boolean propertyCompatibility(ServiceExtensionContext context, String config, String deprecatedConfig, boolean defaultValue) {
var value = context.getConfig().getBoolean(config, null);
if (value == null) {
value = context.getConfig().getBoolean(deprecatedConfig, null);
if (value == null) {
return defaultValue;
}
context.getMonitor().warning(DEPRECATION_WARNING.formatted(deprecatedConfig, config));
}
return value;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

package org.eclipse.tractusx.edc.core.utils;

import org.eclipse.edc.spi.EdcException;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

class ConfigUtilTest {

private static final String CONFIG = "tx.edc.test.config";
private static final String CONFIG_DEPRECATED = "tx.edc.test.config.deprecated";
private final ServiceExtensionContext context = mock(ServiceExtensionContext.class);

@Test
void missingProperty_shouldThrowException() {
assertThatThrownBy(() -> ConfigUtil.missingMandatoryProperty(mock(), "foo"))
.isInstanceOf(EdcException.class)
.hasMessage("Mandatory config value missing: 'foo'. This runtime is not operational.");
}

@Test
void propertyCompatibility_whenConfigExists_shouldReturnValue() {
when(context.getSetting(eq(CONFIG), isNull())).thenReturn("some-val");
assertThat(ConfigUtil.propertyCompatibility(context, CONFIG, CONFIG_DEPRECATED, "default-value"))
.isEqualTo("some-val");

verify(context).getSetting(eq(CONFIG), isNull());
verifyNoMoreInteractions(context);
}

@Test
void propertyCompatibility_whenDeprecatedConfigExists_shouldReturnOldValue() {
when(context.getSetting(eq(CONFIG_DEPRECATED), isNull())).thenReturn("some-val");
var monitorMock = mock(Monitor.class);
when(context.getMonitor()).thenReturn(monitorMock);

assertThat(ConfigUtil.propertyCompatibility(context, CONFIG, CONFIG_DEPRECATED, "default-value")).isEqualTo("some-val");

verify(context).getSetting(eq(CONFIG), isNull());
verify(context).getSetting(eq(CONFIG_DEPRECATED), isNull());
verify(monitorMock).warning(anyString());
}

@Test
void propertyCompatibility_whenBothConfigsExists_shouldReturnNewValue() {
when(context.getSetting(eq(CONFIG), isNull())).thenReturn("some-val");
when(context.getSetting(eq(CONFIG_DEPRECATED), isNull())).thenReturn("some-old-val");

assertThat(ConfigUtil.propertyCompatibility(context, CONFIG, CONFIG_DEPRECATED, "default-value")).isEqualTo("some-val");

verify(context).getSetting(eq(CONFIG), isNull());
verifyNoMoreInteractions(context);
}

@Test
void propertyCompatibility_whenNoConfigsExists_shouldReturnDefaultValue() {
assertThat(ConfigUtil.propertyCompatibility(context, CONFIG, CONFIG_DEPRECATED, "default-value")).isEqualTo("default-value");

verify(context).getSetting(eq(CONFIG), isNull());
verify(context).getSetting(eq(CONFIG_DEPRECATED), isNull());
verifyNoMoreInteractions(context);
}
}
1 change: 1 addition & 0 deletions edc-controlplane/edc-runtime-memory/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ plugins {
}

dependencies {
implementation(project(":core:core-utils"))
implementation(libs.edc.spi.core)
runtimeOnly(project(":edc-controlplane:edc-controlplane-base"))
runtimeOnly(project(":edc-dataplane:edc-dataplane-base"))
Original file line number Diff line number Diff line change
@@ -27,15 +27,18 @@
import org.eclipse.edc.spi.security.Vault;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.tractusx.edc.core.utils.ConfigUtil;

import java.util.stream.Stream;

@Extension(value = "Vault seed extension: adds secrets to the vault", categories = {"vault", "security"})
@Extension(value = "Vault seed extension: adds secrets to the vault", categories = { "vault", "security" })
@BaseExtension
public class VaultSeedExtension implements ServiceExtension {

@Setting(value = "Secrets with which the vault gets initially populated. Specify as comma-separated list of key:secret pairs.")
public static final String VAULT_MEMORY_SECRETS_PROPERTY = "edc.vault.secrets";
public static final String VAULT_MEMORY_SECRETS_PROPERTY = "tx.edc.vault.secrets";
@Deprecated(since = "0.7.1")
public static final String VAULT_MEMORY_SECRETS_PROPERTY_DEPRECATED = "edc.vault.secrets";
public static final String NAME = "Vault Seed Extension";

@Inject
@@ -48,7 +51,7 @@ public String name() {

@Provider
public Vault createInMemVault(ServiceExtensionContext context) {
var seedSecrets = context.getSetting(VAULT_MEMORY_SECRETS_PROPERTY, null);
var seedSecrets = ConfigUtil.propertyCompatibility(context, VAULT_MEMORY_SECRETS_PROPERTY, VAULT_MEMORY_SECRETS_PROPERTY_DEPRECATED, (String) null);
if (seedSecrets != null) {
Stream.of(seedSecrets.split(";"))
.filter(pair -> pair.contains(":"))
Original file line number Diff line number Diff line change
@@ -35,7 +35,8 @@

import java.util.function.Supplier;

import static org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings.missingMandatoryProperty;
import static org.eclipse.tractusx.edc.core.utils.ConfigUtil.missingMandatoryProperty;
import static org.eclipse.tractusx.edc.core.utils.ConfigUtil.propertyCompatibility;
import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.NAME;

@Extension(value = NAME)
@@ -44,13 +45,19 @@ public class BdrsClientExtension implements ServiceExtension {

public static final int DEFAULT_BDRS_CACHE_VALIDITY = 15 * 60; // 15 minutes
@Setting(value = "Base URL of the BDRS service", required = true)
public static final String BDRS_SERVER_URL_PROPERTY = "tx.iam.iatp.bdrs.server.url";
public static final String BDRS_SERVER_URL_PROPERTY = "tx.edc.iam.iatp.bdrs.server.url";
@Deprecated(since = "0.7.1")
public static final String BDRS_SERVER_URL_PROPERTY_DEPRECATED = "tx.iam.iatp.bdrs.server.url";

@Setting(value = "Base URL of the CredentialService, that belongs to this connector runtime. If not specified, the URL is resolved from this participant's DID document.")
public static final String CREDENTIAL_SERVICE_BASE_URL_PROPERTY = "tx.iam.iatp.credentialservice.url";
public static final String CREDENTIAL_SERVICE_BASE_URL_PROPERTY = "tx.edc.iam.iatp.credentialservice.url";
@Deprecated(since = "0.7.1")
public static final String CREDENTIAL_SERVICE_BASE_URL_PROPERTY_DEPRECATED = "tx.iam.iatp.credentialservice.url";

@Setting(value = "Validity period in seconds for the cached BPN/DID mappings. After this period a new resolution request will hit the server.", defaultValue = DEFAULT_BDRS_CACHE_VALIDITY + "")
public static final String BDRS_SERVER_CACHE_VALIDITY_PERIOD = "tx.iam.iatp.bdrs.cache.validity";
public static final String BDRS_SERVER_CACHE_VALIDITY_PERIOD = "tx.edc.iam.iatp.bdrs.cache.validity";
@Deprecated(since = "0.7.1")
public static final String BDRS_SERVER_CACHE_VALIDITY_PERIOD_DEPRECATED = "tx.iam.iatp.bdrs.cache.validity";

// this setting is already defined in IdentityAndTrustExtension
public static final String CONNECTOR_DID_PROPERTY = "edc.iam.issuer.id";
@@ -77,12 +84,9 @@ public String name() {

@Provider
public BdrsClient getBdrsClient(ServiceExtensionContext context) {
var baseUrl = context.getConfig().getString(BDRS_SERVER_URL_PROPERTY, null);
var baseUrl = propertyCompatibility(context, BDRS_SERVER_URL_PROPERTY, BDRS_SERVER_URL_PROPERTY_DEPRECATED);
var monitor = context.getMonitor();
if (baseUrl == null) {
missingMandatoryProperty(monitor, BDRS_SERVER_URL_PROPERTY);
}
var cacheValidity = context.getConfig().getInteger(BDRS_SERVER_CACHE_VALIDITY_PERIOD, DEFAULT_BDRS_CACHE_VALIDITY);
var cacheValidity = propertyCompatibility(context, BDRS_SERVER_CACHE_VALIDITY_PERIOD, BDRS_SERVER_CACHE_VALIDITY_PERIOD_DEPRECATED, DEFAULT_BDRS_CACHE_VALIDITY);

// get DID
var ownDid = context.getConfig().getString(CONNECTOR_DID_PROPERTY, null);
@@ -92,7 +96,7 @@ public BdrsClient getBdrsClient(ServiceExtensionContext context) {

// get CS URL
Supplier<String> urlSupplier;
var configuredUrl = context.getConfig().getString(CREDENTIAL_SERVICE_BASE_URL_PROPERTY, null);
var configuredUrl = propertyCompatibility(context, CREDENTIAL_SERVICE_BASE_URL_PROPERTY, CREDENTIAL_SERVICE_BASE_URL_PROPERTY_DEPRECATED, (String) null);
if (configuredUrl != null) {
urlSupplier = () -> configuredUrl;
} else {
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@

import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.BDRS_SERVER_URL_PROPERTY;
import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.BDRS_SERVER_URL_PROPERTY_DEPRECATED;
import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.CONNECTOR_DID_PROPERTY;
import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.CREDENTIAL_SERVICE_BASE_URL_PROPERTY;
import static org.mockito.ArgumentMatchers.anyString;
@@ -60,8 +61,9 @@ void setup(ServiceExtensionContext context) {
}

@Test
void createClient_whenUrlMissing_expectLogError(ServiceExtensionContext context, BdrsClientExtension extension) {
void createClient_whenUrlMissing_expectException(ServiceExtensionContext context, BdrsClientExtension extension) {
var cfg = mock(Config.class);
when(cfg.getString(eq(BDRS_SERVER_URL_PROPERTY_DEPRECATED))).thenThrow(new EdcException(BDRS_SERVER_URL_PROPERTY));
when(context.getConfig()).thenReturn(cfg);
when(cfg.getString(eq(BDRS_SERVER_URL_PROPERTY), isNull())).thenReturn(null);
when(cfg.getString(eq(CONNECTOR_DID_PROPERTY), isNull())).thenReturn("did:web:self");
@@ -82,7 +84,7 @@ void createClient_whenNoCredentialServiceUrl_shouldInvokeResolver(ServiceExtensi

extension.getBdrsClient(context);

verify(monitor).warning("No config value found for 'tx.iam.iatp.credentialservice.url'. As a fallback, the credentialService URL from this connector's DID document will be resolved.");
verify(monitor).warning("No config value found for 'tx.edc.iam.iatp.credentialservice.url'. As a fallback, the credentialService URL from this connector's DID document will be resolved.");
verifyNoMoreInteractions(monitor);
}

@@ -97,7 +99,7 @@ void createClient_whenResolverFails_expectLogError(ServiceExtensionContext conte

var client = extension.getBdrsClient(context);

verify(monitor).warning("No config value found for 'tx.iam.iatp.credentialservice.url'. As a fallback, the credentialService URL from this connector's DID document will be resolved.");
verify(monitor).warning("No config value found for 'tx.edc.iam.iatp.credentialservice.url'. As a fallback, the credentialService URL from this connector's DID document will be resolved.");

// the DID url resolver is only invoked on-demand, so no eager-loading of the DID document
verify(monitor, never()).severe("Resolving the credentialService URL failed. This runtime won't be able to communicate with BDRS. Error: test failure.");
Original file line number Diff line number Diff line change
@@ -24,6 +24,9 @@ plugins {

dependencies {

implementation(project(":core:core-utils"))
implementation(project(":spi:edr-spi"))

implementation(libs.jakarta.rsApi)

implementation(libs.edc.spi.http)
@@ -34,7 +37,6 @@ dependencies {
implementation(libs.edc.spi.auth)
implementation(libs.edc.spi.edrstore)

implementation(project(":spi:edr-spi"))

testImplementation(libs.edc.junit)
testImplementation(testFixtures(libs.edc.core.jersey))
Loading
Loading