diff --git a/.ci/github-actions-settings.xml b/.ci/github-actions-settings.xml new file mode 100644 index 00000000000..591f95be0f1 --- /dev/null +++ b/.ci/github-actions-settings.xml @@ -0,0 +1,22 @@ + + + + vitam + ${env.CI_USR} + ${env.CI_PSW} + + + vitam-snapshots + ${env.CI_USR} + ${env.CI_PSW} + + + vitam-releases + ${env.CI_USR} + ${env.CI_PSW} + + + diff --git a/.ci/settings.xml b/.ci/settings.xml index a2add0733eb..3b39c596a5c 100644 --- a/.ci/settings.xml +++ b/.ci/settings.xml @@ -19,12 +19,12 @@ ${env.CI_PSW} - snapshots + vitam-snapshots ${env.CI_USR} ${env.CI_PSW} - releases + vitam-releases ${env.CI_USR} ${env.CI_PSW} diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4fe6f7f981f..01f43bfd78b 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -52,18 +52,37 @@ jobs: name: Build Backend runs-on: ubuntu-latest steps: + - uses: szenius/set-timezone@v2.0 + with: + timezoneLinux: "Europe/Paris" # we set the timezone for Unit Tests to pass (we shouldn't need to, but it's currently required) - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: "temurin" java-version: "11" - cache: "maven" - - uses: szenius/set-timezone@v2.0 + - name: Restore maven cache # We're not using cache feature from actions/setup-java as it's not allowing to fine-tune it (in particular, we can't use restore-keys to load a previous cache if cache name mismatches) + uses: actions/cache@v4 with: - timezoneLinux: "Europe/Paris" # we set the timezone for Unit Tests to pass (we shouldn't need to, but it's currently required) + # See https://github.com/actions/toolkit/issues/713 for why we use */*/* to be able to exclude dependency-check-data from the cache + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/owasp/dependency-check-data + key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} + restore-keys: maven-${{ runner.os }}-${{ github.ref_protected && hashFiles('**/pom.xml') || '' }} # If the key doesn't exist, tries to find a previous cache to speedup build, except for protected branches (to make sure we have a clean cache) + - name: Get today's date + id: get-date + run: | + echo "today=$(/bin/date -u "+%Y-%m-%d")" >> $GITHUB_OUTPUT + shell: bash + - name: Restore latest owasp-dependency-check cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository/org/owasp/dependency-check-data + key: owasp-dependency-check-${{ steps.get-date.outputs.today }} # The key changes every day + restore-keys: owasp-dependency-check- # If the key doesn't exist, tries to find a previous cache - name: Build and test run: > - mvn --settings .ci/settings.xml + mvn --settings .ci/github-actions-settings.xml -Pvitam,no-cve-proxy -Dspotless.check.skip=true --batch-mode --errors -U diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 76132a22ae0..8e8bd32af2c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,6 +28,12 @@ jobs: with: distribution: "temurin" java-version: "11" - cache: "maven" + - name: Restore maven cache # We're not using cache feature from actions/setup-java as it could conflict with other GitHub Actions maven caches (our cache doesn't include all Vitam dependencies: it is limited to spotless and its dependencies) + uses: actions/cache@v4 + with: + path: | + ~/.m2/repository + **/target/spotless-prettier-node-modules-* + key: maven-spotless-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} # We invalidate cache if pom.xml change to detect spotless version update or new maven modules - name: Lint Java run: mvn -T1C spotless:check diff --git a/api/api-pastis/pastis-standalone/pom.xml b/api/api-pastis/pastis-standalone/pom.xml index 4ff6bbf169d..d9e6be44b5c 100644 --- a/api/api-pastis/pastis-standalone/pom.xml +++ b/api/api-pastis/pastis-standalone/pom.xml @@ -380,11 +380,11 @@ - releases + vitam-releases ${env.SERVICE_NEXUS_URL}/repository/maven-releases/ - snapshots + vitam-snapshots ${env.SERVICE_NEXUS_URL}/repository/maven-snapshots/ @@ -395,25 +395,20 @@ - vitam - ${env.SERVICE_NEXUS_URL}/repository/maven-public/ + vitam-releases + Vitam release repository + true + false + ${env.SERVICE_NEXUS_URL}/repository/maven-releases/ + + + vitam-snapshots + Vitam SNAPSHOT repository + false + true + ${env.SERVICE_NEXUS_URL}/repository/maven-snapshots/ - - - - - vitam - ${env.SERVICE_NEXUS_URL}/repository/maven-public/ - - true - - - false - - - - diff --git a/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/IngestContractService.java b/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/IngestContractService.java index 39912dd96e7..46e56b0d04d 100644 --- a/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/IngestContractService.java +++ b/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/IngestContractService.java @@ -138,11 +138,11 @@ private List convertIngestContractsToModelOfCreation( ac.setComputeInheritedRulesAtIngest(acModel.isComputeInheritedRulesAtIngest()); if (acModel.getActivationdate() != null) { - ac.setActivationdate(LocalDateUtil.getFormattedDateForMongo(acModel.getActivationdate())); + ac.setActivationdate(LocalDateUtil.getFormattedDateTimeForMongo(acModel.getActivationdate())); } if (acModel.getDeactivationdate() != null) { - ac.setDeactivationdate(LocalDateUtil.getFormattedDateForMongo(acModel.getDeactivationdate())); + ac.setDeactivationdate(LocalDateUtil.getFormattedDateTimeForMongo(acModel.getDeactivationdate())); } LOGGER.debug("outputIC: {}", ac); diff --git a/api/api-referential/referential-external/src/main/java/fr/gouv/vitamui/referential/external/server/rest/OperationExternalController.java b/api/api-referential/referential-external/src/main/java/fr/gouv/vitamui/referential/external/server/rest/OperationExternalController.java index 87d0b96b403..0ed74b4e38d 100644 --- a/api/api-referential/referential-external/src/main/java/fr/gouv/vitamui/referential/external/server/rest/OperationExternalController.java +++ b/api/api-referential/referential-external/src/main/java/fr/gouv/vitamui/referential/external/server/rest/OperationExternalController.java @@ -77,6 +77,7 @@ import javax.validation.Valid; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.time.format.DateTimeFormatter; import java.util.Collection; import java.util.Optional; @@ -166,8 +167,8 @@ public ObjectNode extractInfoFromTimestamp(final @RequestBody String timestamp) X500Name signerCertIssuer = signerId.getIssuer(); result.put( "genTime", - LocalDateUtil.getString( - LocalDateUtil.fromDate(tsResp.getTimeStampToken().getTimeStampInfo().getGenTime()) + LocalDateUtil.fromDate(tsResp.getTimeStampToken().getTimeStampInfo().getGenTime()).format( + DateTimeFormatter.ISO_DATE_TIME ) ); result.put("signerCertIssuer", signerCertIssuer.toString()); diff --git a/pom.xml b/pom.xml index 1ad795c7553..406164db892 100644 --- a/pom.xml +++ b/pom.xml @@ -2474,11 +2474,13 @@ - releases + vitam-releases + Vitam release repository ${env.SERVICE_NEXUS_URL}/repository/maven-releases/ - snapshots + vitam-snapshots + Vitam SNAPSHOT repository ${env.SERVICE_NEXUS_URL}/repository/maven-snapshots/ @@ -2487,33 +2489,27 @@ - - vitam - ${env.SERVICE_NEXUS_URL}/repository/maven-public/ + vitam-releases + Vitam release repository + true + false + ${env.SERVICE_NEXUS_URL}/repository/maven-releases/ + + + vitam-snapshots + Vitam SNAPSHOT repository + false + true + ${env.SERVICE_NEXUS_URL}/repository/maven-snapshots/ - - - - vitam - ${env.SERVICE_NEXUS_URL}/repository/maven-public/ - - true - - - false - - - - vitam ${env.SERVICE_NEXUS_URL}/repository/node-distrib/ - @@ -2522,19 +2518,13 @@ false - - - - releases - http://download.programmevitam.fr/vitam_repository/${vitam.version}/mvn_repo/ - - - - + - vitam + public-vitam-releases http://download.programmevitam.fr/vitam_repository/${vitam.version}/mvn_repo/ + true + false diff --git a/sonar-project.properties b/sonar-project.properties index 5c61a8b2827..5d52a3207d1 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,6 +5,7 @@ sonar.projectKey=programme-vitam2_vitam-ui # in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/ sonar.sources=. sonar.java.binaries=. +sonar.java.libraries=~/.m2/repository/**/*.jar sonar.exclusions=**/node_modules/**, **/target/** sonar.javascript.lcov.reportPaths=**/target/coverage/lcov.info