diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3acd8ca100819fe76459aa2181e9f67aca744c5d..6f36569b7fcaa4633d181b82e6ee50b975bbc96c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,160 +6,160 @@ # See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence image: docker:git services: -- docker:dind + - docker:dind variables: DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: '' stages: -- test -- build -- quality -- deploy -- publish + - test + - build + - quality + - deploy + - publish test: stage: test - image: node:14.15.4-alpine + image: node:14.18-alpine before_script: - - apk add git + - apk add git script: - - yarn - - yarn test --ci --reporters=default --reporters=jest-junit + - yarn + - yarn test --ci --reporters=default --reporters=jest-junit coverage: "/All files[^|]*\\|[^|]*\\s+([\\d\\.]+)/" artifacts: when: always reports: junit: - - junit.xml + - junit.xml only: - - dev - - master - - merge_requests + - dev + - master + - merge_requests build-test: stage: build - image: node:14.15.4-alpine + image: node:14.18-alpine before_script: - - apk add git - - apk add bash + - apk add git + - apk add bash script: - - yarn - - yarn build + - yarn + - yarn build only: - - merge_requests + - merge_requests artifacts: paths: - - build/assets + - build/assets build-dev: stage: build - image: node:14.15.4-alpine + image: node:14.18-alpine before_script: - - apk add git - - apk add bash + - apk add git + - apk add bash script: - - yarn - - yarn build-dev - - git config --global user.name build-pipeline - - git config --global user.email "$GIT_USER" - - git config --global user.password "$GIT_PWD" - - git config user.email "$GIT_USER" - - git remote set-url origin https://"$GIT_USER":"$GIT_PWD"@forge.grandlyon.com/web-et-numerique/llle_project/ecolyo.git - - git config --global credential.helper store - - yarn deploy-dev + - yarn + - yarn build-dev + - git config --global user.name build-pipeline + - git config --global user.email "$GIT_USER" + - git config --global user.password "$GIT_PWD" + - git config user.email "$GIT_USER" + - git remote set-url origin https://"$GIT_USER":"$GIT_PWD"@forge.grandlyon.com/web-et-numerique/llle_project/ecolyo.git + - git config --global credential.helper store + - yarn deploy-dev only: - - dev + - dev build: stage: build - image: node:14.15.4-alpine + image: node:14.18-alpine before_script: - - apk add git - - apk add bash + - apk add git + - apk add bash script: - - yarn - - yarn build - - git config --global user.name build-pipeline - - git config --global user.email "$GIT_USER" - - git config --global user.password "$GIT_PWD" - - git config user.email "$GIT_USER" - - git remote set-url origin https://"$GIT_USER":"$GIT_PWD"@forge.grandlyon.com/web-et-numerique/llle_project/ecolyo.git - - git config --global credential.helper store - - yarn deploy + - yarn + - yarn build + - git config --global user.name build-pipeline + - git config --global user.email "$GIT_USER" + - git config --global user.password "$GIT_PWD" + - git config user.email "$GIT_USER" + - git remote set-url origin https://"$GIT_USER":"$GIT_PWD"@forge.grandlyon.com/web-et-numerique/llle_project/ecolyo.git + - git config --global credential.helper store + - yarn deploy only: - - master + - master build_stack: stage: build script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - - docker build -t "$CI_REGISTRY_IMAGE/cozy-env:latest" ./docker/ - - docker push $CI_REGISTRY_IMAGE/cozy-env:latest + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - docker build -t "$CI_REGISTRY_IMAGE/cozy-env:latest" ./docker/ + - docker push $CI_REGISTRY_IMAGE/cozy-env:latest only: - - master + - master when: manual publish: stage: publish - image: node:14.15.4-alpine + image: node:14.18-alpine before_script: - - apk add git + - apk add git script: - - yarn cozyPublish + - yarn cozyPublish only: - - tags + - tags when: manual sonarqube: stage: quality only: - - dev + - dev image: registry.forge.grandlyon.com/apoyen2/sonnar-scanner-gl:master before_script: - - export NODE_PATH=$NODE_PATH:`npm root -g` - - npm install -g typescript + - export NODE_PATH=$NODE_PATH:`npm root -g` + - npm install -g typescript script: - - 'sonar-scanner -Dsonar.projectName="ecolyo" -Dsonar.projectVersion=1.0 -Dsonar.sourceEncoding=UTF-8 - -Dsonar.projectBaseDir=. -Dsonar.host.url=${SONAR_URL} -Dsonar.projectKey=${CI_PROJECT_PATH_SLUG} - -Dsonar.login=${SONAR_TOKEN} -Dsonar.cpd.exclusions=tests/**,src/**/*.spec.ts* - -Dsonar.qualitygate.wait=true' + - 'sonar-scanner -Dsonar.projectName="ecolyo" -Dsonar.projectVersion=1.0 -Dsonar.sourceEncoding=UTF-8 + -Dsonar.projectBaseDir=. -Dsonar.host.url=${SONAR_URL} -Dsonar.projectKey=${CI_PROJECT_PATH_SLUG} + -Dsonar.login=${SONAR_TOKEN} -Dsonar.cpd.exclusions=tests/**,src/**/*.spec.ts* + -Dsonar.qualitygate.wait=true' sonarqube-mr: stage: quality only: - - merge_requests + - merge_requests image: registry.forge.grandlyon.com/apoyen2/sonnar-scanner-gl:master before_script: - - export NODE_PATH=$NODE_PATH:`npm root -g` - - npm install -g typescript + - export NODE_PATH=$NODE_PATH:`npm root -g` + - npm install -g typescript script: - - 'sonar-scanner -Dsonar.projectName="ecolyo-mr" -Dsonar.projectVersion=1.0 -Dsonar.sourceEncoding=UTF-8 - -Dsonar.projectBaseDir=. -Dsonar.host.url=${SONAR_URL} -Dsonar.projectKey=ecolyo-mr - -Dsonar.login=${SONAR_MR_TOKEN} -Dsonar.cpd.exclusions=tests/**,src/**/*.spec.ts* - -Dsonar.qualitygate.wait=true' + - 'sonar-scanner -Dsonar.projectName="ecolyo-mr" -Dsonar.projectVersion=1.0 -Dsonar.sourceEncoding=UTF-8 + -Dsonar.projectBaseDir=. -Dsonar.host.url=${SONAR_URL} -Dsonar.projectKey=ecolyo-mr + -Dsonar.login=${SONAR_MR_TOKEN} -Dsonar.cpd.exclusions=tests/**,src/**/*.spec.ts* + -Dsonar.qualitygate.wait=true' deploy_demo: stage: deploy tags: - - deploy + - deploy script: - - cd /root/ecolyo-infra-scripts/cicid_scripts - - "./update_ecolyo_dev.sh" + - cd /root/ecolyo-infra-scripts/cicid_scripts + - './update_ecolyo_dev.sh' only: - - dev + - dev deploy_alpha: stage: deploy tags: - - deploy + - deploy script: - - cd /root/ecolyo-infra-scripts/cicid_scripts - - "./update_all_ecolyo_dev.sh" + - cd /root/ecolyo-infra-scripts/cicid_scripts + - './update_all_ecolyo_dev.sh' only: - - tags + - tags sast: stage: test include: -- template: Security/SAST.gitlab-ci.yml + - template: Security/SAST.gitlab-ci.yml