Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Merge pull request #2 from Cofinity-X/chore/DO-1264-update-workflows
Browse files Browse the repository at this point in the history
chore(workflows):[DO-1264] Adapt triggers of workflows for forked rep…
  • Loading branch information
ds-jkreutzfeld authored Oct 10, 2023
2 parents eac44b1 + cc33457 commit 55540f5
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 41 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/docker-image-branch_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -51,15 +54,15 @@ 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 == ''
uses: docker/build-push-action@v4
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:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/docker-image-main_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ name: "[BE][BUILT][RELEASE] Docker Image on Main"

on:
push:
branches: main
branches:
- main
- dev
workflow_dispatch:


Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/docker-image-main_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ name: "[FE][BUILT][RELEASE] Docker Image on Main"

on:
push:
branches: main
branches:
- main
- dev

env:
GHCR_REGISTRY: ghcr.io
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/kics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
36 changes: 20 additions & 16 deletions .github/workflows/pull-request_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/spotbugs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ name: "[BE][FE][SECURITY] Trivy"

on:
pull_request:
branches: main
branches:
- main
- dev
paths-ignore:
- '**/*.md'
- '**/*.txt'
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/unit-test_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ name: "[FE][TEST] Unit Tests"

on:
push:
branches: [ main ]
branches:
- main
- dev
paths:
- 'frontend/**'
pull_request:
Expand All @@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Retry> myRetryRegistryEventConsumer() {
final Logger logger = LoggerFactory.getLogger("RetryLogger");
Expand Down

0 comments on commit 55540f5

Please sign in to comment.