From 85ce3c9159eb04cb226a52a40138d4fc484e064b Mon Sep 17 00:00:00 2001 From: Marcus Fabarius Date: Thu, 21 Mar 2024 13:23:47 +0100 Subject: [PATCH] ignore flaky test; remove CircleCI --- .circleci/README.md | 31 --- .circleci/config.yml | 238 ------------------ .../tests/CohortControllerIT.java | 1 + 3 files changed, 1 insertion(+), 269 deletions(-) delete mode 100644 .circleci/README.md delete mode 100644 .circleci/config.yml diff --git a/.circleci/README.md b/.circleci/README.md deleted file mode 100644 index 209ab5ca6..000000000 --- a/.circleci/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Num-portal Pipelines - -## Description - -### Test Stage - -During test stage the application runs the unit tests, integrations tests and dependency-check and stores those as artifacts in CircleCI. -In Artifacts tab in CircleCi you can find the code coverage report of JaCoCo and the dependency-check.html to visualize the -results of the dependency analysis. - -The final step is the sonarscan, which simply uses the CircleCi sonarcloud orb to send the service to analysis to Sonarcloud. - - -### Version Tag Stage - -Is done for branches that follow the following regex naming conventions `^(release\/v\d+\.\d+\.\d+|hotfix\/v\d+\.\d+\.\d+)$` - -For example following branches would execute this step `release/v1.0.1` and `hotfix/v1.0.1`. With these examples -Maven package version would be updated with the given version, and a new commit with tag v1.0.1 would be created and pushed to git. - -### Build and Deploy Stage - -Is done for branches that follow the following regex naming conventions `^(release\/v\d+\.\d+\.\d+|hotfix\/v\d+\.\d+\.\d+|master|develop)$`. - -Meaning the branches executed in the previous step will also execute here, in addition develop and master branches -will execute here. - -In the case of release and hotfix branches a new Docker image is built that has a tag with the version plus suffix -rc, -for example v1.0.1-rc. In the case of master branch the version is pulled from the POM.xml, and that is used as a tag -and in the case of develop, an image with a tag `develop` is pushed. - diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 94162d24e..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,238 +0,0 @@ -version: 2.1 - -workflows: - version: 2 - nightly: - triggers: - - schedule: - cron: "0 21 * * *" - filters: - branches: - only: - - nightly-builds - jobs: - - test: - context: - - org-global - - ms_teams - build_and_test: - jobs: - - test: - context: - - org-global - - ms_teams - - tag-version: - requires: - - test - filters: - branches: - only: - - /^(release\/v\d+\.\d+\.\d+|hotfix\/v\d+\.\d+\.\d+|master)$/ - - build_and_deploy: - requires: - - test - filters: - branches: - only: - - /^(release\/v\d+\.\d+\.\d+|hotfix\/v\d+\.\d+\.\d+|master|develop)$/ - -jobs: - test: - machine: - image: ubuntu-2204:2022.10.2 - steps: - - checkout - - cache-out-maven-dependencies - - run: - name: Run unit tests - command: ./mvnw clean test - - run: - name: Run integration tests - command: ./mvnw verify -P integration-tests - - run: - name: Run CVE scan - command: ./mvnw dependency-check:check - - run: - name: Save test results - command: | - mkdir -p ~/test-results/unit-tests/ - mkdir -p ~/test-results/integration-tests/ - find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/unit-tests/ \; - find . -type f -regex ".*/target/failsafe-reports/.*xml" -exec cp {} ~/test-results/integration-tests/ \; - when: always - - store_artifacts: - path: target/site/jacoco-merged-test-coverage-report - - store_artifacts: - path: target/dependency-check-report.html - - store_test_results: - path: ~/test-results/unit-tests/ - - store_test_results: - path: ~/test-results/integration-tests/ -# - sonarcloud/scan - - cache-in-maven-dependencies - - jq/install - - run: - name: Get OWASP report artifact URL - command: | - ARTIFACTS_JSON=$(curl -X GET \ - "https://circleci.com/api/v2/project/github/NUM-Forschungsdatenplattform/$CIRCLE_PROJECT_REPONAME/$CIRCLE_BUILD_NUM/artifacts" \ - -H "Accept: application/json") - NUMBER_OF_ITEMS=$(echo $ARTIFACTS_JSON | jq '.items | length') - for (( i=0; i<$NUMBER_OF_ITEMS; i++ )) - do - ITEM=$(echo $ARTIFACTS_JSON | jq '.items['$i']') - PATH_OF_ARTIFACT=$(echo ${ITEM} | jq '.path') - if [[ "$PATH_OF_ARTIFACT" = *"dependency-check-report.html"* ]] - then - echo "export URL_OF_OWASP_REPORT=$(echo $ITEM | jq '.url' -r)" >> $BASH_ENV - break - fi - done - - run: - name: MS Teams OWASP Message - command: | - SHORT_SHA1=`echo -n $CIRCLE_SHA1 | head -c 7` - if [ `echo "$CIRCLE_REPOSITORY_URL" | grep "^git@github.com"` ]; then - COMMIT_LINK=\[$SHORT_SHA1\]\(https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1\) - elif [ `echo "$CIRCLE_REPOSITORY_URL" | grep "^git@bitbucket.org"` ]; then - COMMIT_LINK=\[$SHORT_SHA1\]\(https://bitbucket.org/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1\) - else - >&2 echo unknown version control system: $CIRCLE_REPOSITORY_URL - fail - fi - # Note that the "\<<" in the heredoc declaration is escaped from - # CircleCI's parameters syntax. - MS_TEAMS_MSG_TEMPLATE=$(cat \<> \n\n *CircleCI build:* ${CIRCLE_BUILD_URL} \n\n" - } - ], - "markdown": true - } - ] - } - END_HEREDOC - ) - echo "$MS_TEAMS_MSG_TEMPLATE" > /tmp/ms_teams_message - when: always - - run: - name: Report Build Success - command: | - MSG_PATH=/tmp/ms_teams_success_message - sed -e 's/__build_status__/Success/' -e 's/__theme_color__/14a603/' /tmp/ms_teams_message > $MSG_PATH - curl --fail -H "Content-Type: application/json" --data-binary @$MSG_PATH $CODEX_NOTIFICATIONS - when: on_success - - run: - name: Report Build Failure - command: | - MSG_PATH=/tmp/ms_teams_failure_message - sed -e 's/__build_status__/Failed/' -e 's/__theme_color__/e2091d/' /tmp/ms_teams_message > $MSG_PATH - curl --fail -H "Content-Type: application/json" --data-binary @$MSG_PATH $CODEX_NOTIFICATIONS - when: on_fail - tag-version: - docker: - - image: cimg/openjdk:17.0.8 - steps: - - checkout - - configure-git-for-ci-bot - - run: - name: Update Snapshot Develop Version - description: | - This automatically bumps the application version when there is a commit to release branch - It will set the version number to release branch version number, but it will do it only once. If the commit is - to the master branch, then the pipeline will create a tag and push it to the Git - command: | - VERSION_NUMBER_FROM_BRANCH="$(echo $CIRCLE_BRANCH | awk -F'/v' '{print $2;}')" - VERSION_NUMBER_FROM_POM=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec) - if [ $CIRCLE_BRANCH = "master" ]; then - git tag -a $VERSION_NUMBER_FROM_POM -m "num-portal release version ${VERSION_NUMBER_FROM_POM}" - git push origin --tags - elif [ $VERSION_NUMBER_FROM_BRANCH != $VERSION_NUMBER_FROM_POM ]; then - echo "Updating the application version from the branch to ${VERSION_NUMBER_FROM_BRANCH}" - ./mvnw versions:set -DnewVersion=$VERSION_NUMBER_FROM_BRANCH versions:commit - git commit -am "updated project version to v${VERSION_NUMBER_FROM_BRANCH} [skip ci]" - git push --set-upstream origin $CIRCLE_BRANCH - fi - - exit 0 - - build_and_deploy: - docker: - - image: cimg/openjdk:17.0.8 - auth: - username: $DOCKER_USER - password: $DOCKER_HUB_PASSWORD - steps: - - checkout - - configure-git-for-ci-bot - - cache-out-maven-dependencies - - setup_remote_docker: - version: 20.10.23 - - run: - name: Build and tag image and push - command: | - if [ $CIRCLE_BRANCH = "master" ]; then - TAG=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec) - git push -u origin master:nightly-builds # Make sure that the nightly build branch is up-to-date with master - elif [ $CIRCLE_BRANCH = "develop" ]; then - TAG=$CIRCLE_BRANCH - else - TAG="$(echo $CIRCLE_BRANCH | awk -F'/v' '{print $2;}')-rc$CIRCLE_BUILD_NUM" - fi - echo "Publishing Docker image with following tag: ${TAG}" - echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin - ./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=$DOCKER_USER/num-portal:$TAG -DskipTests - docker push $DOCKER_USER/num-portal:$TAG - - cache-in-maven-dependencies - -commands: - configure-git-for-ci-bot: - steps: - - add_ssh_keys: - fingerprints: - - 0c:dd:08:d5:13:cf:20:3c:25:c4:f3:59:a8:a5:c4:36 - - run: - name: Configure GIT - command: | - git config --global user.email "50235421+ehrbase-tech-user@users.noreply.github.com" - git config --global user.name "ci-bot" - git remote -v - - - cache-out-maven-dependencies: - steps: - - run: - name: Generate Cache Checksum for Maven Dependencies - command: find /home/circleci/project -name 'pom.xml' | sort | xargs cat > /tmp/num-portal_maven_cache_seed - - restore_cache: - key: v1-num-portal-deps- - - cache-in-maven-dependencies: - steps: - - save_cache: - key: v1-num-portal-deps-{{ checksum "/tmp/num-portal_maven_cache_seed" }} - paths: - - ~/.m2 - - -orbs: - sonarcloud: sonarsource/sonarcloud@2.0.0 - jq: circleci/jq@2.2.0 diff --git a/src/test/java/de/vitagroup/num/integrationtesting/tests/CohortControllerIT.java b/src/test/java/de/vitagroup/num/integrationtesting/tests/CohortControllerIT.java index f07f04afd..0a566d6cb 100644 --- a/src/test/java/de/vitagroup/num/integrationtesting/tests/CohortControllerIT.java +++ b/src/test/java/de/vitagroup/num/integrationtesting/tests/CohortControllerIT.java @@ -107,6 +107,7 @@ public void shouldAccessCohortApiWithRightRole() { } @Test + @Ignore @SneakyThrows @WithMockNumUser( userId = UNAUTHORIZED_USER_ID,