Skip to content
Snippets Groups Projects
Commit 6a799108 authored by mathieu.dartigues's avatar mathieu.dartigues
Browse files

Merge branch '16-fix-teardown' into 'main'

fix: teardown pour la CI

See merge request !16
parents b1ab3120 02d801b0
No related branches found
No related tags found
1 merge request!16fix: teardown pour la CI
Pipeline #10175 passed
...@@ -16,33 +16,7 @@ stages: ...@@ -16,33 +16,7 @@ stages:
- deploy - deploy
- teardown - teardown
quality-gate: .check_ssh: &check_ssh
image: mcr.microsoft.com/playwright:v1.47.1-noble
stage: test
script:
- npm ci
- npm run lint
- npm run test:unit
build:
stage: build
variables:
BASE_URL: "/mvp-${CI_COMMIT_REF_SLUG}/"
VITE_OC_BASE_URL: "https://opencommon.irit.fr"
script:
- npm ci
- npx vite build --base=${BASE_URL}
artifacts:
expire_in: 3 week
paths:
- ./dist/
deploy:
stage: deploy
dependencies:
- build
variables:
DELIVERY_DIRECTORY: "/mvp-${CI_COMMIT_REF_SLUG}"
before_script: # https://docs.gitlab.com/ee/ci/ssh_keys/ before_script: # https://docs.gitlab.com/ee/ci/ssh_keys/
## ##
## Install ssh-agent if not already installed, it is required by Docker. ## Install ssh-agent if not already installed, it is required by Docker.
...@@ -71,6 +45,44 @@ deploy: ...@@ -71,6 +45,44 @@ deploy:
- echo "$SSH_PRIVATE_KEY_DEPLOY_FRONT_ED25519" | tr -d '\r' | ssh-add - - echo "$SSH_PRIVATE_KEY_DEPLOY_FRONT_ED25519" | tr -d '\r' | ssh-add -
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
quality-gate:
image: mcr.microsoft.com/playwright:v1.47.1-noble
stage: test
only:
- merge_requests
script:
- npm ci
- npm run lint
- npm run test:unit
build:
stage: build
variables:
BASE_URL: "/mvp-${CI_COMMIT_REF_SLUG}/"
VITE_OC_BASE_URL: "https://opencommon.irit.fr"
only:
- tags
- merge_requests
- main
script:
- npm ci
- npx vite build --base=${BASE_URL}
artifacts:
expire_in: 3 week
paths:
- ./dist/
deploy:
<<: *check_ssh
stage: deploy
variables:
DELIVERY_DIRECTORY: "/mvp-${CI_COMMIT_REF_SLUG}"
only:
- tags
- merge_requests
- main
dependencies:
- build
script: script:
- apt update - apt update
- apt install rsync -y - apt install rsync -y
...@@ -82,7 +94,6 @@ deploy: ...@@ -82,7 +94,6 @@ deploy:
# Copie de la dernière version commiter sur le main sur le chemin /last aussi # Copie de la dernière version commiter sur le main sur le chemin /last aussi
# - if [ "$CI_COMMIT_BRANCH" == "main" ]; then rsync -rav --delete ./dist gitlab@so-frontend-dev.irit.fr:/var/www/html/mvp-last; fi # - if [ "$CI_COMMIT_BRANCH" == "main" ]; then rsync -rav --delete ./dist gitlab@so-frontend-dev.irit.fr:/var/www/html/mvp-last; fi
environment: environment:
name: review/mvp-${CI_COMMIT_REF_SLUG} name: review/mvp-${CI_COMMIT_REF_SLUG}
url: https://opencommon.irit.fr/mvp-${CI_COMMIT_REF_SLUG} url: https://opencommon.irit.fr/mvp-${CI_COMMIT_REF_SLUG}
...@@ -90,17 +101,17 @@ deploy: ...@@ -90,17 +101,17 @@ deploy:
on_stop: teardown on_stop: teardown
teardown: teardown:
<<: *check_ssh
stage: teardown stage: teardown
only: only:
- merge_requests - merge_requests
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
DELIVERY_DIRECTORY: "/mvp-${CI_COMMIT_REF_SLUG}"
when: manual when: manual
environment: environment:
name: review/mvp-${CI_COMMIT_REF_SLUG} name: review/mvp-${CI_COMMIT_REF_SLUG}
action: stop action: stop
variables:
DELIVERY_DIRECTORY: "/mvp-${CI_COMMIT_REF_SLUG}"
script: script:
- echo "Fin de la MR => on supprime le répertoire déployé $DELIVERY_DIRECTORY" - echo "Fin de la MR => on supprime le répertoire déployé $DELIVERY_DIRECTORY"
- ssh gitlab@so-frontend-dev.irit.fr "rm -rf /var/www/html${DELIVERY_DIRECTORY}" - ssh gitlab@so-frontend-dev.irit.fr "rm -rf /var/www/html${DELIVERY_DIRECTORY}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment