Skip to content

Instantly share code, notes, and snippets.

addons:
apt:
packages:
- sshpass
stages:
- frontend
- backend
- deploy
- patch
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- .m2/repository/
- src/main/resources/static/
- dist/
cache:
directories:
- "$HOME/.m2/repository/"
- "$HOME/src/main/resources/static/"
- "$HOME/dist/"
Frontend:
extends: .Job_Only
image: node:10
stage: frontend
before_script:
- npm install
script:
- npm test
after_script:
- npm run dist
variables:
MAVEN_CLI_OPTS: "--batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
CI_REPOSITORY_URL: https://alvin.h:$ACCESS_TOKEN@gitlab.com/$CI_PROJECT_PATH.git
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- src/main/resources/static/
- dist/
...
Deploy:
extends: .Job_Only
image: maven:3.3.9
stage: deploy
before_script:
- POM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
- apt-get update -qq && apt-get install -y -qq sshpass
script:
- ls -all ./dist
...
BE_Test:
extends: .Job_Only
image: maven:3.3.9
stage: betest
script:
- mvn test $MAVEN_OPTS
...
...
BE_Build:
extends: .Job_Only
image: maven:3.3.9
stage: bebuild
script:
- mvn install -DskipTests=true $MAVEN_OPTS $MAVEN_CLI_OPTS
...
...
Patch:
image: maven:3.3.9
only:
changes:
- "pom.xml"
refs:
- merge_requests
stage: patch
before_script: