Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit e45849f9 authored by Christophe Chaudier's avatar Christophe Chaudier :rocket:
Browse files

Merge branch '52-java-build' into 'master'

Resolve "(java) build"

Closes #52

See merge request lydra/gitlab-ci-templates!36
parents 7c64809e 9b49f666
No related branches found
No related tags found
No related merge requests found
Pipeline #1354 failed
...@@ -6,6 +6,7 @@ include: ...@@ -6,6 +6,7 @@ include:
- '/templates/activate-dind.yml' - '/templates/activate-dind.yml'
- '/templates/stages.yml' - '/templates/stages.yml'
- '/templates/job/java/lint.yml' - '/templates/job/java/lint.yml'
- '/templates/job/java/build.yml'
- '/templates/job/container/build.yml' - '/templates/job/container/build.yml'
- '/templates/job/container/lint.yml' - '/templates/job/container/lint.yml'
- '/templates/job/container/delivery.yml' - '/templates/job/container/delivery.yml'
...@@ -101,6 +102,10 @@ node::test: ...@@ -101,6 +102,10 @@ node::test:
- test/node/vueapp/node_modules - test/node/vueapp/node_modules
# --------[ Java ]-------- # --------[ Java ]--------
java:build:
variables:
working_directory: "test/java-jar"
java:lint: java:lint:
variables: variables:
working_directory: "test/java-jar" working_directory: "test/java-jar"
...@@ -247,7 +247,7 @@ node::build: ...@@ -247,7 +247,7 @@ node::build:
paths: paths:
- node_modules - node_modules
before_script: before_script:
- cd $working_directory - cd ${working_directory}
script: script:
- npm ci - npm ci
``` ```
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
variables: variables:
working_directory: "$CI_PROJECT_DIR" working_directory: "$CI_PROJECT_DIR"
script: script:
- cd $working_directory - cd ${working_directory}
\ No newline at end of file
...@@ -19,14 +19,15 @@ variables: ...@@ -19,14 +19,15 @@ variables:
variables: variables:
working_directory: "$CI_PROJECT_DIR" working_directory: "$CI_PROJECT_DIR"
before_script: before_script:
- cd $working_directory - cd ${working_directory}
.base_ansible: .base_ansible:
extends: .base_tpl extends: .base_tpl
variables: variables:
ANSIBLE_VAULT_PASSWORD_FILE: .vault_pass ANSIBLE_VAULT_PASSWORD_FILE: .vault_pass
before_script: before_script:
- cd $working_directory - cd ${working_directory}
- test -z ${ANSIBLE_VAULT_PASSWORD} || echo ${ANSIBLE_VAULT_PASSWORD} > ${ANSIBLE_VAULT_PASSWORD_FILE} - test -z ${ANSIBLE_VAULT_PASSWORD} || echo ${ANSIBLE_VAULT_PASSWORD} > ${ANSIBLE_VAULT_PASSWORD_FILE}
- test -d ansible && chmod 750 ansible - test -d ansible && chmod 750 ansible
...@@ -40,7 +41,7 @@ variables: ...@@ -40,7 +41,7 @@ variables:
## without extra base64 encoding. ## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556 ## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- cd $working_directory - cd ${working_directory}
.node-cache-push: .node-cache-push:
cache: cache:
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
variables: variables:
working_directory: "$CI_PROJECT_DIR" working_directory: "$CI_PROJECT_DIR"
script: script:
- cd $working_directory - cd ${working_directory}
\ No newline at end of file
# Build JAVA applications using Apache Maven (http://maven.apache.org)
# For docker image tags see https://hub.docker.com/_/maven/
# For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
# L'application java est construite et tout les fichier target/*.jar sont mis dans le cache pour les jobs suivants
java:build:
extends:
- .java
- .java-cache-push
stage: build
script:
- mvn ${MAVEN_CLI_OPTS} dependency:go-offline ${MAVEN_SETTINGS}
- mvn ${MAVEN_CLI_OPTS} clean package -DskipTests ${MAVEN_SETTINGS}
...@@ -12,8 +12,9 @@ variables: ...@@ -12,8 +12,9 @@ variables:
tpl_directory: "gci-templates" tpl_directory: "gci-templates"
MAVEN_OPTS: "" MAVEN_OPTS: ""
MAVEN_CLI_OPTS: "" MAVEN_CLI_OPTS: ""
JAVA_VERSION: "11" MAVEN_SETTINGS: ""
MAVEN_VERSION: "3" MAVEN_VERSION: "3"
JAVA_VERSION: "11"
JDK_TYPE: "openjdk" JDK_TYPE: "openjdk"
...@@ -22,14 +23,14 @@ variables: ...@@ -22,14 +23,14 @@ variables:
variables: variables:
working_directory: "$CI_PROJECT_DIR" working_directory: "$CI_PROJECT_DIR"
before_script: before_script:
- cd $working_directory - cd ${working_directory}
.base_ansible: .base_ansible:
extends: .base_tpl extends: .base_tpl
variables: variables:
ANSIBLE_VAULT_PASSWORD_FILE: .vault_pass ANSIBLE_VAULT_PASSWORD_FILE: .vault_pass
before_script: before_script:
- cd $working_directory - cd ${working_directory}
- test -z ${ANSIBLE_VAULT_PASSWORD} || echo ${ANSIBLE_VAULT_PASSWORD} > ${ANSIBLE_VAULT_PASSWORD_FILE} - test -z ${ANSIBLE_VAULT_PASSWORD} || echo ${ANSIBLE_VAULT_PASSWORD} > ${ANSIBLE_VAULT_PASSWORD_FILE}
- test -d ansible && chmod 750 ansible - test -d ansible && chmod 750 ansible
...@@ -43,7 +44,7 @@ variables: ...@@ -43,7 +44,7 @@ variables:
## without extra base64 encoding. ## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556 ## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- cd $working_directory - cd ${working_directory}
# --------[ Node ]-------- # --------[ Node ]--------
.node-cache-push: .node-cache-push:
...@@ -67,13 +68,30 @@ variables: ...@@ -67,13 +68,30 @@ variables:
image: node:14.15.4-slim image: node:14.15.4-slim
# --------[ Java ]-------- # --------[ Java ]--------
.java-cache-push:
cache:
policy: push
key: "java-$CI_COMMIT_REF_SLUG"
paths:
- ${working_directory}/target/*.jar
.java-cache-pull:
cache:
policy: pull
key: "java-$CI_COMMIT_REF_SLUG"
paths:
- ${working_directory}/target/*.jar
.java: .java:
extends: .base_tpl extends:
- .base_tpl
- .java-cache-pull
image: maven:${MAVEN_VERSION}-${JDK_TYPE}-${JAVA_VERSION} image: maven:${MAVEN_VERSION}-${JDK_TYPE}-${JAVA_VERSION}
variables: variables:
MAVEN_ACTION: "-version" MAVEN_ACTION: "-version"
script: script:
- mvn ${MAVEN_CLI_OPTS} ${MAVEN_ACTION} - mvn ${MAVEN_CLI_OPTS} ${MAVEN_ACTION} ${MAVEN_SETTINGS}
# --------[ Container ]-------- # --------[ Container ]--------
.container:build: .container:build:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment