-
Daniel Gerhardt authored88e3f339
This GitLab CI configuration is valid.
Learn more
.gitlab-ci.yml 1.55 KiB
variables:
MIRROR_REPO: git@github.com:thm-projects/arsnova-backend.git
WAR_FILE: target/arsnova-backend-*.war
stages:
- analysis
- test
- build
- deploy
- synchronization
cache:
paths:
- .m2/
sync_mirror:
stage: synchronization
when: always
except:
- production
- staging
tags:
- git
allow_failure: true
script:
- mkdir ~/.ssh && echo "$GITHUB_HOST_KEY" > ~/.ssh/known_hosts
- eval $(ssh-agent -s) && ssh-add <(echo "$GITHUB_DEPLOY_KEY")
- git clone --bare "$CI_REPOSITORY_URL" mirror.git
- cd mirror.git
- git update-ref -d refs/tags/production
- git update-ref -d refs/tags/staging
- git push --mirror "$MIRROR_REPO"
sonar:
stage: analysis
only:
- master
tags:
- maven
allow_failure: true
script:
- mvn sonar:sonar
checkstyle:
stage: analysis
tags:
- maven
script:
- mvn checkstyle:checkstyle
test:
stage: test
tags:
- maven
script:
- mvn test
package:
stage: build
tags:
- maven
artifacts:
paths:
- $WAR_FILE
script:
- mvn package -DskipTests
tomcat_production:
stage: deploy
only:
- production
tags:
- curl
script:
- curl --fail --upload-file $WAR_FILE "https://$PROD_TOMCAT_USER:$PROD_TOMCAT_PASSWORD@$PROD_TOMCAT_HOST/manager/text/deploy?path=%2Fapi&update=true"
tomcat_development:
stage: deploy
only:
- staging
tags:
- curl
script:
- curl --fail --upload-file $WAR_FILE "https://$DEV_TOMCAT_USER:$DEV_TOMCAT_PASSWORD@$DEV_TOMCAT_HOST/manager/text/deploy?path=%2Fapi&update=true"