-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Connected App profile assistance * Reuse msTeamsWebhookUrl during sfdx:org:configure:monitoring prompts * allow to override CONFIG_BRANCH to get forced .sfdx.hardis.BRANCH.yml
- Loading branch information
Showing
6 changed files
with
218 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Vous pouvez personnaliser l'éxécution de votre pipeline ici | ||
variables: | ||
DEPLOY_BRANCHES: /(developpement|integration|recette|preprod|master)/ # Regex contenant la liste des branches où un push va déclencher un déploiement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
--- | ||
################################################################## | ||
# Pipeline de test et déploiement d'un projet DX géré en CI/CD # | ||
# NE PAS MODIFIER !! # | ||
################################################################## | ||
|
||
# Ce pipeline est mis à jour automatiquement par sfdx-hardis | ||
# Vous ne pouvez donc pas le modifier sous peine de voir ces modifications ultérieurement écrasées | ||
# Cependant, vous pouvez configurer des comportements dynamiques en modifiant le fichier ".gitlab-ci-config.yml" | ||
# .gitlab-ci-config.yml ne sera jamais écrasé par sfdx-hardis | ||
include: | ||
- local: ".gitlab-ci-config.yml" | ||
|
||
# Liste ordonnée des étapes du pipeline | ||
stages: | ||
- build # Controle de qualité des sources et création d'une scratch org CI | ||
- test # Tests effectués sur la scratch org effectuée lors de l'étape précédente | ||
- clean # Suppression de la scratch org CI | ||
- check_deploy # Simulation de déploiement du contenu de la branche vers l'org (Sandbox ou autre) associée | ||
- deploy # Déploiement du contenu de la branche vers l'org (Sandbox ou autre) associée | ||
|
||
# On execute les jobs sur l'image hardisgroupcom/sfdx-hardis qui contient les applications necessaires | ||
# Version latest recommandée, cependant beta et alpha peuvent être utilisées pour les tests | ||
image: hardisgroupcom/sfdx-hardis:alpha | ||
|
||
# Variables globales aux jobs | ||
variables: | ||
FORCE_COLOR: '1' | ||
|
||
# Décommenter pour utiliser un des 2 trucs commencés en dessous :) | ||
#default: | ||
|
||
# décommenter le jour ou on a un vrai cache pour les runners gitlab concurrents | ||
# En attendant on utilise les artifacts, même si c est pas joli joli... | ||
# cache: | ||
# key: toto #${CI_COMMIT_REF_SLUG}_CACHE_SFDX_HARDIS | ||
# paths: | ||
# - .cache/sfdx-hardis/.sfdx | ||
# - .sfdx/ | ||
# - config/user/ | ||
# policy: pull | ||
|
||
# Décommenter pour tester une version de sfdx-hardis en cours de dev | ||
# before_script: | ||
# - apk add tree | ||
# - npm install -g typescript | ||
# - git clone --branch NOM_DE_LA_BRANCHE_GIT https://github.com/hardisgroupcom/sfdx-hardis.git | ||
# - cd sfdx-hardis | ||
# - yarn | ||
# - tsc | ||
# - sfdx plugins:link | ||
# - cd .. | ||
|
||
# Controle de la qualité des sources avec Mega-Linter, qui contient sfdx-scanner (apex PMD), | ||
# mais aussi d'autres linters et détecteurs de mauvaises pratiques | ||
check_quality: | ||
stage: build | ||
tags: | ||
- ubuntu | ||
only: | ||
- pushes | ||
- merge_requests | ||
- web | ||
image: nvuillam/mega-linter-salesforce:latest | ||
script: [ "true" ] | ||
variables: | ||
# All available variables are described in documentation | ||
# https://nvuillam.github.io/mega-linter/configuration/ | ||
DEFAULT_WORKSPACE: $CI_PROJECT_DIR | ||
DEFAULT_BRANCH: master | ||
# ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY | ||
artifacts: | ||
when: always | ||
paths: | ||
- report | ||
expire_in: 1 week | ||
|
||
# Check du déploiement dans l'org cible de la merge request | ||
check_deploy_to_target_branch_org: | ||
stage: build | ||
tags: | ||
- ubuntu | ||
only: | ||
refs: | ||
- merge_requests | ||
- web | ||
variables: | ||
CONFIG_BRANCH: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME | ||
ORG_ALIAS: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME | ||
script: | ||
- '[ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ] && exit 0;' # Skip this job if it is launched from web UI and we are not in merge request context | ||
- sfdx hardis:auth:login | ||
- sfdx hardis:project:deploy:sources:dx --check | ||
|
||
# Création d'une scratch org, pour: | ||
# - vérifier que les métadatas se déploient bien | ||
# - exécuter les classes de test Apex | ||
# - executer les tests automatisés | ||
create_scratch_org: | ||
stage: build | ||
tags: | ||
- ubuntu | ||
only: | ||
- merge_requests | ||
- web | ||
script: | ||
- sfdx hardis:auth:login --devhub | ||
- sfdx hardis:scratch:create | ||
artifacts: | ||
when: always | ||
expire_in: 60 minutes | ||
paths: | ||
- .cache/sfdx-hardis/.sfdx | ||
- .sfdx | ||
- config/user | ||
|
||
# Execution des classes de test Apex dans la scratch org créée par le job | ||
test_apex: | ||
stage: test | ||
tags: | ||
- ubuntu | ||
only: | ||
- merge_requests | ||
- web | ||
needs: | ||
- job: create_scratch_org | ||
artifacts: true | ||
script: | ||
- sfdx hardis:auth:login --scratchorg || true | ||
- sfdx hardis:org:test:apex | ||
artifacts: | ||
when: always | ||
paths: | ||
- hardis-report | ||
expire_in: 1 week | ||
|
||
# Execution des tests automatisés | ||
#test_automation: | ||
# stage: test | ||
# tags: | ||
# - ubuntu | ||
# only: | ||
# - merge_requests | ||
# - web | ||
# needs: | ||
# - job: create_scratch_org | ||
# artifacts: true | ||
# script: | ||
# - sfdx hardis:auth:login --scratchorg | ||
# - echo "Automated tests not implemented yet" | ||
|
||
# Suppression de la scratch org de test temporaire | ||
clean: | ||
stage: clean | ||
tags: | ||
- ubuntu | ||
when: on_success | ||
only: | ||
- merge_requests | ||
- web | ||
needs: | ||
- job: create_scratch_org | ||
- job: test_apex | ||
script: | ||
- sfdx hardis:auth:login --devhub | ||
- sfdx hardis:auth:login --scratchorg || true | ||
- sfdx force:org:delete --noprompt || true | ||
|
||
# Simulation de déploiement vers l'org Salesforce cible | ||
# Se déclenche en cas de planification ou lancement manuel | ||
check_deploy_to_current_branch_org: | ||
stage: deploy | ||
tags: | ||
- ubuntu | ||
only: | ||
- pushes | ||
- schedules | ||
- web | ||
except: | ||
variables: | ||
- $CI_COMMIT_REF_NAME !~ $DEPLOY_BRANCHES | ||
script: | ||
- sfdx hardis:auth:login | ||
- sfdx hardis:project:deploy:sources:dx --check | ||
|
||
# Déploiement vers l'org Salesforce cible | ||
# Se déclenche en cas de push vers une des branches décrites dans la regex DEPLOY_BRANCHES de .gitlab-ci-config.yml | ||
deploy_to_org: | ||
stage: deploy | ||
tags: | ||
- ubuntu | ||
only: | ||
- pushes | ||
- web | ||
except: | ||
variables: | ||
- $CI_COMMIT_REF_NAME !~ $DEPLOY_BRANCHES | ||
script: | ||
- sfdx hardis:auth:login | ||
- sfdx hardis:project:deploy:sources:dx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters