Commit 70b88899 authored by Nicolas Pernoud's avatar Nicolas Pernoud
Browse files

fix: gitlab CI

parent 08ba93ec
Pipeline #24772 passed with stage
in 1 minute and 13 seconds
#
# Ce fichier doit être adapté en fonction du projet en renseignant les variables SONAR_PROJECT_KEY et SONAR_TOKEN dans la configuration graphique du projet (https://forge.grandlyon.com/<CHEMIN_DE_VOTRE_PROJET>/settings/ci_cd)
# La variable SONAR_PROJET_KEY peut être trouvée sur https://sonarqube.forge.grandlyon.com/dashboard en ouvrant le projet et en copiant collant le champ en bas à droite (Project Key)
#
# La variable SONAR_TOKEN doit être générée par le responsable du projet depuis son interface sonar : https://sonarqube.forge.grandlyon.com/account/security/
#
image: docker:git
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
SONAR_URL: https://sonarqube.forge.grandlyon.com
GIT_STRATEGY: clone
GIT_DEPTH: 0
SONAR_URL: http://sonarqube.forge.grandlyon.com:9000
stages:
- sonar-analysis
- build
sonarqube:
stage: sonar-analysis
image: skilldlabs/sonar-scanner:3.4.0
sonarqube-check:
image:
name: sonarsource/sonar-scanner-cli:4
entrypoint: [""]
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- >
sonar-scanner
-Dsonar.projectName=${CI_PROJECT_NAME}
-Dsonar.projectVersion=1.0
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectBaseDir=.
-Dsonar.host.url=${SONAR_URL}
-Dsonar.projectKey=${SONAR_PROJECT_KEY}
-Dsonar.login=${SONAR_TOKEN}
-Dsonar.organization="default-organization"
- sonar-scanner -Dsonar.login=${SONAR_TOKEN} -Dsonar.projectName=${CI_PROJECT_NAME} -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.qualitygate.wait=true -Dsonar.host.url=${SONAR_URL}
allow_failure: true
only:
- master
tags:
- build-push-to-registry
build-master:
stage: build
services:
- docker:dind
before_script:
- docker logout
- docker --version
script:
- echo "+++++++ DÉBUT de construction de l'image Docker ++++++"
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- DOCKER_BUILDKIT=1 docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
- echo "+++++++ FIN de construction de l'image Docker ++++++"
tags:
- build-push-to-registry
only:
- master
build:
stage: build
services:
- docker:dind
before_script:
- docker logout
- docker --version
script:
- echo "+++++++ DÉBUT de construction de l'image Docker ++++++"
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- DOCKER_BUILDKIT=1 docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- echo "+++++++ FIN de construction de l'image Docker ++++++"
tags:
- build-push-to-registry
except:
- master
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment