Skip to content
Snippets Groups Projects
Commit ccfad965 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Update .gitlab-ci.yml for k8s

parent 4cff543e
No related branches found
No related tags found
No related merge requests found
......@@ -5,28 +5,21 @@ variables:
JOB: convert
PROVIDER_SLUG: entsoe
before_script:
# Display info about environment.
- date
- locale
- echo "Running job ${JOB} for provider ${PROVIDER_SLUG}"
# Install fetcher dependencies.
- '[ -f requirements.txt ] && pip3 install --requirement requirements.txt'
# 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.
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# Add the SSH keys of remote Git servers, to disable host key checking questions.
- mkdir -p ~/.ssh
- ssh-keyscan -t rsa git.nomics.world >> ~/.ssh/known_hosts
- git config --global push.default simple
- git config --global user.email "${PROVIDER_SLUG}-fetcher@db.nomics.world"
- git config --global user.name "${PROVIDER_SLUG} fetcher"
Build Docker image:
stage: build
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "master"
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- >
if [ -f $CI_PROJECT_DIR/Dockerfile ]; then
mkdir -p /kaniko/.docker
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
fi
job:
stage: build
......@@ -34,6 +27,29 @@ job:
- pushes
tags:
- docker
before_script:
# Display info about environment.
- date
- locale
- echo "Running job ${JOB} for provider ${PROVIDER_SLUG}"
# Install fetcher dependencies.
- '[ -f requirements.txt ] && pip3 install --requirement requirements.txt'
# 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.
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# Add the SSH keys of remote Git servers, to disable host key checking questions.
- mkdir -p ~/.ssh
- ssh-keyscan -t rsa git.nomics.world >> ~/.ssh/known_hosts
- git config --global push.default simple
- git config --global user.email "${PROVIDER_SLUG}-fetcher@db.nomics.world"
- git config --global user.name "${PROVIDER_SLUG} fetcher"
script:
- set -x
- |
......@@ -45,7 +61,7 @@ job:
time python3 download.py ${PROVIDER_SLUG}-source-data
cd ${PROVIDER_SLUG}-source-data
time git add -A
time git commit -m "New download" --quiet || true
time git commit -m "New download" --quiet --ignore-removal . || true
time git push
# Move errors.json file, if present; to be kept as artifact
[ -f errors.json ] && mv errors.json .. || true
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment