-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
241 changed files
with
12,398 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# | ||
name: Demo Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
tags: | ||
- v* | ||
env: | ||
IMAGE_NAME: ${{ github.repository }} | ||
# | ||
jobs: | ||
# This pushes the image to GitHub Packages. | ||
push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Run build with Gradle Wrapper | ||
run: ./gradlew build | ||
|
||
- name: Build image | ||
run: docker build . --file docker/Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" --build-arg CONNECTOR_JAR=./launchers/connector/build/libs/connector-app.jar | ||
|
||
- name: Log in to registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
# | ||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/$IMAGE_NAME | ||
# This changes all uppercase characters to lowercase. | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# This strips the git ref prefix from the version. | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# This strips the "v" prefix from the tag name. | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# This uses the Docker `latest` tag convention. | ||
[ "$VERSION" == "develop" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build/ | ||
bin/ | ||
|
||
.idea | ||
.vs | ||
.vscode | ||
|
||
.env | ||
|
||
# Ignore dev resources | ||
resources-dev/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# InesData Connector | ||
|
||
Dataspaces connector for the InesData project, based on the EDC dataspaces framework | ||
|
||
## Launching the connector | ||
|
||
- Compile: | ||
``` | ||
./gradlew launchers:connector:build | ||
``` | ||
|
||
- Launch: | ||
``` | ||
java <opts> -jar launchers/connector/build/libs/connector-app.jar | ||
``` | ||
|
||
Example: | ||
``` | ||
java -Dedc.keystore=resources/certs/store.pfx -Dedc.keystore.password=<passwd> -Dedc.vault=resources/configuration/provider-vault.properties -Dedc.fs.config=resources/configuration/provider-configuration.properties -jar launchers/connector/build/libs/connector-app.jar | ||
``` | ||
|
||
## Containerizing the connector | ||
|
||
The connector is prepared to be executed inside a container. The following steps must be followed to generate the connector: | ||
- Compile the connector: | ||
``` | ||
./gradlew launchers:connector:build | ||
``` | ||
|
||
- Create a local Docker image: | ||
``` | ||
docker build --tag inesdata/connector:0.2.0 --build-arg CONNECTOR_JAR=./launchers/connector/build/libs/connector-app.jar -f docker/Dockerfile . | ||
``` | ||
|
||
## Database | ||
|
||
The `resources/sql` folder contains all the required schemes to be applied in the connector database. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This project uses @Incubating APIs which are subject to change. | ||
*/ | ||
|
||
plugins { | ||
// Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. | ||
id 'groovy-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
// Use the plugin portal to apply community plugins in convention plugins. | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373" | ||
implementation "org.owasp:dependency-check-gradle:8.4.2" | ||
implementation "pl.allegro.tech.build:axion-release-plugin:1.16.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This settings file is used to specify which projects to include in your build-logic build. | ||
* This project uses @Incubating APIs which are subject to change. | ||
*/ | ||
|
||
rootProject.name = 'inesdata-connector-build-logic' |
12 changes: 12 additions & 0 deletions
12
build-logic/src/main/groovy/com.gmv.inesdata.edc-application.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This project uses @Incubating APIs which are subject to change. | ||
*/ | ||
|
||
plugins { | ||
// Apply the common convention plugin for shared build configuration between library and application projects. | ||
id 'com.gmv.java-application-conventions' | ||
|
||
} | ||
|
19 changes: 19 additions & 0 deletions
19
build-logic/src/main/groovy/com.gmv.java-application-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This project uses @Incubating APIs which are subject to change. | ||
*/ | ||
|
||
plugins { | ||
// Apply the common convention plugin for shared build configuration between library and application projects. | ||
id 'com.gmv.java-common-conventions' | ||
|
||
// Apply the application plugin to add support for building a CLI application in Java. | ||
id 'application' | ||
} | ||
|
||
dependencies { | ||
implementation "ch.qos.logback:logback-core:1.3.14" | ||
implementation "ch.qos.logback:logback-classic:1.3.14" | ||
testImplementation "org.slf4j:slf4j-api:2.0.4" | ||
} |
104 changes: 104 additions & 0 deletions
104
build-logic/src/main/groovy/com.gmv.java-common-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This project uses @Incubating APIs which are subject to change. | ||
*/ | ||
|
||
plugins { | ||
// Apply the java Plugin to add support for Java. | ||
id 'java' | ||
id 'pl.allegro.tech.build.axion-release' | ||
id 'jacoco' | ||
id "org.sonarqube" | ||
id "org.owasp.dependencycheck" | ||
id 'maven-publish' | ||
} | ||
|
||
scmVersion { | ||
tag { | ||
prefix.set("${project.name}-v") | ||
} | ||
} | ||
version = scmVersion.version | ||
|
||
repositories { | ||
// If using an org repo, mavenRepoUrl, mavenRepoUsername and mavenRepoPassword must be configured in ~/.gradle/gradle.properties, | ||
// project gradle.properties, env vars or command line. | ||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:handling_credentials | ||
if (project.hasProperty('mavenRepoUrl')) { | ||
maven { | ||
name = 'mavenRepo' | ||
url mavenRepoUrl | ||
credentials(PasswordCredentials) | ||
} | ||
} | ||
// As a fallback, use Maven Central for resolving dependencies. | ||
mavenCentral() | ||
// Tried to use composite builds, but there is no support in VSCode | ||
mavenLocal() | ||
// SNAPSHOTS to use version with corrected known bugs | ||
maven { | ||
url = uri("https://oss.sonatype.org/content/repositories/snapshots/") | ||
} | ||
} | ||
|
||
dependencies { | ||
constraints { | ||
// Define dependency versions as constraints | ||
implementation 'org.apache.commons:commons-text:1.10.0' | ||
} | ||
|
||
} | ||
|
||
testing { | ||
suites { | ||
// Configure the built-in test suite | ||
test { | ||
// Use JUnit Jupiter test framework | ||
useJUnitJupiter('5.9.3') | ||
} | ||
} | ||
} | ||
|
||
// Apply a specific Java toolchain to ease working on different environments. | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
|
||
sonar { | ||
properties { | ||
// Recommended way to use the plugin. Compilation must be ensured | ||
// externally before calling the sonar task | ||
property "sonar.gradle.skipCompile", "true" | ||
} | ||
} | ||
|
||
|
||
dependencyCheck { | ||
failBuildOnCVSS = 7 | ||
suppressionFile "suppressions.xml" | ||
analyzers { | ||
// To avoid trying to analyze DLL files | ||
assemblyEnabled=false | ||
ossIndex { | ||
// remote errors from the OSS Index (e.g. BAD GATEWAY, RATE LIMIT EXCEEDED) | ||
// will result in warnings only instead of failing execution. | ||
warnOnlyOnRemoteErrors = true | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
|
||
repositories { | ||
if (project.hasProperty('mavenPublishRepoSnapshotsUrl')) { | ||
maven { | ||
name = 'mavenPublishRepo' | ||
credentials(PasswordCredentials) | ||
url = version.endsWith('SNAPSHOT') ? mavenPublishRepoSnapshotsUrl : mavenPublishRepoReleasesUrl | ||
} | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
build-logic/src/main/groovy/com.gmv.java-library-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This project uses @Incubating APIs which are subject to change. | ||
*/ | ||
|
||
plugins { | ||
// Apply the common convention plugin for shared build configuration between library and application projects. | ||
id 'com.gmv.java-common-conventions' | ||
|
||
// Apply the java-library plugin for API and implementation separation. | ||
id 'java-library' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM eclipse-temurin:17-jre-jammy | ||
ARG CONNECTOR_JAR | ||
|
||
# System env vars | ||
ENV USER_GROUP=connectorgroup | ||
ENV USER_NAME=connectoruser | ||
ENV JVM_ARGS="" | ||
ENV CONNECTOR_HOME=/opt/connector | ||
ENV CONNECTOR_RESOURCES=${CONNECTOR_HOME}/resources | ||
|
||
# Add the user who executes the connector. The user belongs to the group with gui 0 | ||
RUN addgroup ${USER_GROUP} && adduser --no-create-home --disabled-password --ingroup ${USER_GROUP} ${USER_NAME} | ||
|
||
# Create the connector and resources directories | ||
RUN mkdir -p ${CONNECTOR_HOME} | ||
RUN mkdir -p ${CONNECTOR_RESOURCES} | ||
|
||
# Work with the minimum rights | ||
RUN chown -R ${USER_NAME}:0 ${CONNECTOR_HOME} \ | ||
&& chmod -R g=u ${CONNECTOR_HOME} | ||
|
||
# Helpful utility while the connector is not able to create its own database | ||
RUN apt-get update && apt-get install -y postgresql-client | ||
|
||
# User by default | ||
USER ${USER_NAME} | ||
|
||
# Set the workdir | ||
WORKDIR ${CONNECTOR_HOME} | ||
|
||
# Copy connector | ||
COPY $CONNECTOR_JAR connector.jar | ||
COPY resources/* ${CONNECTOR_RESOURCES}/ | ||
|
||
|
||
# Use "exec" for Kubernetes graceful termination (SIGINT) to reach JVM. | ||
ENTRYPOINT [ "sh", "-c", \ | ||
"exec java $JVM_ARGS -jar connector.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Asset Validator Extension | ||
|
||
This extension overrides the EDC validation of the asset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
plugins { | ||
`java-library` | ||
id("com.gmv.inesdata.edc-application") | ||
} | ||
|
||
dependencies { | ||
api(libs.edc.api.core) | ||
|
||
implementation(libs.edc.control.plane.spi) | ||
implementation(libs.edc.lib.validator) | ||
} | ||
|
||
|
38 changes: 38 additions & 0 deletions
38
...ons/asset-validator/src/main/java/org/upm/inesdata/validator/AssetValidatorExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.upm.inesdata.validator; | ||
|
||
import org.eclipse.edc.runtime.metamodel.annotation.Extension; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Inject; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Provides; | ||
import org.eclipse.edc.spi.system.ServiceExtension; | ||
import org.eclipse.edc.validator.spi.JsonObjectValidatorRegistry; | ||
|
||
import static org.eclipse.edc.connector.controlplane.asset.spi.domain.Asset.EDC_ASSET_TYPE; | ||
|
||
/** | ||
* Service extension for asset validation. | ||
*/ | ||
@Provides(AssetValidatorExtension.class) | ||
@Extension(value = AssetValidatorExtension.NAME) | ||
public class AssetValidatorExtension implements ServiceExtension { | ||
|
||
public static final String NAME = "Asset Validator"; | ||
|
||
@Inject | ||
private JsonObjectValidatorRegistry validator; | ||
|
||
|
||
/** | ||
* Returns the name of the extension. | ||
* | ||
* @return the name of the extension | ||
*/ | ||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public void prepare() { | ||
validator.register(EDC_ASSET_TYPE, InesdataAssetValidator.instance()); | ||
} | ||
} |
Oops, something went wrong.