This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects

audit event failed tests

Merged Philipp Gritsch requested to merge audit-event-failed-test into development
Files
2
+ 226
1
@@ -8,12 +8,74 @@ cache: &global_cache
policy: pull-push
stages:
- lint
- build
- test
- analyze
- release
- deploy
- e2e
- releaseProd
- deployProd
before_script:
- export NG_CLI_ANALYTICS="false"
- export MAVEN_USER_HOME=`pwd`/.maven
include:
- template: Jobs/Secret-Detection.gitlab-ci.yml
secret_detection:
variables:
GIT_DEPTH: 100
SECRET_DETECTION_LOG_OPTIONS: ${CI_MERGE_REQUEST_DIFF_BASE_SHA}..${CI_COMMIT_SHA}
script:
- apk add jq
- /analyzer run
- NUMBER_OF_VULNERABILITIES=$(cat gl-secret-detection-report.json | jq --raw-output '.vulnerabilities | length')
- if [[ $NUMBER_OF_VULNERABILITIES -gt 0 ]]; then exit "1"; fi
allow_failure: false
artifacts:
paths: [gl-secret-detection-report.json]
when: always
pmdCheckstylePrettierLint:
stage: lint
cache: []
when: always
script:
- 'export VERSION="6.40.0"'
- 'wget "https://github.com/pmd/pmd/releases/download/pmd_releases%2F$VERSION/pmd-bin-$VERSION.zip"'
- 'jar -xf "pmd-bin-$VERSION.zip"'
- 'chmod u+x "pmd-bin-$VERSION/bin/run.sh"'
- SUCCESS=true
- echo "Running PMD"
- '"pmd-bin-$VERSION/bin/run.sh" pmd -d src/main/java -f textcolor -R pmd_rules.xml -no-cache 2>&1 | tee pmd.log || SUCCESS=false'
- echo "Running checkstyle"
- ./mvnw -ntp checkstyle:check -Dmaven.repo.local=$MAVEN_USER_HOME || SUCCESS=false
- echo "Running prettier"
- node --version; npm --version
- npm install
- npm run prettier:check
- echo "Running eslint"
- 'npm run lint | tee lint.log'
- "! grep -qE '✖ [0-9]+ problem' lint.log || SUCCESS=false"
- $SUCCESS
needs: []
artifacts:
when: on_failure
expire_in: 2 days
paths:
- pmd.log
- lint.log
maven-compile:
stage: build
script:
- ./mvnw -ntp compile -P-webapp -Dmaven.repo.local=$MAVEN_USER_HOME
needs: []
cache: []
maven-test:
services:
- docker:20-dind
@@ -30,7 +92,7 @@ maven-test:
policy: pull
script:
- java --version
- ./mvnw -ntp verify -P-webapp -Dmaven.repo.local=$MAVEN_USER_HOME -Dapplication.gitlab.guestAccessToken=$APPLICATION_GITLAB_GENERALACCESSTOKEN -Dapplication.gitlab.adminAccessToken=$APPLICATION_GITLAB_ADMINACCESSTOKEN -Dspring.profiles.active=testcontainers -Dtest=AuditEventServiceIT
- ./mvnw -ntp verify -P-webapp -Dmaven.repo.local=$MAVEN_USER_HOME -Dapplication.gitlab.guestAccessToken=$APPLICATION_GITLAB_GENERALACCESSTOKEN -Dapplication.gitlab.adminAccessToken=$APPLICATION_GITLAB_ADMINACCESSTOKEN -Dspring.profiles.active=testcontainers
allow_failure: true
artifacts:
reports:
@@ -48,3 +110,166 @@ maven-test:
- export APPLICATION_GITLAB_ADMINACCESSTOKEN=$APPLICATION_GITLAB_ADMINACCESSTOKEN
- export APPLICATION_GITLAB_GENERALACCESSTOKEN=$APPLICATION_GITLAB_GENERALACCESSTOKEN
- export MAIL_FROM=no-reply@uibk.ac.at
frontend-test:
stage: test
cache:
<<: *global_cache
policy: pull
script:
- npm test
artifacts:
reports:
junit: target/test-results/TESTS-results-jest.xml
paths:
- target/test-results
when: always
expire_in: 2 days
needs: []
before_script:
- export NG_CLI_ANALYTICS="false"
- export MAVEN_USER_HOME=`pwd`/.maven
- npm ci --cache .npm --prefer-offline
deploy:
stage: deploy
cache: []
needs: []
before_script:
- mkdir -p ~/.ssh
- echo "${SSH_BKY_DEPLOY}" > ~/.ssh/id_rsa
- chmod 700 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
variables:
REGISTRY_URL: sharing-codeability.uibk.ac.at:5051
IMAGE_TAG: sharing-codeability.uibk.ac.at:5051/development/sharing/codeability-sharing-platform/gitsearch/$CI_COMMIT_REF_NAME
GITSEARCH_PATH: /home/contDeploy/gitsearch2/gitsearch
script:
- ssh contDeploy@codeability-austria -p 1022 "export CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME && export COMMIT_DATE=$(git show -s --format=%ct $CI_COMMIT_SHA) && export GITSEARCH_PATH=${GITSEARCH_PATH} && cd gitsearch2/gitsearch && git fetch && git checkout -f $CI_COMMIT_REF_NAME && git reset --hard origin/$CI_COMMIT_REF_NAME && ./manual_deploy.sh && exit"
when: manual
deployProd:
stage: deployProd
cache: []
only:
refs:
- master
before_script:
- mkdir -p ~/.ssh
- echo "${SSH_BKY_DEPLOY_PROD}" > ~/.ssh/id_rsa
- chmod 700 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
variables:
REGISTRY_URL: sharing-codeability.uibk.ac.at:5051
IMAGE_TAG: sharing-codeability.uibk.ac.at:5051/development/sharing/codeability-sharing-platform/gitsearch/$CI_COMMIT_REF_NAME
GITSEARCH_PATH: /home/contDeploy/gitsearch
script:
- ssh contDeploy@sharing-codeability -p 1022 "export REGISTRY_URL=$REGISTRY_URL export CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME && export COMMIT_DATE=$(git show -s --format=%ct $CI_COMMIT_SHA) && cd gitsearch/ && git fetch && git checkout -f $CI_COMMIT_REF_NAME && git reset --hard origin/$CI_COMMIT_REF_NAME && ./manual_deploy.sh && exit"
when: manual
e2e-test:
stage: e2e
cache:
# inherit all global cache settings
<<: *global_cache
# override the policy
policy: pull
# only:
# refs:
# - development
services:
- selenium/standalone-chrome:104.0
dependencies:
- deploy
before_script:
- mkdir -p ~/.ssh
- echo "${SSH_BKY_DEPLOY}" > ~/.ssh/id_rsa
- chmod 700 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
script:
- ssh contDeploy@codeability-austria -p 1022 "export GITBRANCH=$CI_COMMIT_REF_NAME && cd gitsearch && git fetch && git checkout -f $CI_COMMIT_REF_NAME && git reset --hard origin/$CI_COMMIT_REF_NAME && npm install && export E2E_PASSWORD=$E2E_PASSWORD && npm run e2e:ci --host=selenium__standalone-chrome && exit"
when: manual
# If you want to update the chromediver and chrome browser for e2e tests add:
# package.json
#"e2e:update-webdriver": "webdriver-manager update --gecko false",
#"postinstall": "npm run e2e:update-webdriver",
#execute in the server as contDeploy
# cd gitsearch2/gitsearch
# delete the existing google-chrome-stable_current_amd64.deb
# - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# - sudo dpkg -i google-chrome*.deb
sonar-analyze:
stage: analyze
cache:
# inherit all global cache settings
<<: *global_cache
# override the policy
policy: pull
variables:
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
GIT_DEPTH: 0 # avoid shallow clone to give sonar all the info it needs
dependencies:
- maven-test
- frontend-test
script:
- ./mvnw -ntp org.jacoco:jacoco-maven-plugin:prepare-agent initialize sonar:sonar -Dsonar.organization=codeAbility -Dsonar.host.url=https://qe-sonarqube.uibk.ac.at/ -Dsonar.login=${SONAR_TOKEN_QE} -Dmaven.repo.local=$MAVEN_USER_HOME
# - ./mvnw -ntp org.jacoco:jacoco-maven-plugin:prepare-agent initialize sonar:sonar -Dsonar.organization=codeAbility -Dsonar.host.url=https://server.arctis.at/sonar/ -Dsonar.login=${SONAR_TOKEN} -Dmaven.repo.local=$MAVEN_USER_HOME
allow_failure: true
before_script:
- export NG_CLI_ANALYTICS="false"
- export MAVEN_USER_HOME=`pwd`/.maven
- npm ci --cache .npm --prefer-offline
sonar-analyze-manual:
stage: analyze
cache:
# inherit all global cache settings
<<: *global_cache
# override the policy
policy: pull
variables:
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
GIT_DEPTH: 0 # avoid shallow clone to give sonar all the info it needs
dependencies:
- maven-test
- frontend-test
script:
- ./mvnw -ntp org.jacoco:jacoco-maven-plugin:prepare-agent initialize sonar:sonar -Dsonar.organization=codeAbility -Dsonar.host.url=https://qe-sonarqube.uibk.ac.at/ -Dsonar.login=${SONAR_TOKEN_QE} -Dmaven.repo.local=$MAVEN_USER_HOME
# - ./mvnw -ntp org.jacoco:jacoco-maven-plugin:prepare-agent initialize sonar:sonar -Dsonar.organization=codeAbility -Dsonar.host.url=https://server.arctis.at/sonar/ -Dsonar.login=${SONAR_TOKEN} -Dmaven.repo.local=$MAVEN_USER_HOME
allow_failure: true
before_script:
- export NG_CLI_ANALYTICS="false"
- export MAVEN_USER_HOME=`pwd`/.maven
- npm ci --cache .npm --prefer-offline
when: manual
pages:
tags:
- python3.7
stage: analyze
before_script:
- apt-get update
- apt-get install -y python3-pip python3-sphinx
- pip3 install sphinx_rtd_theme
- 'pip3 install -r src/main/docs/requirements-docs.txt'
script:
- cd src/main/docs
- make html
- mv -v build/html/ ../../../public/
- ls -l ../../..
artifacts:
paths:
- public
only:
- master
- development
- 431-restarbeiten-fur-migration-indexing-von-filehooks-nach-gitsearch
needs: []