Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MVP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SO
OC
MVP
Commits
6a799108
Commit
6a799108
authored
9 months ago
by
mathieu.dartigues
Browse files
Options
Downloads
Plain Diff
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
!16
fix: teardown pour la CI
Pipeline
#10175
passed
9 months ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+41
-30
41 additions, 30 deletions
.gitlab-ci.yml
with
41 additions
and
30 deletions
.gitlab-ci.yml
+
41
−
30
View file @
6a799108
...
@@ -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}"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment