Newer
Older
image: sharing-codeability.uibk.ac.at:5051/development/sharing/codeability-sharing-platform/root-jhipster
- lint
- build
- test
- analyze
- 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"
- 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
maven-compile:
stage: build
script:
- ./mvnw -ntp compile -P-webapp -Dmaven.repo.local=$MAVEN_USER_HOME
needs: []
cache: []
maven-test:
services:
- docker:20-dind
variables:
DOCKER_HOST: 'tcp://docker:2375'
DOCKER_TLS_CERTDIR: ''
# APPLICATION_GITLAB_ADMINACCESSTOKEN: $APPLICATION_GITLAB_ADMINACCESSTOKEN
# APPLICATION_GITLAB_GENERALACCESSTOKEN: $APPLICATION_GITLAB_GENERALACCESSTOKEN
stage: test
cache:
# inherit all global cache settings
<<: *global_cache
# override the policy
policy: pull
script:

Michael Breu
committed
- ./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:
junit:
- target/surefire-reports/TEST-*.xml
- target/failsafe-reports/TEST-*.xml
paths:
- target/surefire-reports
- target/failsafe-reports
- target/site
when: always
before_script:
- export APPLICATION_GITLAB_ADMINACCESSTOKEN=$APPLICATION_GITLAB_ADMINACCESSTOKEN
- export APPLICATION_GITLAB_GENERALACCESSTOKEN=$APPLICATION_GITLAB_GENERALACCESSTOKEN
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
needs: []
before_script:
- export NG_CLI_ANALYTICS="false"
- export MAVEN_USER_HOME=`pwd`/.maven
- npm ci --cache .npm --prefer-offline
deploy:
stage: deploy
cache: []
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
- 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) && cd gitsearch2/gitsearch && git fetch && git stash && git checkout $CI_COMMIT_REF_NAME && git pull && ./manual_deploy.sh && exit"
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
- 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 stash && git checkout $CI_COMMIT_REF_NAME && git pull && ./manual_deploy.sh && exit"
when: manual
e2e-test:
stage: e2e
cache:
# inherit all global cache settings
<<: *global_cache
# override the policy
policy: pull
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 stash && git checkout $CI_COMMIT_REF_NAME && git pull && 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
- 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'
- ls -l ../../..
artifacts:
paths:
- public
only:
- master
- development
- 431-restarbeiten-fur-migration-indexing-von-filehooks-nach-gitsearch