ci: generate secert_key for CI runs

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-16 23:45:28 +02:00
parent 23123c43ee
commit b66626f9c4
4 changed files with 21 additions and 9 deletions

View File

@ -55,10 +55,6 @@ MEDIA_ROOT = BASE_DIR + "/media"
DEBUG = CONFIG.y_bool("debug") DEBUG = CONFIG.y_bool("debug")
SECRET_KEY = CONFIG.y("secret_key") SECRET_KEY = CONFIG.y("secret_key")
if DEBUG:
SECRET_KEY = (
"9$@r!d^1^jrn#fk#1#@ks#9&i$^s#1)_13%$rwjrhd=e8jfi_s" # noqa Debug # nosec
)
INTERNAL_IPS = ["127.0.0.1"] INTERNAL_IPS = ["127.0.0.1"]
ALLOWED_HOSTS = ["*"] ALLOWED_HOSTS = ["*"]

View File

@ -43,7 +43,9 @@ stages:
pipenv install --dev pipenv install --dev
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: pipenv run pylint authentik tests lifecycle script: |
python -m scripts.generate_ci_config
pipenv run pylint authentik tests lifecycle
- job: black - job: black
pool: pool:
vmImage: 'ubuntu-latest' vmImage: 'ubuntu-latest'
@ -140,7 +142,9 @@ stages:
pipenv install --dev pipenv install --dev
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: pipenv run ./manage.py migrate script: |
python -m scripts.generate_ci_config
pipenv run ./manage.py migrate
- job: migrations_from_previous_release - job: migrations_from_previous_release
pool: pool:
vmImage: 'ubuntu-latest' vmImage: 'ubuntu-latest'
@ -171,8 +175,9 @@ stages:
- task: CmdLine@2 - task: CmdLine@2
displayName: Migrate to last tagged release displayName: Migrate to last tagged release
inputs: inputs:
script: script: |
pipenv run ./manage.py migrate python -m scripts.generate_ci_config
pipenv run python -m lifecycle.migrate
- task: CmdLine@2 - task: CmdLine@2
displayName: Install current branch displayName: Install current branch
inputs: inputs:
@ -185,7 +190,6 @@ stages:
inputs: inputs:
script: | script: |
pipenv run python -m lifecycle.migrate pipenv run python -m lifecycle.migrate
pipenv run ./manage.py migrate
- job: coverage_unittest - job: coverage_unittest
pool: pool:
vmImage: 'ubuntu-latest' vmImage: 'ubuntu-latest'
@ -210,6 +214,7 @@ stages:
displayName: Run full test suite displayName: Run full test suite
inputs: inputs:
script: | script: |
python -m scripts.generate_ci_config
pipenv run make test pipenv run make test
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
@ -253,6 +258,7 @@ stages:
displayName: Run full test suite displayName: Run full test suite
inputs: inputs:
script: | script: |
python -m scripts.generate_ci_config
pipenv run make test-integration pipenv run make test-integration
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
@ -308,6 +314,7 @@ stages:
displayName: Run full test suite displayName: Run full test suite
inputs: inputs:
script: | script: |
python -m scripts.generate_ci_config
pipenv run make test-e2e pipenv run make test-e2e
- task: CmdLine@2 - task: CmdLine@2
condition: always() condition: always()

View File

@ -0,0 +1,8 @@
"""Utility script to generate a config for CI runs"""
from authentik.providers.oauth2.generators import generate_client_id
from yaml import safe_dump
with open("local.env.yml", "w") as _config:
safe_dump({
"secret_key": generate_client_id()
}, _config, default_flow_style=False)

View File

@ -22,6 +22,7 @@ postgresql:
user: postgres user: postgres
log_level: debug log_level: debug
secret_key: "A long key you can generate with `pwgen 40 1` for example"
``` ```
Afterwards, you can start authentik by running `./manage.py runserver`. Generally speaking, authentik is a Django application. Afterwards, you can start authentik by running `./manage.py runserver`. Generally speaking, authentik is a Django application.