diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0524f65da9..8e5fb930a1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -30,12 +30,16 @@ name: "[BE][SECURITY] CodeQL" on: push: - branches: main + branches: + - main + - dev paths-ignore: - '**/*.md' - '**/*.txt' pull_request: - branches: main + branches: + - main + - dev paths-ignore: - '**/*.md' - '**/*.txt' diff --git a/.github/workflows/docker-image-branch_frontend.yml b/.github/workflows/docker-image-branch_frontend.yml index d19c6e476f..38dda75244 100644 --- a/.github/workflows/docker-image-branch_frontend.yml +++ b/.github/workflows/docker-image-branch_frontend.yml @@ -41,6 +41,9 @@ jobs: with: ref: ${{ github.ref }} + - name: Make organization and repository name lowercase + run: echo "GITHUB_REPOSITORY_LOWERCASE=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Login to GHCR Registry env: DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} @@ -51,7 +54,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push for GHCR ${{ env.GHCR_REGISTRY }}/${{ github.repository }}-frontend:${{ github.event.pull_request.head.sha }} + - name: Build and push for GHCR ${{ env.GHCR_REGISTRY }}/${{ env.GITHUB_REPOSITORY_LOWERCASE }}-frontend:${{ github.event.pull_request.head.sha }} env: DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} if: env.DOCKER_HUB_USER == '' @@ -59,7 +62,7 @@ jobs: with: context: frontend push: true - tags: ${{ env.GHCR_REGISTRY }}/${{ github.repository }}-frontend:${{ github.event.pull_request.head.sha }} + tags: ${{ env.GHCR_REGISTRY }}/${{ env.GITHUB_REPOSITORY_LOWERCASE }}-frontend:${{ github.event.pull_request.head.sha }} - name: Login to Docker Hub env: diff --git a/.github/workflows/docker-image-main_backend.yml b/.github/workflows/docker-image-main_backend.yml index 486bc8c7f8..1f98f8918b 100644 --- a/.github/workflows/docker-image-main_backend.yml +++ b/.github/workflows/docker-image-main_backend.yml @@ -19,7 +19,9 @@ name: "[BE][BUILT][RELEASE] Docker Image on Main" on: push: - branches: main + branches: + - main + - dev workflow_dispatch: diff --git a/.github/workflows/docker-image-main_frontend.yml b/.github/workflows/docker-image-main_frontend.yml index 054e6edb03..7d6df3c7bc 100644 --- a/.github/workflows/docker-image-main_frontend.yml +++ b/.github/workflows/docker-image-main_frontend.yml @@ -19,7 +19,9 @@ name: "[FE][BUILT][RELEASE] Docker Image on Main" on: push: - branches: main + branches: + - main + - dev env: GHCR_REGISTRY: ghcr.io diff --git a/.github/workflows/kics.yml b/.github/workflows/kics.yml index a1f7a0dbfc..b7f24d15ff 100644 --- a/.github/workflows/kics.yml +++ b/.github/workflows/kics.yml @@ -19,12 +19,16 @@ name: "[BE][FE][SECURITY] Kics" on: push: - branches: main + branches: + - main + - dev paths-ignore: - '**/*.md' - '**/*.txt' pull_request: - branches: main + branches: + - main + - dev paths-ignore: - '**/*.md' - '**/*.txt' diff --git a/.github/workflows/pull-request_backend.yml b/.github/workflows/pull-request_backend.yml index 34a25850c4..87e9e2e151 100644 --- a/.github/workflows/pull-request_backend.yml +++ b/.github/workflows/pull-request_backend.yml @@ -57,20 +57,21 @@ jobs: files: "**/surefire-reports/TEST-*.xml" check_name: "Unit Test Results" - - name: Cache SonarCloud packages - uses: actions/cache@v3 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - - name: Verify Sonar Scan - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }} - SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }} - SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY_BACKEND }} - run: mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/tx-traceability-foss/tx-traceability-foss/tx-coverage/target/site/jacoco-aggregate/jacoco.xml -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY_BACKEND }} -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} +# Currently disabled, as we do not have a SonarQube instance yet +# - name: Cache SonarCloud packages +# uses: actions/cache@v3 +# with: +# path: ~/.sonar/cache +# key: ${{ runner.os }}-sonar +# restore-keys: ${{ runner.os }}-sonar + +# - name: Verify Sonar Scan +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }} +# SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }} +# SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY_BACKEND }} +# run: mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/tx-traceability-foss/tx-traceability-foss/tx-coverage/target/site/jacoco-aggregate/jacoco.xml -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY_BACKEND }} -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} Publish-docker-image: needs: [ "Test-and-Sonar" ] @@ -100,12 +101,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build & Push docker image for GHCR ${{ env.GHCR_REGISTRY }}/${{ github.repository }}:${{ github.event.pull_request.head.sha }} + - name: Make organization and repository name lowercase + run: echo "GITHUB_REPOSITORY_LOWERCASE=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - name: Build & Push docker image for GHCR ${{ env.GHCR_REGISTRY }}/${{ env.GITHUB_REPOSITORY_LOWERCASE }}:${{ github.event.pull_request.head.sha }} uses: docker/build-push-action@v4 with: context: . push: true - tags: ${{ env.GHCR_REGISTRY }}/${{ github.repository }}:${{ github.event.pull_request.head.sha }} + tags: ${{ env.GHCR_REGISTRY }}/${{ env.GITHUB_REPOSITORY_LOWERCASE }}:${{ github.event.pull_request.head.sha }} Dependency-analysis: runs-on: ubuntu-latest diff --git a/.github/workflows/spotbugs.yml b/.github/workflows/spotbugs.yml index bd6cb3db70..c48c38d3b4 100644 --- a/.github/workflows/spotbugs.yml +++ b/.github/workflows/spotbugs.yml @@ -19,14 +19,18 @@ name: "[BE][SECURITY] Spotbugs" on: push: - branches: main + branches: + - main + - dev paths-ignore: - '**/*.md' - '**/*.txt' - 'tx-backend/openapi/**' - 'docs/**' pull_request: - branches: main + branches: + - main + - dev paths-ignore: - '**/*.md' - '**/*.txt' diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 617b4e6afc..e22c012e34 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -24,7 +24,9 @@ name: "[BE][FE][SECURITY] Trivy" on: pull_request: - branches: main + branches: + - main + - dev paths-ignore: - '**/*.md' - '**/*.txt' diff --git a/.github/workflows/unit-test_frontend.yml b/.github/workflows/unit-test_frontend.yml index 1e231dfbce..7444acba10 100644 --- a/.github/workflows/unit-test_frontend.yml +++ b/.github/workflows/unit-test_frontend.yml @@ -19,7 +19,9 @@ name: "[FE][TEST] Unit Tests" on: push: - branches: [ main ] + branches: + - main + - dev paths: - 'frontend/**' pull_request: @@ -46,13 +48,15 @@ jobs: run: yarn install - name: Run yarn test:ci run: CHROMIUM_BIN=$(which chrome) yarn test:ci # will run `test:ci` command - - name: Run SonarCloud check - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_FRONTEND }} - with: - projectBaseDir: frontend - args: > - -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} - -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY_FRONTEND }} + +# Currently disabled, as we do not have a SonarQube instance yet. +# - name: Run SonarCloud check +# uses: SonarSource/sonarcloud-github-action@master +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_FRONTEND }} +# with: +# projectBaseDir: frontend +# args: > +# -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} +# -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY_FRONTEND }} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ApplicationConfig.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ApplicationConfig.java index 2e8ccb88e8..3456e743b3 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ApplicationConfig.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ApplicationConfig.java @@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.irs.edc.client.policy.AcceptedPoliciesProvider; import org.eclipse.tractusx.irs.edc.client.policy.AcceptedPolicy; +import org.eclipse.tractusx.irs.edc.client.policy.Policy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Qualifier; @@ -111,15 +112,19 @@ public ITemplateResolver textTemplateResolver() { @Bean public void registerDecentralRegistryPermissions() { try { - OffsetDateTime offsetDateTime = OffsetDateTime.now().plusMonths(1); - AcceptedPolicy acceptedPolicy = new AcceptedPolicy(ID_TRACE_CONSTRAINT, offsetDateTime); + OffsetDateTime createdOn = OffsetDateTime.now(); + OffsetDateTime validUntil = createdOn.plusMonths(1); + // workaround due to accommodate the incompatible interface change of org.eclipse.tractusx.irs.edc.client.policy.AcceptedPolicy.AcceptedPolicy + // TODO HGO@2023-10-06_12:44 check why there is an incompatible change in the irs-registry-client:1.2.1.SNAPSHOT release! + Policy policy = new Policy(ID_TRACE_CONSTRAINT, createdOn, validUntil, List.of()); + AcceptedPolicy acceptedPolicy = new AcceptedPolicy(policy, validUntil); defaultAcceptedPoliciesProvider.addAcceptedPolicies(List.of(acceptedPolicy)); log.info("Successfully added permission to irs client lib provider: {}", acceptedPolicy); } catch (Exception exception) { log.error("Failed to create Irs Policies : ", exception); } - } + @Bean public RegistryEventConsumer myRetryRegistryEventConsumer() { final Logger logger = LoggerFactory.getLogger("RetryLogger");