diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-03-24 14:02:20 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-03-24 19:06:20 +0200 |
commit | 78d9c80226c52bcd70e27e7ee2a3a7754f644b53 (patch) | |
tree | 407131ac41543d0950c9576a141de2a6cc693973 | |
parent | d8bf5f405c48980d69a4f2cef8179fb605f0c743 (diff) | |
download | ick2-78d9c80226c52bcd70e27e7ee2a3a7754f644b53.tar.gz |
Change: rename blob service to artifact store
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | artifact_store.py (renamed from blob_service.py) | 17 | ||||
-rw-r--r-- | artifact_store.service (renamed from ick-blob-service.service) | 10 | ||||
-rw-r--r-- | debian/ick2.postinst | 6 | ||||
-rw-r--r-- | ick2/controllerapi.py | 6 | ||||
-rw-r--r-- | ick2/versionapi.py | 8 | ||||
-rw-r--r-- | ick2/versionapi_tests.py | 4 | ||||
-rw-r--r-- | ick_controller.py | 6 | ||||
-rwxr-xr-x | icktool | 6 | ||||
-rwxr-xr-x | run-artifact-store-debug (renamed from run-blob-service-debug) | 4 | ||||
-rw-r--r-- | setup.py | 6 | ||||
-rw-r--r-- | start_artifact_store (renamed from start_blob_service) | 6 | ||||
-rwxr-xr-x | worker_manager | 8 | ||||
-rw-r--r-- | yarns/100-projects.yarn | 2 | ||||
-rw-r--r-- | yarns/150-pipelines.yarn | 2 | ||||
-rw-r--r-- | yarns/200-version.yarn | 4 | ||||
-rw-r--r-- | yarns/300-workers.yarn | 2 | ||||
-rw-r--r-- | yarns/400-build.yarn | 6 | ||||
-rw-r--r-- | yarns/500-build-fail.yarn | 2 | ||||
-rw-r--r-- | yarns/600-unauthz.yarn | 2 | ||||
-rw-r--r-- | yarns/700-artifact-store.yarn (renamed from yarns/700-blob-service.yarn) | 26 | ||||
-rw-r--r-- | yarns/900-implements.yarn | 4 | ||||
-rw-r--r-- | yarns/900-local.yarn | 32 |
23 files changed, 86 insertions, 84 deletions
@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. Version 0.28+git, not yet released ---------------------------------- +* "Blob service" has been renamed to "artifact store". Version 0.28, released 2018-02-24 ---------------------------------- diff --git a/blob_service.py b/artifact_store.py index 44141f6..3a19079 100644 --- a/blob_service.py +++ b/artifact_store.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -# Copyright (C) 2017 Lars Wirzenius +# Copyright (C) 2018 Lars Wirzenius # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -70,15 +70,17 @@ def main(): logger.setLevel(logging.DEBUG) handler = logging.StreamHandler(sys.stderr) logger.addHandler(handler) - logging.info('Starting blob service main program') + logging.info('Starting artifact store main program') try: - config_filename = os.environ.get('BLOB_SERVICE_CONFIG') + name = 'ARTIFACT_STORE_CONFIG' + config_filename = os.environ.get(name) logging.info('config filename %r', config_filename) if not config_filename: - logging.error('no BLOB_SERVICE_CONFIG in environment') - raise Exception('No BLOB_SERVICE_CONFIG defined in environment') + msg = 'No %s defined in environment' % name + logging.error(msg) + raise Exception(msg) logging.info('reading config from %r', config_filename) config = load_config(config_filename, default_config) @@ -87,14 +89,13 @@ def main(): ick2.setup_logging(config) check_config(config, default_config) - ick2.log.log('info', msg_text='Blob service starts', config=config) + ick2.log.log('info', msg_text='Artifact store starts', config=config) api = ick2.BlobAPI() ick2.log.log('info', msg_text='created BlobAPI') api.set_blob_directory(config['blobdir']) - ick2.log.log( - 'info', msg_text='called BlobAPI.set_blob_directory') + ick2.log.log('info', msg_text='called BlobAPI.set_blob_directory') application = apifw.create_bottle_application( api, counter, dict_logger, config) diff --git a/ick-blob-service.service b/artifact_store.service index 2fbb2f2..a63d034 100644 --- a/ick-blob-service.service +++ b/artifact_store.service @@ -13,16 +13,16 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. [Unit] -Description=ick blob service +Description=ick artifact store After=network.target -ConditionPathExists=/etc/ick/blob-service.yaml +ConditionPathExists=/etc/ick/artifact_store.yaml [Service] Type=simple -User=_ickbs -Group=_ickbs +User=_ickas +Group=_ickas WorkingDirectory=/var/lib/ick/blobs -ExecStart=/usr/bin/start_blob_service +ExecStart=/usr/bin/start_artifact_store KillSignal=QUIT [Install] diff --git a/debian/ick2.postinst b/debian/ick2.postinst index 822006b..35578ed 100644 --- a/debian/ick2.postinst +++ b/debian/ick2.postinst @@ -36,7 +36,7 @@ create_user() # Create a group and user for ick users create_user _ick /var/lib/ick /var/log/ick create_user _ickwm /var/lib/ick/wm /var/log/ickwm -create_user _ickbs /var/lib/ick/blobs /var/log/ickbs +create_user _ickas /var/lib/ick/blobs /var/log/ickas # Create controller config dir. install -d -m 0755 -o root -g root /etc/ick @@ -50,7 +50,7 @@ install -d -m 0755 -o _ickwm -g _ickwm /var/lib/ick/workspace # Create worker-manager systree install -d -m 0755 -o _ickwm -g _ickwm /var/lib/ick/systree -# Create blob service storage -install -d -m 0755 -o _ickbs -g _ickbs /var/lib/ick/blobs +# Create artifact store storage +install -d -m 0755 -o _ickas -g _ickas /var/lib/ick/blobs #DEBHELPER# diff --git a/ick2/controllerapi.py b/ick2/controllerapi.py index 074fa2e..f7c71f6 100644 --- a/ick2/controllerapi.py +++ b/ick2/controllerapi.py @@ -22,13 +22,13 @@ class ControllerAPI: self._state = state self._apis = {} - def set_blob_service_url(self, url): # pragma: no cover + def set_artifact_store_url(self, url): # pragma: no cover self.find_missing_route('/version') api = self._apis.get('/version') if api: - api.set_blob_service_url(url) + api.set_artifact_store_url(url) ick2.log.log( - 'info', msg_text='Set blob service url', url=url, + 'info', msg_text='Set artifact store url', url=url, version=api.get_version()) def find_missing_route(self, missing_path): # pragma: no cover diff --git a/ick2/versionapi.py b/ick2/versionapi.py index 40d1dda..cc7e169 100644 --- a/ick2/versionapi.py +++ b/ick2/versionapi.py @@ -20,10 +20,10 @@ class VersionAPI(ick2.APIbase): def __init__(self, state): super().__init__(state) - self._blob_service_url = None + self._artifact_store_url = None - def set_blob_service_url(self, url): - self._blob_service_url = url + def set_artifact_store_url(self, url): + self._artifact_store_url = url def get_routes(self, path): # pragma: no cover return [ @@ -37,7 +37,7 @@ class VersionAPI(ick2.APIbase): def get_version(self, **kwargs): return { 'version': ick2.__version__, - 'blob_service': self._blob_service_url, + 'artifact_store': self._artifact_store_url, } def create(self, body, **kwargs): # pragma: no cover diff --git a/ick2/versionapi_tests.py b/ick2/versionapi_tests.py index 143e1cc..b8d59d5 100644 --- a/ick2/versionapi_tests.py +++ b/ick2/versionapi_tests.py @@ -24,12 +24,12 @@ class VersionAPITests(unittest.TestCase): def test_returns_version_correcly(self): bloburl = 'https://blobs.example.com' api = ick2.VersionAPI(None) - api.set_blob_service_url(bloburl) + api.set_artifact_store_url(bloburl) response = api.get_version() self.assertEqual( response, { 'version': ick2.__version__, - 'blob_service': bloburl, + 'artifact_store': bloburl, } ) diff --git a/ick_controller.py b/ick_controller.py index a176351..edfebb4 100644 --- a/ick_controller.py +++ b/ick_controller.py @@ -46,7 +46,7 @@ default_config = { 'token-issuer': None, 'log': [], 'statedir': None, - 'blob-service': None, + 'artifact-store': None, } @@ -94,10 +94,10 @@ def main(): state.set_state_directory(config['statedir']) api = ick2.ControllerAPI(state) - api.set_blob_service_url(config['blob-service']) + api.set_artifact_store_url(config['artifact-store']) ick2.log.log( 'info', msg_text='created ControllerAPI', - blob_service=config['blob-service']) + artifact_store=config['artifact-store']) application = apifw.create_bottle_application( api, counter, dict_logger, config) @@ -364,7 +364,7 @@ class Icktool(cliapp.Application): token = self.settings['token'] or self._new_token() blob_api = BlobAPI() blob_api.set_token(token) - blob_api.set_url(api.get_blob_service_url()) + blob_api.set_url(api.get_artifact_store_url()) blob_api.set_verify(self.settings['verify-tls']) return blob_api @@ -429,10 +429,10 @@ class API: if code == 200: return json.loads(text) - def get_blob_service_url(self): + def get_artifact_store_url(self): version = self.get_version() if version: - return version.get('blob_service') + return version.get('artifact_store') def get(self, path): assert self._url is not None diff --git a/run-blob-service-debug b/run-artifact-store-debug index 77bade4..6617abc 100755 --- a/run-blob-service-debug +++ b/run-artifact-store-debug @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2017 Lars Wirzenius +# Copyright 2017-2018 Lars Wirzenius # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -32,4 +32,4 @@ token-public-key: $(cat t.key.pub) blobdir: t.blobs EOF -BLOB_SERVICE_CONFIG=t.yaml python3 blob_service.py +ARTIFACT_STORE_CONFIG=t.yaml python3 artifact_store.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -# Copyright (C) 2017 Lars Wirzenius <liw@liw.fi> +# Copyright (C) 2017-2018 Lars Wirzenius <liw@liw.fi> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -48,13 +48,13 @@ setup( url='http://liw.fi/ick/', py_modules=[ 'ick_controller', - 'blob_service', + 'artifact_store', ], packages=['ick2'], scripts=[ 'create-token', 'start_ick', - 'start_blob_service', + 'start_artifact_store', 'icktool', 'worker_manager' ], diff --git a/start_blob_service b/start_artifact_store index b4a929f..3bc4a40 100644 --- a/start_blob_service +++ b/start_artifact_store @@ -16,9 +16,9 @@ set -eux -export BLOB_SERVICE_CONFIG=/etc/ick/blob-service.yaml +export ARTIFACT_STORE_CONFIG=/etc/ick/artifact_store.yaml gunicorn3 \ --bind 127.0.0.1:12766 \ - --log-file /var/log/ickbs/gunicorn3.log \ + --log-file /var/log/ickas/gunicorn3.log \ --log-level debug \ - blob_service:app + artifact_store:app diff --git a/worker_manager b/worker_manager index ad51619..7530469 100755 --- a/worker_manager +++ b/worker_manager @@ -175,19 +175,19 @@ class ControllerAPI: def bloburl(self, blob_id): if self._blob_url is None: - self._blob_url = self.get_blob_service_url() + self._blob_url = self.get_artifact_store_url() if self._blob_url is not None: return '{}/blobs/{}'.format(self._blob_url, blob_id) - logging.error('Do not have blob service URL') + logging.error('Do not artifact store URL') return None - def get_blob_service_url(self): + def get_artifact_store_url(self): url = self.url('/version') headers = self.get_auth_headers() version = self._httpapi.get(url, headers) logging.info('Version: %r', version) if version: - return version.get('blob_service') + return version.get('artifact_store') class HttpApi: diff --git a/yarns/100-projects.yarn b/yarns/100-projects.yarn index 7c18952..b5a7f78 100644 --- a/yarns/100-projects.yarn +++ b/yarns/100-projects.yarn @@ -55,7 +55,7 @@ building them. We start by starting an instance of the controller. ... uapi_projects_id_put ... uapi_projects_id_delete AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND a running ick controller WHEN user makes request GET /projects diff --git a/yarns/150-pipelines.yarn b/yarns/150-pipelines.yarn index feda6d0..15c4b05 100644 --- a/yarns/150-pipelines.yarn +++ b/yarns/150-pipelines.yarn @@ -63,7 +63,7 @@ running them. We start by starting an instance of the controller. ... uapi_pipelines_id_put ... uapi_pipelines_id_delete AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND a running ick controller WHEN user makes request GET /pipelines diff --git a/yarns/200-version.yarn b/yarns/200-version.yarn index 2f87ac7..d281a19 100644 --- a/yarns/200-version.yarn +++ b/yarns/200-version.yarn @@ -26,13 +26,13 @@ The Ick controller reports is version upon request. AND an access token for user with scopes ... uapi_version_get AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND a running ick controller WHEN user makes request GET /version THEN result has status code 200 AND version in body matches version from setup.py - AND blob service URL is https://blobs.example.com + AND artifact store URL is https://blobs.example.com FINALLY stop ick controller diff --git a/yarns/300-workers.yarn b/yarns/300-workers.yarn index 2cc7ea2..8b12f6f 100644 --- a/yarns/300-workers.yarn +++ b/yarns/300-workers.yarn @@ -60,7 +60,7 @@ controller API. It doesn't actually talk to the worker itself. ... uapi_workers_id_put ... uapi_workers_id_delete AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND a running ick controller WHEN user makes request GET /workers diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index ef164d9..e2ba579 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -27,7 +27,7 @@ Set up the controller. GIVEN an RSA key pair for token signing AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND an access token for user with scopes ... uapi_pipelines_post ... uapi_projects_post @@ -640,7 +640,7 @@ Set up the controller. GIVEN an RSA key pair for token signing AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND an access token for user with scopes ... uapi_pipelines_post ... uapi_projects_post @@ -797,7 +797,7 @@ Set up the controller. GIVEN an RSA key pair for token signing AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND an access token for user with scopes ... uapi_pipelines_post ... uapi_projects_post diff --git a/yarns/500-build-fail.yarn b/yarns/500-build-fail.yarn index dcc551d..84ec66d 100644 --- a/yarns/500-build-fail.yarn +++ b/yarns/500-build-fail.yarn @@ -28,7 +28,7 @@ Set up the controller. GIVEN an RSA key pair for token signing AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND an access token for user with scopes ... uapi_pipelines_post ... uapi_projects_post diff --git a/yarns/600-unauthz.yarn b/yarns/600-unauthz.yarn index 0a602af..c57f815 100644 --- a/yarns/600-unauthz.yarn +++ b/yarns/600-unauthz.yarn @@ -28,7 +28,7 @@ Set up the controller. GIVEN an RSA key pair for token signing AND controller config uses statedir at the state directory - AND controller config uses https://blobs.example.com as blob service + AND controller config uses https://blobs.example.com as artifact store AND an access token for user with scopes ... uapi_projects_post ... uapi_projects_id_pipelines_id_put diff --git a/yarns/700-blob-service.yarn b/yarns/700-artifact-store.yarn index 1fd0c06..2dcea2e 100644 --- a/yarns/700-blob-service.yarn +++ b/yarns/700-artifact-store.yarn @@ -1,6 +1,6 @@ <!-- -Copyright 2017 Lars Wirzenius +Copyright 2017-2018 Lars Wirzenius This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -17,36 +17,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. --> -# Blob service +# Artifact store -This scenario tests the blob service API to store and retrieve blobs. -At this stage the blob service is the simplest possible; so simple, in -fact, it will certainly change in the future. +This scenario tests the artifact store API to store and retrieve +blobs. At this stage the artifact store is the simplest possible; so +simple, in fact, it will certainly change in the future. - SCENARIO blob service + SCENARIO artifact store -Set up the blob service. +Set up the artifact store. GIVEN an RSA key pair for token signing - AND blob service config uses blobs at the blob directory + AND artifact store config uses blobs at the blob directory AND an access token for user with scopes ... uapi_blobs_id_put ... uapi_blobs_id_get - AND a running blob service + AND a running artifact store Try to get a non-existent blob. It should result in an error. - WHEN user retrieves /blobs/cake from blob service + WHEN user retrieves /blobs/cake from artifact store THEN result has status code 404 Create and store a blob, retrieve it and verify we get it back intack. WHEN user creates a blob named cake with random data - AND user sends blob cake to blob service as /blobs/cake + AND user sends blob cake to artifact store as /blobs/cake THEN result has status code 200 - WHEN user retrieves /blobs/cake from blob service + WHEN user retrieves /blobs/cake from artifact store THEN result has status code 200 AND body is the same as the blob cake - FINALLY stop blob service + FINALLY stop artifact store diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index c6be689..8a7dff1 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. url = vars['url'] http(vars, get, url + path, token=token) - IMPLEMENTS WHEN (\S+) retrieves (\S+) from blob service + IMPLEMENTS WHEN (\S+) retrieves (\S+) from artifact store user = get_next_match() path = get_next_match() token = get_token(user) @@ -74,7 +74,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. url = vars['url'] http(vars, put, url + path, body=body, token=token) - IMPLEMENTS WHEN (\S+) sends blob (\S+) to blob service as (\S+) + IMPLEMENTS WHEN (\S+) sends blob (\S+) to artifact store as (\S+) user = get_next_match() filename = get_next_match() path = get_next_match() diff --git a/yarns/900-local.yarn b/yarns/900-local.yarn index 5efad69..4e9dbe1 100644 --- a/yarns/900-local.yarn +++ b/yarns/900-local.yarn @@ -46,8 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. IMPLEMENTS GIVEN controller config uses (\S+) at the state directory vars['statedir'] = get_next_match() - IMPLEMENTS GIVEN controller config uses (\S+) as blob service - vars['blob_service'] = get_next_match() + IMPLEMENTS GIVEN controller config uses (\S+) as artifact store + vars['artifact_store'] = get_next_match() ## Start and stop the controller @@ -67,7 +67,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. }, ], 'statedir': vars['statedir'], - 'blob-service': vars['blob_service'], + 'artifact-store': vars['artifact_store'], } env = dict(os.environ) env['ICK_CONTROLLER_CONFIG'] = 'ick_controller.yaml' @@ -109,22 +109,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ## Check version result - IMPLEMENTS THEN blob service URL is (\S+) + IMPLEMENTS THEN artifact store URL is (\S+) expected = get_next_match() body = vars['body'] obj = json.loads(body) - actual = obj['blob_service'] + actual = obj['artifact_store'] assertEqual(actual, expected) -## Start and stop blob service +## Start and stop artifact store - IMPLEMENTS GIVEN blob service config uses (\S+) at the blob directory + IMPLEMENTS GIVEN artifact store config uses (\S+) at the blob directory vars['blobdir'] = get_next_match() - IMPLEMENTS GIVEN a running blob service + IMPLEMENTS GIVEN a running artifact store import os, time, cliapp, yaml - vars['blob_service.log'] = 'blob_service.log' - vars['gunicorn3_bs.log'] = 'gunicorn3_bs.log' + vars['artifact_store.log'] = 'artifact_store.log' + vars['gunicorn3_as.log'] = 'gunicorn3_as.log' vars['bsport'] = random_free_port() vars['bsurl'] = 'http://127.0.0.1:{}'.format(vars['bsport']) config = { @@ -133,27 +133,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. 'token-public-key': cat('token.key.pub'), 'log': [ { - 'filename': vars['blob_service.log'], + 'filename': vars['artifact_store.log'], }, ], 'blobdir': vars['blobdir'], } env = dict(os.environ) - env['BLOB_SERVICE_CONFIG'] = 'blob_service.yaml' - yaml.safe_dump(config, open('blob_service.yaml', 'w')) + env['ARTIFACT_STORE_CONFIG'] = 'artifact_store.yaml' + yaml.safe_dump(config, open('artifact_store.yaml', 'w')) argv = [ 'gunicorn3', '--daemon', '--bind', '127.0.0.1:{}'.format(vars['bsport']), - '--log-file', vars['gunicorn3_bs.log'], + '--log-file', vars['gunicorn3_as.log'], '--log-level', 'debug', '-p', 'bspid', - 'blob_service:app', + 'artifact_store:app', ] cliapp.runcmd(argv, env=env) vars['bspid'] = int(cat('bspid')) wait_for_port(vars['bsport']) - IMPLEMENTS FINALLY stop blob service + IMPLEMENTS FINALLY stop artifact store import os, signal os.kill(vars['bspid'], signal.SIGTERM) |