From 09a972fd4df89e216c77a5ddfa28d43ffd9df99e Mon Sep 17 00:00:00 2001 From: Chif Gergő <chif.gergo@cloud.bme.hu> Date: Mon, 6 Jul 2020 12:28:30 +0200 Subject: [PATCH] Can pass env variables in GitLab settings to an env file --- .gitlab-ci.yml | 5 +++-- setup_ci_env.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 setup_ci_env.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c68ea6..693ea7f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,14 @@ image: python:3.6 before_script: - - mv .env.example .env + - chmod +x ./setup_ci_env.sh + - ./setup_ci_env.sh - git submodule sync --recursive - git submodule update --init --recursive flake8: script: - - pip install flake8 + - pip3 install flake8 - flake8 build-local: diff --git a/setup_ci_env.sh b/setup_ci_env.sh new file mode 100644 index 0000000..395291b --- /dev/null +++ b/setup_ci_env.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# This variables are interpreted automatically by the Docker Engine +# And by the Django runtime +# Django configuration +echo DJANGO_SECRET=${DJANGO_SECRET} >> .env +echo DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} >> .env +# If using other database than sqlite3 (only use sqlite for development!) +# Provide the db credentials here +echo DATABASE_PASSWORD=${DATABASE_PASSWORD} >> .env +echo DATABASE_USER=${DATABASE_USER} >> .env +echo DATABASE_NAME=${DATABASE_NAME} >> .env +echo DATABASE_HOST=${DATABASE_HOST} >> .env +# For channels communication and periodic tasks we need a redis server +echo REDIS_HOST=${REDIS_HOST} >> .env +# OpenStack credentials +# In development we recommend using a DevStack installation +# These settings displayed in an admin dashboard or +# Can be downloaded from Horizon, as an admin user +echo OS_AUTH_URL=${OS_AUTH_URL} >> .env +echo OS_PROJECT_ID=${OS_PROJECT_ID} >> .env +echo OS_PROJECT_NAME=${OS_PROJECT_NAME} >> .env +echo OS_USER_DOMAIN_NAME=${OS_USER_DOMAIN_NAME} >> .env +echo OS_USER_DOMAIN_ID=${OS_USER_DOMAIN_ID} >> .env +echo OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID} >> .env +echo OS_USERNAME=${OS_USERNAME} >> .env +echo OS_PASSWORD=${OS_PASSWORD} >> .env +echo OS_REGION_NAME=${OS_REGION_NAME} >> .env +echo OS_INTERFACE=${OS_INTERFACE} >> .env +echo OS_IDENTITY_API_VERSION=${OS_IDENTITY_API_VERSION} >> .env \ No newline at end of file -- libgit2 0.26.0