-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #718 from MetaCell/feature/CH-47
Add tag / build reference api
- Loading branch information
Showing
16 changed files
with
362 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,111 @@ | ||
openapi: 3.0.0 | ||
info: | ||
description: Cloud Harness Platform - Reference CH service API | ||
license: | ||
name: UNLICENSED | ||
title: CH common service API | ||
version: 0.1.0 | ||
title: CH common service API | ||
version: 0.1.0 | ||
description: Cloud Harness Platform - Reference CH service API | ||
license: | ||
name: UNLICENSED | ||
servers: | ||
- description: SwaggerHub API Auto Mocking | ||
url: /api | ||
tags: | ||
- description: Sentry | ||
name: Sentry | ||
- | ||
url: /api | ||
description: SwaggerHub API Auto Mocking | ||
paths: | ||
/sentry/getdsn/{appname}: | ||
parameters: | ||
- in: path | ||
name: appname | ||
schema: | ||
type: string | ||
required: true | ||
get: | ||
tags: | ||
- Sentry | ||
description: Gets the Sentry DSN for a given application | ||
operationId: getdsn | ||
responses: | ||
'200': | ||
description: Sentry DSN for the given application | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
'400': | ||
description: Sentry not configured for the given application | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
text/html: | ||
schema: | ||
type: string | ||
'404': | ||
description: Sentry not configured for the given application | ||
content: | ||
application/problem+json: | ||
schema: | ||
type: object | ||
text/html: | ||
schema: | ||
type: string | ||
summary: Gets the Sentry DSN for a given application | ||
x-openapi-router-controller: common.controllers.sentry_controller | ||
/accounts/config: | ||
get: | ||
tags: | ||
- Accounts | ||
description: Gets the config for logging in into accounts | ||
operationId: get_config | ||
responses: | ||
'200': | ||
description: Config for accounts log in | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
url: | ||
'/sentry/getdsn/{appname}': | ||
get: | ||
tags: | ||
- Sentry | ||
responses: | ||
'200': | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
description: Sentry DSN for the given application | ||
'400': | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
text/html: | ||
schema: | ||
type: string | ||
description: Sentry not configured for the given application | ||
'404': | ||
content: | ||
application/problem+json: | ||
schema: | ||
type: object | ||
text/html: | ||
schema: | ||
type: string | ||
description: Sentry not configured for the given application | ||
operationId: getdsn | ||
summary: Gets the Sentry DSN for a given application | ||
description: Gets the Sentry DSN for a given application | ||
x-openapi-router-controller: common.controllers.sentry_controller | ||
parameters: | ||
- | ||
name: appname | ||
schema: | ||
type: string | ||
description: The auth URL. | ||
realm: | ||
in: path | ||
required: true | ||
/accounts/config: | ||
get: | ||
tags: | ||
- Accounts | ||
responses: | ||
'200': | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
url: | ||
description: The auth URL. | ||
type: string | ||
realm: | ||
description: The realm. | ||
type: string | ||
clientId: | ||
description: The clientID. | ||
type: string | ||
description: Config for accounts log in | ||
operationId: get_config | ||
summary: Gets the config for logging in into accounts | ||
description: Gets the config for logging in into accounts | ||
x-openapi-router-controller: common.controllers.accounts_controller | ||
/version: | ||
summary: Get the version for this deployment | ||
get: | ||
tags: | ||
- config | ||
responses: | ||
'200': | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/AppVersion' | ||
examples: | ||
version: | ||
value: "{\r\n \"build\": \"63498f19146bae1a6ae7e354\"\r\n \"tag\": \"v1.2.0\"\r\n}" | ||
description: Deployment version GET | ||
operationId: getVersion | ||
components: | ||
schemas: | ||
AppVersion: | ||
title: Root Type for AppVersion | ||
description: '' | ||
type: object | ||
properties: | ||
build: | ||
type: string | ||
description: The realm. | ||
clientId: | ||
tag: | ||
type: string | ||
description: The clientID. | ||
summary: Gets the config for logging in into accounts | ||
x-openapi-router-controller: common.controllers.accounts_controller | ||
example: | ||
build: 63498f19146bae1a6ae7e354 | ||
tag: v1.2.0 | ||
tags: | ||
- | ||
name: Sentry | ||
description: Sentry |
25 changes: 25 additions & 0 deletions
25
applications/common/server/common/controllers/config_controller.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
import connexion | ||
import six | ||
from typing import Dict | ||
from typing import Tuple | ||
from typing import Union | ||
|
||
from common.models.app_version import AppVersion # noqa: E501 | ||
from common import util | ||
|
||
from cloudharness.utils.config import CloudharnessConfig | ||
from cloudharness_model.models import HarnessMainConfig | ||
|
||
def get_version(): # noqa: E501 | ||
"""get_version | ||
# noqa: E501 | ||
:rtype: Union[AppVersion, Tuple[AppVersion, int], Tuple[AppVersion, int, Dict[str, str]] | ||
""" | ||
|
||
config: HarnessMainConfig = HarnessMainConfig.from_dict(CloudharnessConfig.get_configuration()) | ||
|
||
return AppVersion(tag=config.tag, build=config.build_hash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# coding: utf-8 | ||
|
||
from __future__ import absolute_import | ||
from datetime import date, datetime # noqa: F401 | ||
|
||
from typing import List, Dict # noqa: F401 | ||
|
||
from common.models.base_model_ import Model | ||
from common import util | ||
|
||
|
||
class AppVersion(Model): | ||
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
Do not edit the class manually. | ||
""" | ||
|
||
def __init__(self, build=None, tag=None): # noqa: E501 | ||
"""AppVersion - a model defined in OpenAPI | ||
:param build: The build of this AppVersion. # noqa: E501 | ||
:type build: str | ||
:param tag: The tag of this AppVersion. # noqa: E501 | ||
:type tag: str | ||
""" | ||
self.openapi_types = { | ||
'build': str, | ||
'tag': str | ||
} | ||
|
||
self.attribute_map = { | ||
'build': 'build', | ||
'tag': 'tag' | ||
} | ||
|
||
self._build = build | ||
self._tag = tag | ||
|
||
@classmethod | ||
def from_dict(cls, dikt) -> 'AppVersion': | ||
"""Returns the dict as a model | ||
:param dikt: A dict. | ||
:type: dict | ||
:return: The AppVersion of this AppVersion. # noqa: E501 | ||
:rtype: AppVersion | ||
""" | ||
return util.deserialize_model(dikt, cls) | ||
|
||
@property | ||
def build(self): | ||
"""Gets the build of this AppVersion. | ||
:return: The build of this AppVersion. | ||
:rtype: str | ||
""" | ||
return self._build | ||
|
||
@build.setter | ||
def build(self, build): | ||
"""Sets the build of this AppVersion. | ||
:param build: The build of this AppVersion. | ||
:type build: str | ||
""" | ||
|
||
self._build = build | ||
|
||
@property | ||
def tag(self): | ||
"""Gets the tag of this AppVersion. | ||
:return: The tag of this AppVersion. | ||
:rtype: str | ||
""" | ||
return self._tag | ||
|
||
@tag.setter | ||
def tag(self, tag): | ||
"""Sets the tag of this AppVersion. | ||
:param tag: The tag of this AppVersion. | ||
:type tag: str | ||
""" | ||
|
||
self._tag = tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule zero-to-jupyterhub-k8s
added at
c92c12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
|
||
|
||
const Version = () => { | ||
const [result, setResult] = useState(null); | ||
useEffect(() => { | ||
fetch("/proxy/common/api/version", { | ||
headers: { | ||
'Accept': 'application/json' | ||
} | ||
}).then(r => r.json().then(j => setResult(j)), () => setResult({ data: "API error" })); | ||
}, []); | ||
|
||
|
||
return result ? <p>Tag: { result?.tag } - Build: {result?.build} </p> : <p>Backend did not answer</p> | ||
} | ||
|
||
export default Version; |
Oops, something went wrong.