From 234a4dcec747a871384b5476f76d00abd48b12e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 20 Feb 2023 19:15:04 +0100 Subject: [PATCH] ci: use $BUILD_TAG to create database name (#.....) --- tests/settings.py | 2 +- tox.ini | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/settings.py b/tests/settings.py index e61ce92..b3a765a 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -4,7 +4,7 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'TEST': { - 'NAME': 'bidon-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:63], + 'NAME': ('bidon-test-%s' % os.environ.get("BUILD_TAG", "").replace('%2', '-').removeprefix('jenkins-'))[:63], }, } } diff --git a/tox.ini b/tox.ini index e4fa390..c50c84b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/bidon/{env:BRANCH_NAME:} +toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/bidon/{env:BUILD_TAG:} envlist = py3-django22-coverage-junit [testenv] @@ -7,6 +7,7 @@ usedevelop = True setenv = DJANGO_SETTINGS_MODULE=bidon.settings BIDON_SETTINGS_FILE=tests/settings.py + BUILD_TAG={env:BUILD_TAG:} BRANCH_NAME={env:BRANCH_NAME:} coverage: COVERAGE=--cov-report xml --cov-report html --cov=bidon/ junit: JUNIT=--junitxml=junit-{envname}.xml