Skip to content
Snippets Groups Projects
Commit 7c97d871 authored by sandcha's avatar sandcha
Browse files

Merge branch 'pull-src-server' into 'main'

Met à jour les sources du dépôt au déploiement en intégration

See merge request !9
parents 016d8331 a186f133
Branches
Tags 0.4.1
1 merge request!9Met à jour les sources du dépôt au déploiement en intégration
Pipeline #19482 passed
......@@ -53,6 +53,9 @@ release-and-tag:
# artifacts from all previous stages are passed by default
deploy-integ:
variables:
GIT_AUTHOR_NAME: "leximpact-bot"
GIT_EMAIL: "62298368+leximpact-bot@users.noreply.github.com"
# SSH_PRIVATE_KEY and INTEGRATION_IP defined in:
# https://git.leximpact.dev/groups/leximpact/simulateur-dotations-communes/-/settings/ci_cd
# INTEGRATION_HOST_DOMAIN_NAME defined in:
......@@ -63,16 +66,19 @@ deploy-integ:
- apt update
- apt-get install -y git curl
- eval $(ssh-agent -s)
# add the ssh key of the GitLab runner
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# check that we are in a container (inside Proxmox LXC container) before bypassing StrictHostKeyChecking
- '[[ -f /.dockerenv ]] && mkdir -p ~/.ssh && echo -e "Host *\n\tStrictHostKeyChecking no\n\tLogLevel quiet\n" > ~/.ssh/config'
script:
# remove previous build on integration server
- ssh -J gitlabci@$INTEGRATION_HOST_DOMAIN_NAME leximpact@$INTEGRATION_IP "cd $CI_PROJECT_NAME && rm -Rf build/* && exit"
# configure GIT user
- ssh -J gitlabci@$INTEGRATION_HOST_DOMAIN_NAME leximpact@$INTEGRATION_IP "cd $CI_PROJECT_NAME && git config user.email $GIT_EMAIL && git config user.name $GIT_AUTHOR_NAME"
# update the project's source code
- ssh -J gitlabci@$INTEGRATION_HOST_DOMAIN_NAME leximpact@$INTEGRATION_IP "cd $CI_PROJECT_NAME && git fetch && git checkout -B $CI_COMMIT_REF_NAME $CI_COMMIT_SHA && git pull origin $CI_COMMIT_REF_NAME && exit"
# get deploy.sh on container (on SSH port 22)
- ssh -J gitlabci@$INTEGRATION_HOST_DOMAIN_NAME leximpact@$INTEGRATION_IP "mkdir -p $CI_PROJECT_NAME/.gitlab/ci/ && exit"
- scp -o "ProxyCommand ssh gitlabci@$INTEGRATION_HOST_DOMAIN_NAME nc -w 1 %h 22" .gitlab/ci/deploy.sh leximpact@$INTEGRATION_IP:$CI_PROJECT_NAME/.gitlab/ci/deploy.sh
# use a ssh relay to connect to the host containing the runner and run deploy.sh
# use a ssh relay to connect to the host containing the runner and run .gitlab/ci/deploy.sh
- ssh -J gitlabci@$INTEGRATION_HOST_DOMAIN_NAME leximpact@$INTEGRATION_IP "cd $CI_PROJECT_NAME && bash .gitlab/ci/deploy.sh && exit"
environment:
# defined in: https://git.leximpact.dev/leximpact/simulateur-dotations-communes/leximpact-dotations-ui/-/environments
......
......@@ -5,14 +5,14 @@
# stop at first error
set -e
echo "Stop all services..."
systemctl --user stop dotations-ui-integ.service
# Later: remove dependencies before reinstall?
# INFO:
# no need to stop the service or delete the previous build before (re)build
# (in case of memory shortage move the building step to the CI)
echo "Update the application's dependencies and build..."
npm install
npm run build
echo "Restart service..."
systemctl --user start dotations-ui-integ.service
echo "Restart the service after build update..."
systemctl --user restart dotations-ui-integ.service
echo "Deployment done! 🎉"
# CHANGELOG
### 0.4.1 [!9](https://git.leximpact.dev/leximpact/simulateur-dotations-communes/leximpact-dotations-ui/-/merge_requests/9)
- Amélioration technique.
- Détails :
- Ajoute la mise à jour du code source lors d'un déploiement en intégration
- Complète le job de CI `deploy-integ`
- Définit la mise à jour du service en intégration dans `.gitlab/ci/deploy.sh`
## 0.4.0 [!8](https://git.leximpact.dev/leximpact/simulateur-dotations-communes/leximpact-dotations-ui/-/merge_requests/8)
- Ajout d'une fonctionnalité. Correction d'un crash.
......
{
"name": "leximpact-dotations-ui",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"scripts": {
"build": "vite build",
......@@ -8,6 +8,7 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"coverage": "vitest run --coverage",
"clean": "rm -Rf .svelte-kit/;rm -Rf node_modules/;rm -Rf build/",
"clean:build": "rm -Rf build/",
"dev": "vite dev",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment