Commit 44f5f926 authored by Peter Heiss's avatar Peter Heiss 🖖

remove curl from container, remove changes for tests in cicd

parent 0d1fa2a5
Pipeline #58904 failed with stages
in 3 minutes and 53 seconds
......@@ -41,7 +41,6 @@ variables:
stage: build
services:
- docker:dind
......
......@@ -8,13 +8,6 @@
- .tests
- .port_owncloud
only:
changes:
- RDS/circle1_adapters_and_ports/port_owncloud/*
- RDS/circle1_adapters_and_ports/port_owncloud/**/*
- RDS/circle2_use_cases/interface_port_file_storage.yml
- RDS/circle3_central_services/interface_port_token_storage.yml
test:port_owncloud3.6:
extends: .tests_port_owncloud
image: python:3.6
......
......@@ -8,20 +8,6 @@ WORKDIR /app
ADD ./requirements.txt ./
RUN pip install -r requirements.txt
# download yaml file for better usability and reproducable behaviour
RUN apk add curl
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle2_use_cases/interface_port_file_storage.yml"
ENV OPENAPI_FILEPATH "c2_owncloud.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle3_central_services/interface_port_token_storage.yml"
ENV OPENAPI_FILEPATH "c3_owncloud.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
# comma separated
ENV OPENAPI_MULTIPLE_FILES "c2_owncloud.yml;c3_owncloud.yml"
# this has to be set separatley and safely
ENV CENTRAL_SERVICE_TOKEN_STORAGE "http://circle3-token-storage"
ENV OWNCLOUD_INSTALLATION_URL "http://owncloud"
......@@ -30,6 +16,11 @@ ENV OWNCLOUD_OAUTH_ACCESS_TOKEN_URL "https://owncloud/index.php/apps/oauth2/api/
ENV OWNCLOUD_OAUTH_CLIEND_ID "XY"
ENV OWNCLOUD_OAUTH_CLIENT_SECRET "ABC"
# comma separated
ENV OPENAPI_MULTIPLE_FILES "interface_port_file_storage.yml;interface_port_token_storage.yml"
ADD "../../circle2_use_cases/interface_port_file_storage.yml" ./
ADD "../../circle3_central_services/interface_port_token_storage.yml" ./
# now add everything else, which changes often
ADD src ./
......
......@@ -8,13 +8,6 @@
- .tests
- .port_zenodo
only:
changes:
- RDS/circle1_adapters_and_ports/port_zenodo/*
- RDS/circle1_adapters_and_ports/port_zenodo/**/*
- RDS/circle2_use_cases/interface_port_metadata.yml
- RDS/circle3_central_services/interface_port_token_storage.yml
test:port_zenodo3.6:
extends: .tests_port_zenodo
image: python:3.6
......
......@@ -8,20 +8,6 @@ WORKDIR /app
ADD ./requirements.txt ./
RUN pip install -r requirements.txt
# download yaml file for better usability and reproducable behaviour
RUN apk add curl
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle2_use_cases/interface_port_metadata.yml"
ENV OPENAPI_FILEPATH "c2_invenio.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle3_central_services/interface_port_token_storage.yml"
ENV OPENAPI_FILEPATH "c3_invenio.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
# comma separated
ENV OPENAPI_MULTIPLE_FILES "c2_invenio.yml;c3_invenio.yml"
# this has to be set separatley and safely
ENV CENTRAL-SERVICE_TOKEN-STORAGE "http://circle3-token-storage"
ENV ZENODO_OAUTH_AUTHORIZE_URL "https://sandbox.zenodo.org/oauth/authorize"
......@@ -29,6 +15,10 @@ ENV ZENODO_OAUTH_ACCESS_TOKEN_URL "https://sandbox.zenodo.org/oauth/token"
ENV ZENODO_OAUTH_CLIEND_ID "XY"
ENV ZENODO_OAUTH_CLIENT_SECRET "ABC"
ENV OPENAPI_MULTIPLE_FILES "interface_port_metadata.yml;interface_port_token_storage.yml"
ADD "../../circle2_use_cases/interface_port_metadata.yml" ./
ADD "../../circle3_central_services/interface_port_token_storage.yml" ./
# now add everything else, which changes often
ADD src ./
......
......@@ -47,7 +47,7 @@ def register_service(servicename: str, authorize_url: str, refresh_url: str, cli
"refresh_url": refresh_url,
"client_id": client_id,
"client_secret": client_secret,
"implements": ["fileStorage", "metadata"]
"implements": ["metadata"]
}
headers = {"Content-Type": "application/json"}
......
......@@ -7,11 +7,6 @@
- .tests
- .use_case_exporter
only:
changes:
- RDS/circle2_use_cases/exporter/*
- RDS/circle2_use_cases/exporter/**/*
test:use_case_exporter3.6:
image: python:3.6
extends: .tests_use_case_exporter
......
......@@ -8,12 +8,7 @@ WORKDIR /app
ADD ./requirements.txt ./
RUN pip install -r requirements.txt
# download yaml file for better usability and reproducable behaviour
RUN apk add curl
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle2_use_cases/exporter/use-case_exporter.yml"
ENV OPENAPI_FILEPATH "exporter.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
ADD "../../circle2_use_cases/exporter/use-case_exporter.yml" ./
# now add everything else, which changes often
ADD src ./
......
......@@ -3,6 +3,11 @@
JSONEncoder.default() automatically checks for a special "to_json()"
method and uses it to encode the object if found.
"""
from jaeger_client.metrics.prometheus import PrometheusMetricsFactory
from jaeger_client import Config as jConfig
import os
import logging
from connexion_plus import App, MultipleResourceResolver, Util
from json import JSONEncoder, JSONDecoder
......@@ -13,12 +18,6 @@ def to_default(self, obj):
to_default.default = JSONEncoder.default # Save unmodified default.
JSONEncoder.default = to_default # Replace it.
from connexion_plus import App, MultipleResourceResolver, Util
import logging
import os
from jaeger_client import Config as jConfig
from jaeger_client.metrics.prometheus import PrometheusMetricsFactory
log_level = logging.DEBUG
logger = logging.getLogger('')
......@@ -41,8 +40,7 @@ def monkeypatch():
def bootstrap(name='MicroService', *args, **kwargs):
list_openapi = Util.load_oai(
os.getenv("OPENAPI_FILEPATH", "use-case_exporter.yml"))
list_openapi = Util.load_oai("use-case_exporter.yml")
app = App(name, *args, **kwargs)
......
......@@ -7,11 +7,6 @@
- .tests
- .use_case_metadata
only:
changes:
- RDS/circle2_use_cases/metadata/*
- RDS/circle2_use_cases/metadata/**/*
test:use_case_metadata3.6:
image: python:3.6
extends: .tests_use_case_metadata
......
......@@ -9,12 +9,7 @@ ADD ./requirements.txt ./
ADD ./datacite_4.3_schema.json ./
RUN pip install -r requirements.txt
# download yaml file for better usability and reproducable behaviour
RUN apk add curl
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle2_use_cases/metadata/use-case_metadata.yml"
ENV OPENAPI_FILEPATH "metadata.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
ADD "../../circle2_use_cases/metadata/use-case_metadata.yml" ./
# now add everything else, which changes often
ADD src ./
......
from jaeger_client.metrics.prometheus import PrometheusMetricsFactory
from jaeger_client import Config as jConfig
import os
import logging
from connexion_plus import App, MultipleResourceResolver, Util
from json import JSONEncoder, JSONDecoder
from gevent import monkey
monkey.patch_all()
from json import JSONEncoder, JSONDecoder
from connexion_plus import App, MultipleResourceResolver, Util
import logging
import os
from jaeger_client import Config as jConfig
from jaeger_client.metrics.prometheus import PrometheusMetricsFactory
log_level = logging.DEBUG
logger = logging.getLogger('')
......@@ -31,8 +31,7 @@ def monkeypatch():
def bootstrap(name='MicroService', *args, **kwargs):
list_openapi = Util.load_oai(
os.getenv("OPENAPI_FILEPATH", "use-case_metadata.yml"))
list_openapi = Util.load_oai("use-case_metadata.yml")
app = App(name, *args, **kwargs)
......
......@@ -7,11 +7,6 @@
- .tests
- .use_case_token_service
only:
changes:
- RDS/circle2_use_cases/token_service/*
- RDS/circle2_use_cases/token_service/**/*
test:use_case_token_service3.6:
image: python:3.6
extends: .tests_use_case_token_service
......
......@@ -8,15 +8,10 @@ WORKDIR /app
ADD ./requirements.txt ./
RUN pip install -r requirements.txt
# download yaml file for better usability and reproducable behaviour
RUN apk add curl
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle2_use_cases/token_service/use-case_token-storage.yml"
ENV OPENAPI_FILEPATH "token_service.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
ENV CENTRAL-SERVICE_TOKEN-STORAGE "http://circle3-token-storage"
ADD "../../circle2_use_cases/token_service/use-case_token-storage.yml" ./
# now add everything else, which changes often
ADD src ./
......
......@@ -22,8 +22,7 @@ def bootstrap(name='MicroService', *args, **kwargs):
from lib.TokenService import TokenService
list_openapi = Util.load_oai(
os.getenv("OPENAPI_FILEPATH", "use-case_token-storage.yml"))
list_openapi = Util.load_oai("use-case_token-storage.yml")
if "testing" in kwargs:
ServerUtil.tokenService = TokenService(kwargs["testing"])
......@@ -39,4 +38,5 @@ def bootstrap(name='MicroService', *args, **kwargs):
return app
monkeypatch()
\ No newline at end of file
monkeypatch()
......@@ -7,11 +7,6 @@
- .tests
- .central_service_research_manager
only:
changes:
- RDS/circle3_central_services/research_manager/*
- RDS/circle3_central_services/research_manager/**/*
test:central_service_research_manager3.6:
image: python:3.6
extends: .tests_central_service_research_manager
......
......@@ -8,12 +8,7 @@ WORKDIR /app
ADD ./requirements.txt ./
RUN pip install -r requirements.txt
# download yaml file for better usability and reproducable behaviour
RUN apk add curl
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle3_central_services/research_manager/central-service_research-manager.yml"
ENV OPENAPI_FILEPATH "research_manager.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
ADD "../../circle3_central_services/research_manager/central-service_research-manager.yml" ./
# now add everything else, which changes often
ADD src ./
......
......@@ -8,7 +8,6 @@ from jaeger_client import Config as jConfig
import os
import logging
from connexion_plus import App, MultipleResourceResolver, Util
from json import JSONEncoder, JSONDecoder
import Singleton
from lib.ProjectService import ProjectService
......@@ -34,8 +33,7 @@ def monkeypatch():
def bootstrap(name='MicroService', *args, **kwargs):
list_openapi = Util.load_oai(
os.getenv("OPENAPI_FILEPATH", "central-service_research-manager.yml"))
list_openapi = Util.load_oai("central-service_research-manager.yml")
app = App(name, *args, **kwargs)
......
......@@ -7,11 +7,6 @@
- .tests
- .central_service_token_service
only:
changes:
- RDS/circle3_central_services/token_service/*
- RDS/circle3_central_services/token_service/**/*
artifacts:
untracked: true
expire_in: 180 days
......
......@@ -8,12 +8,7 @@ WORKDIR /app
ADD ./requirements.txt ./
RUN pip install -r requirements.txt
# download yaml file for better usability and reproducable behaviour
RUN apk add curl
ENV OPENAPI_FILEPATH_EXTERNAL "https://raw.githubusercontent.com/Sciebo-RDS/Sciebo-RDS/connnectUI/RDS/circle3_central_services/token_service/central-service_token-storage.yml"
ENV OPENAPI_FILEPATH "token_service.yml"
RUN curl -X GET "$OPENAPI_FILEPATH_EXTERNAL" -o "$OPENAPI_FILEPATH"
ADD "../../circle3_central_services/token_service/central-service_token-storage.yml" ./
# now add everything else, which changes often
ADD src ./
......
......@@ -3,13 +3,46 @@
JSONEncoder.default() automatically checks for a special "to_json()"
method and uses it to encode the object if found.
"""
from json import JSONEncoder, JSONDecoder
from lib.Storage import Storage
import Util as ServerUtil
from jaeger_client.metrics.prometheus import PrometheusMetricsFactory
from jaeger_client import Config as jConfig
from connexion_plus import App, MultipleResourceResolver, Util
def to_default(self, obj):
return getattr(obj.__class__, "to_json", to_default.default)(obj)
import logging
log_level = logging.DEBUG
logger = logging.getLogger('')
logging.getLogger('').handlers = []
logging.basicConfig(format='%(asctime)s %(message)s', level=log_level)
to_default.default = JSONEncoder.default # Save unmodified default.
JSONEncoder.default = to_default # Replace it.
def monkeypatch():
""" Module that monkey-patches json module when it's imported so
JSONEncoder.default() automatically checks for a special "to_json()"
method and uses it to encode the object if found.
"""
from json import JSONEncoder, JSONDecoder
def to_default(self, obj):
return getattr(obj.__class__, "to_json", to_default.default)(obj)
to_default.default = JSONEncoder.default # Save unmodified default.
JSONEncoder.default = to_default # Replace it.
monkeypatch()
def bootstrap(name='MicroService', *args, **kwargs):
monkeypatch()
list_openapi = Util.load_oai("central-service_token-storage.yml")
app = App(name, *args, **kwargs)
for oai in list_openapi:
app.add_api(oai, resolver=MultipleResourceResolver(
'api', collection_endpoint_name="index"), validate_responses=True)
# init token storage
ServerUtil.storage = Storage()
return app
from connexion_plus import App, MultipleResourceResolver, Util
#!/usr/bin/env python
import logging
import os
from jaeger_client import Config as jConfig
from jaeger_client.metrics.prometheus import PrometheusMetricsFactory
from __init__ import bootstrap, ServerUtil
import Util as ServerUtil
from lib.Storage import Storage
# set the WSGI application callable to allow using uWSGI:
# uwsgi --http :8080 -w app
app = bootstrap("CentralServiceTokenStorage", all=True)
log_level = logging.DEBUG
logger = logging.getLogger('')
logging.getLogger('').handlers = []
logging.basicConfig(format='%(asctime)s %(message)s', level=log_level)
# add refresh func for refresh_tokens to scheduler and starts (https://stackoverflow.com/a/52068807)
app.scheduler.add_job("refresh_service",
ServerUtil.storage.refresh_services, trigger='interval', minutes=20)
def monkeypatch():
""" Module that monkey-patches json module when it's imported so
JSONEncoder.default() automatically checks for a special "to_json()"
method and uses it to encode the object if found.
"""
from json import JSONEncoder, JSONDecoder
def to_default(self, obj):
return getattr(obj.__class__, "to_json", to_default.default)(obj)
to_default.default = JSONEncoder.default # Save unmodified default.
JSONEncoder.default = to_default # Replace it.
def bootstrap(name='MicroService', *args, **kwargs):
list_openapi = Util.load_oai(
os.getenv("OPENAPI_FILEPATH", "central-service_token-storage.yml"))
app = App(name, *args, **kwargs)
for oai in list_openapi:
app.add_api(oai, resolver=MultipleResourceResolver(
'api', collection_endpoint_name="index"), validate_responses=True)
# init token storage
ServerUtil.storage = Storage()
return app
if __name__ == "__main__":
monkeypatch()
app = bootstrap("CentralServiceTokenStorage", all=True)
# add refresh func for refresh_tokens to scheduler and starts (https://stackoverflow.com/a/52068807)
app.scheduler.add_job("refresh_service",
ServerUtil.storage.refresh_services, trigger='interval', minutes=20)
# set the WSGI application callable to allow using uWSGI:
# uwsgi --http :8080 -w app
app.run(port=8080, server='gevent')
app.run(port=8080, server='gevent')
......@@ -4,7 +4,6 @@ import sys
import os
import json
from pactman import Consumer, Provider
from server import bootstrap
from lib.Storage import Storage
from lib.Token import Token, OAuth2Token
from lib.User import User
......@@ -13,6 +12,7 @@ import Util
def create_app():
from src import bootstrap
# creates a test client
app = bootstrap(use_default_error=True).app
# propagate the exceptions to the test client
......
Markdown is supported
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