Migrate data update CI to tricoteuses-legal-update

This commit is contained in:
Emmanuel 2023-02-24 06:34:47 +01:00
parent ac6d370bbf
commit 8c5da2dee3

View file

@ -23,8 +23,7 @@ variables:
stages: stages:
- build - build
# - test # - test
- download - data_update
- update
build: build:
stage: build stage: build
@ -50,52 +49,8 @@ build:
# - ln -s example.env .env # - ln -s example.env .env
# - npm run test # - npm run test
download: update_data:
stage: download stage: data_update
only:
- schedules
- web
before_script:
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
- "which ssh-agent || ( apt update -y && apt install openssh-client -y )"
## Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
## Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
## Accept the SSH host keys of git.en-root.org.
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
## Set the Git user name and email.
- git config --global user.email "tricoteuses@tricoteuses.fr"
- git config --global user.name "Tricoteuses données Dila"
- npm ci
script:
- rm -f .env
- ln -s example.env .env
- rm -Rf dila-data/
- mkdir dila-data/
- git clone git@git.en-root.org:tricoteuses/data/dila/${DATASET}.git dila-data/${DATASET}
- npx tsx src/scripts/download_dila_dataset.ts ${DATASET} dila-data/ --push
timeout: 6 hours
update_database:
stage: update
only: only:
- schedules - schedules
- web - web