From ca4ef76845e7e56dc753a3590d1a15b651021043 Mon Sep 17 00:00:00 2001 From: Thomas Carmet Date: Mon, 8 Aug 2022 09:56:34 -0700 Subject: [PATCH 1/3] RELENG-6306 misconfiguration webhook --- CHANGELOG | 4 ++++ bert_e/server/__init__.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 482ca1f2..cd0e829f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +## [3.6.21] - 2022-08-08 +# Fixed +- Fixed configuration for Webhook authentication. + ## [3.6.21] - 2022-08-05 # Added - Making reverse proxy configuration through env. diff --git a/bert_e/server/__init__.py b/bert_e/server/__init__.py index 5d8e028d..ec30ec6b 100644 --- a/bert_e/server/__init__.py +++ b/bert_e/server/__init__.py @@ -70,12 +70,12 @@ def setup_server(bert_e): """Create and configure Flask server app.""" app = Flask(__name__) - app_prefix = os.getenv('APP_PREFIX', '/') + app_prefix = os.getenv('APP_PREFIX', None) app_scheme = os.getenv('APP_SCHEME', None) app_server = os.getenv('APP_SERVER', None) app.config.update({ 'WEBHOOK_LOGIN': os.environ['WEBHOOK_LOGIN'], - 'WEBHOOK_PWD': os.environ['WEBHOOK_LOGIN'], + 'WEBHOOK_PWD': os.environ['WEBHOOK_PWD'], 'CLIENT_ID': os.environ['BERT_E_CLIENT_ID'], 'CLIENT_SECRET': os.environ['BERT_E_CLIENT_SECRET'], 'WTF_CSRF_SECRET_KEY': secrets.token_hex(24), From 490d2318ba421dbcef22b23b674a173bdb88cb49 Mon Sep 17 00:00:00 2001 From: Thomas Carmet Date: Mon, 8 Aug 2022 11:40:06 -0700 Subject: [PATCH 2/3] Reduce the size of the docker image build context --- .dockerignore | 5 +++++ Dockerfile | 6 +++++- requirements.txt | 1 + setup.py | 10 ++++------ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index bd23d627..cf6c0159 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,8 @@ venv *.pyc *~ +.git +*.egg-info +__pycache__ +.eggs +.tox diff --git a/Dockerfile b/Dockerfile index 1dce9fc0..0597dfcb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ FROM python:3.6.6-slim-stretch +ARG VERSION 1.0-dev + +ENV VERSION=${VERSION} + RUN apt-get update && apt-get install git -y && rm -rf /var/cache/apt COPY constraints.txt requirements.txt /app/ @@ -13,6 +17,6 @@ VOLUME '/root/.bert-e' WORKDIR /app/ COPY . /app/ -RUN pip install --no-deps /app +RUN pip install --no-deps . ENTRYPOINT ["bert-e-serve"] diff --git a/requirements.txt b/requirements.txt index 44125740..a46a5810 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,6 +18,7 @@ PyYAML==3.13 raven==6.9.0 requests==2.19.1 requests-mock==1.5.2 +wheel==0.32.1 werkzeug==0.16.1 WTForms==2.2.1 setuptools-scm==1.9.0 diff --git a/setup.py b/setup.py index 49ae6d14..522f1e7b 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os from os.path import abspath, dirname, join import pip @@ -36,12 +37,9 @@ def requires(): setup( name='bert-e', - use_scm_version={ - 'local_scheme': 'dirty-tag' - }, - setup_requires=[ - 'setuptools_scm' - ], + version=os.getenv('VERSION', '1.0-dev'), + python_requires=">=3.6", + platforms=['any'], description='Scality\'s automated branch merging tool', url='https://bitbucket.org/scality/bert-e', license='Apache', From 637eab32bf6fb08f2a13bd53fbda13e66213565f Mon Sep 17 00:00:00 2001 From: Thomas Carmet Date: Mon, 8 Aug 2022 11:41:51 -0700 Subject: [PATCH 3/3] Specify tag in image build --- .github/workflows/release.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 041533b5..df8bd14e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,6 +1,6 @@ name: release -on: +on: workflow_dispatch: inputs: tag: @@ -33,6 +33,8 @@ jobs: file: ./Dockerfile push: true tags: "registry.scality.com/bert-e/bert-e:${{ github.event.inputs.tag }}" + build-args: | + VERSION=${{ github.event.inputs.tag }} - name: Create Release uses: softprops/action-gh-release@v1