mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 02:05:41 +01:00
Remove chart api (#18265)
* remove chart api from swagger Delete the api path for chart in the swagger Signed-off-by: Wang Yan <wangyan@vmware.com> * Remove chart APIs 1. Remove some chart-related steps for Dockerfile for portal container 2. Remove chart APIs for API center Signed-off-by: AllForNothing <sshijun@vmware.com> --------- Signed-off-by: Wang Yan <wangyan@vmware.com> Signed-off-by: AllForNothing <sshijun@vmware.com> Co-authored-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
660e1d1362
commit
9973d99f3e
6
Makefile
6
Makefile
@ -564,14 +564,8 @@ swagger_client:
|
||||
@echo "Generate swagger client"
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar -O openapi-generator-cli.jar
|
||||
rm -rf harborclient
|
||||
mkdir -p harborclient/harbor_client
|
||||
mkdir -p harborclient/harbor_swagger_client
|
||||
mkdir -p harborclient/harbor_v2_swagger_client
|
||||
java -jar openapi-generator-cli.jar generate -i api/swagger.yaml -g python -o harborclient/harbor_client --package-name client
|
||||
java -jar openapi-generator-cli.jar generate -i api/v2.0/legacy_swagger.yaml -g python -o harborclient/harbor_swagger_client --package-name swagger_client
|
||||
java -jar openapi-generator-cli.jar generate -i api/v2.0/swagger.yaml -g python -o harborclient/harbor_v2_swagger_client --package-name v2_swagger_client
|
||||
cd harborclient/harbor_client; python ./setup.py install
|
||||
cd harborclient/harbor_swagger_client; python ./setup.py install
|
||||
cd harborclient/harbor_v2_swagger_client; python ./setup.py install
|
||||
pip install docker -q
|
||||
pip freeze
|
||||
|
@ -50,7 +50,6 @@ For learning the architecture design of Harbor, check the document [Architecture
|
||||
|
||||
* Harbor RESTful API: The APIs for most administrative operations of Harbor and can be used to perform integrations with Harbor programmatically.
|
||||
* Part 1: [New or changed APIs](https://editor.swagger.io/?url=https://raw.githubusercontent.com/goharbor/harbor/main/api/v2.0/swagger.yaml)
|
||||
* Part 2: [Legacy APIs](https://editor.swagger.io/?url=https://raw.githubusercontent.com/goharbor/harbor/main/api/v2.0/legacy_swagger.yaml)
|
||||
|
||||
## Install & Run
|
||||
|
||||
|
533
api/swagger.yaml
533
api/swagger.yaml
@ -1,533 +0,0 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: Harbor API
|
||||
description: These APIs provide services for manipulating Harbor project.
|
||||
version: ''
|
||||
host: localhost
|
||||
schemes:
|
||||
- http
|
||||
- https
|
||||
basePath: /api/
|
||||
produces:
|
||||
- application/json
|
||||
consumes:
|
||||
- application/json
|
||||
securityDefinitions:
|
||||
basic:
|
||||
type: basic
|
||||
security:
|
||||
- basic: []
|
||||
- {}
|
||||
paths:
|
||||
/version:
|
||||
get:
|
||||
summary: Get API version
|
||||
description: Get the version of API that supported by the Harbor instance.
|
||||
tags:
|
||||
- Version
|
||||
responses:
|
||||
'200':
|
||||
description: The supported API version
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
version:
|
||||
type: string
|
||||
|
||||
/chartrepo/health:
|
||||
get:
|
||||
summary: Check the health of chart repository service.
|
||||
description: Check the health of chart repository service.
|
||||
tags:
|
||||
- Chart Repository
|
||||
responses:
|
||||
'200':
|
||||
description: Health status of chart repository service is returned.
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
healthy:
|
||||
type: boolean
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
/chartrepo/{repo}/charts:
|
||||
get:
|
||||
summary: Get all the charts under the specified project
|
||||
description: Get all the charts under the specified project
|
||||
tags:
|
||||
- Chart Repository
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
responses:
|
||||
'200':
|
||||
description: Searched for charts of project in Harbor successfully.
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/ChartInfoEntry'
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
post:
|
||||
summary: Upload a chart file to the specified project.
|
||||
description: 'Upload a chart file to the specified project. With this API, the corresponding provance file can be uploaded together with chart file at once.'
|
||||
tags:
|
||||
- Chart Repository
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: chart
|
||||
in: formData
|
||||
type: file
|
||||
required: true
|
||||
description: The chart file
|
||||
- name: prov
|
||||
in: formData
|
||||
type: file
|
||||
required: false
|
||||
description: The provance file
|
||||
responses:
|
||||
'201':
|
||||
description: The specified chart is successfully uploaded.
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
'507':
|
||||
$ref: '#/definitions/InsufficientStorageChartAPIError'
|
||||
/chartrepo/{repo}/charts/{name}:
|
||||
get:
|
||||
summary: Get all the versions of the specified chart
|
||||
description: Get all the versions of the specified chart
|
||||
tags:
|
||||
- Chart Repository
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart name
|
||||
responses:
|
||||
'200':
|
||||
description: Retrieved all versions of the specified chart
|
||||
schema:
|
||||
$ref: '#/definitions/ChartVersions'
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'404':
|
||||
$ref: '#/definitions/NotFoundChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
delete:
|
||||
summary: Delete all the versions of the specified chart
|
||||
description: Delete all the versions of the specified chart
|
||||
tags:
|
||||
- Chart Repository
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart name
|
||||
responses:
|
||||
'200':
|
||||
description: The specified chart entry is successfully deleted.
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
/chartrepo/{repo}/charts/{name}/{version}:
|
||||
get:
|
||||
summary: Get the specified chart version
|
||||
description: Get the specified chart version
|
||||
tags:
|
||||
- Chart Repository
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart name
|
||||
- name: version
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart version
|
||||
responses:
|
||||
'200':
|
||||
description: Successfully retrieved the chart version
|
||||
schema:
|
||||
$ref: '#/definitions/ChartVersionDetails'
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'404':
|
||||
$ref: '#/definitions/NotFoundChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
delete:
|
||||
summary: Delete the specified chart version
|
||||
description: Delete the specified chart version
|
||||
tags:
|
||||
- Chart Repository
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart name
|
||||
- name: version
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart version
|
||||
responses:
|
||||
'200':
|
||||
description: The specified chart entry is successfully deleted.
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'404':
|
||||
$ref: '#/definitions/NotFoundChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
/chartrepo/{repo}/prov:
|
||||
post:
|
||||
summary: Upload a provance file to the specified project.
|
||||
description: Upload a provance file to the specified project. The provance file should be targeted for an existing chart file.
|
||||
tags:
|
||||
- Chart Repository
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: prov
|
||||
in: formData
|
||||
type: file
|
||||
required: true
|
||||
description: The provance file
|
||||
responses:
|
||||
'201':
|
||||
description: The provance file is successfully uploaded.
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
'507':
|
||||
$ref: '#/definitions/InsufficientStorageChartAPIError'
|
||||
/chartrepo/charts:
|
||||
post:
|
||||
summary: Upload a chart file to the defult 'library' project.
|
||||
description: Upload a chart file to the default 'library' project. Uploading together with the prov file at the same time is also supported.
|
||||
tags:
|
||||
- Chart Repository
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
parameters:
|
||||
- name: chart
|
||||
in: formData
|
||||
type: file
|
||||
required: true
|
||||
description: The chart file
|
||||
- name: prov
|
||||
in: formData
|
||||
type: file
|
||||
required: false
|
||||
description: The provance file
|
||||
responses:
|
||||
'201':
|
||||
description: The specified chart is successfully uploaded.
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
'507':
|
||||
$ref: '#/definitions/InsufficientStorageChartAPIError'
|
||||
definitions:
|
||||
ChartAPIError:
|
||||
description: The error object returned by chart repository API
|
||||
type: object
|
||||
required:
|
||||
- error
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: The error message returned by the chart API
|
||||
UnauthorizedChartAPIError:
|
||||
description: Unauthorized
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
ForbiddenChartAPIError:
|
||||
description: Operation is forbidden or quota exceeded
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
InternalChartAPIError:
|
||||
description: Internal server error occurred
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
NotFoundChartAPIError:
|
||||
description: Not found
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
InsufficientStorageChartAPIError:
|
||||
description: Insufficient storage
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
ChartInfoEntry:
|
||||
type: object
|
||||
description: The object contains basic chart information
|
||||
required:
|
||||
- name
|
||||
- total_versions
|
||||
- created
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: Name of chart
|
||||
total_versions:
|
||||
type: integer
|
||||
description: Total count of chart versions
|
||||
latest_version:
|
||||
type: string
|
||||
description: latest version of chart
|
||||
created:
|
||||
type: string
|
||||
description: The created time of chart
|
||||
updated:
|
||||
type: string
|
||||
description: The created time of chart
|
||||
icon:
|
||||
type: string
|
||||
description: The icon path of chart
|
||||
home:
|
||||
type: string
|
||||
description: The home website of chart
|
||||
deprecated:
|
||||
type: boolean
|
||||
description: Flag to indicate if the chart is deprecated
|
||||
ChartInfoList:
|
||||
type: array
|
||||
description: The chart list under the project
|
||||
items:
|
||||
$ref: '#/definitions/ChartInfoEntry'
|
||||
ChartVersion:
|
||||
type: object
|
||||
description: A specified chart entry
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartMetadata'
|
||||
- type: object
|
||||
properties:
|
||||
created:
|
||||
type: string
|
||||
description: The created time of the chart entry
|
||||
removed:
|
||||
type: boolean
|
||||
description: A flag to indicate if the chart entry is removed
|
||||
digest:
|
||||
type: string
|
||||
description: The digest value of the chart entry
|
||||
urls:
|
||||
type: array
|
||||
description: The urls of the chart entry
|
||||
items:
|
||||
type: string
|
||||
properties:
|
||||
labels:
|
||||
$ref: '#/definitions/Labels'
|
||||
ChartVersions:
|
||||
type: array
|
||||
description: A list of chart entry
|
||||
items:
|
||||
$ref: '#/definitions/ChartVersion'
|
||||
ChartVersionDetails:
|
||||
type: object
|
||||
description: The detailed information of the chart entry
|
||||
properties:
|
||||
metadata:
|
||||
$ref: '#/definitions/ChartVersion'
|
||||
security:
|
||||
$ref: '#/definitions/SecurityReport'
|
||||
dependencies:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/Dependency'
|
||||
values:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
files:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: string
|
||||
labels:
|
||||
$ref: '#/definitions/Labels'
|
||||
ChartMetadata:
|
||||
type: object
|
||||
description: The metadata of chart version
|
||||
required:
|
||||
- name
|
||||
- version
|
||||
- engine
|
||||
- icon
|
||||
- apiVersion
|
||||
- appVersion
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: The name of the chart
|
||||
home:
|
||||
type: string
|
||||
description: The URL to the relevant project page
|
||||
sources:
|
||||
type: array
|
||||
description: The URL to the source code of chart
|
||||
items:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
description: A SemVer 2 version of chart
|
||||
description:
|
||||
type: string
|
||||
description: A one-sentence description of chart
|
||||
keywords:
|
||||
type: array
|
||||
description: A list of string keywords
|
||||
items:
|
||||
type: string
|
||||
engine:
|
||||
type: string
|
||||
description: The name of template engine
|
||||
icon:
|
||||
type: string
|
||||
description: The URL to an icon file
|
||||
apiVersion:
|
||||
type: string
|
||||
description: The API version of this chart
|
||||
appVersion:
|
||||
type: string
|
||||
description: The version of the application enclosed in the chart
|
||||
deprecated:
|
||||
type: boolean
|
||||
description: Whether or not this chart is deprecated
|
||||
Labels:
|
||||
type: array
|
||||
description: A list of label
|
||||
items:
|
||||
$ref: '#/definitions/Label'
|
||||
Label:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: The ID of label.
|
||||
name:
|
||||
type: string
|
||||
description: The name of label.
|
||||
description:
|
||||
type: string
|
||||
description: The description of label.
|
||||
color:
|
||||
type: string
|
||||
description: The color of label.
|
||||
scope:
|
||||
type: string
|
||||
description: 'The scope of label, g for global labels and p for project labels.'
|
||||
project_id:
|
||||
type: integer
|
||||
description: The project ID if the label is a project label.
|
||||
creation_time:
|
||||
type: string
|
||||
description: The creation time of label.
|
||||
update_time:
|
||||
type: string
|
||||
description: The update time of label.
|
||||
deleted:
|
||||
type: boolean
|
||||
description: The label is deleted or not.
|
||||
SecurityReport:
|
||||
type: object
|
||||
description: The security information of the chart
|
||||
properties:
|
||||
signature:
|
||||
$ref: '#/definitions/DigitalSignature'
|
||||
Dependency:
|
||||
type: object
|
||||
description: Another chart the chart depends on
|
||||
required:
|
||||
- name
|
||||
- version
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: The name of the chart denpendency
|
||||
version:
|
||||
type: string
|
||||
description: The version of the chart dependency
|
||||
repository:
|
||||
type: string
|
||||
description: The URL to the repository
|
||||
DigitalSignature:
|
||||
type: object
|
||||
description: The signature of the chart
|
||||
properties:
|
||||
signed:
|
||||
type: boolean
|
||||
description: A flag to indicate if the chart is signed
|
||||
prov_file:
|
||||
type: string
|
||||
description: The URL of the provance file
|
@ -9,10 +9,10 @@ This file lists all the files that are referring the swagger yaml file.
|
||||
- docs/configure_swagger.md
|
||||
- `https://raw.githubusercontent.com/goharbor/harbor/master/api/harbor/swagger.yaml`
|
||||
- make/photon/portal/Dockerfile
|
||||
- `COPY ./api/harbor/swagger.yaml /build_dir`
|
||||
- `COPY ./api/v2.0/swagger.yaml /build_dir/swagger.yaml`
|
||||
- tests/swaggerchecker.sh
|
||||
- `HARBOR_SWAGGER_FILE="https://raw.githubusercontent.com/$TRAVIS_REPO_SLUG/$TRAVIS_COMMIT/api/harbor/swagger.yaml"`
|
||||
- else `HARBOR_SWAGGER_FILE="https://raw.githubusercontent.com/$TRAVIS_PULL_REQUEST_SLUG/$TRAVIS_PULL_REQUEST_SHA/api/harbor/swagger.yaml"`
|
||||
|
||||
|
||||
**Notes:** Base path is the code repository root dir.
|
||||
**Notes:** Base path is the code repository root dir.
|
||||
|
@ -1,370 +0,0 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: Harbor API
|
||||
description: These APIs provide services for manipulating Harbor project.
|
||||
version: '2.0'
|
||||
host: localhost
|
||||
schemes:
|
||||
- http
|
||||
- https
|
||||
basePath: /api/v2.0
|
||||
produces:
|
||||
- application/json
|
||||
- text/plain
|
||||
consumes:
|
||||
- application/json
|
||||
securityDefinitions:
|
||||
basic:
|
||||
type: basic
|
||||
security:
|
||||
- basic: []
|
||||
- {}
|
||||
paths:
|
||||
/chartrepo/{repo}/charts/{name}/{version}/labels:
|
||||
get:
|
||||
summary: Return the attached labels of chart.
|
||||
description: Return the attached labels of the specified chart version.
|
||||
tags:
|
||||
- Products
|
||||
- Chart Repository
|
||||
- Label
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart name
|
||||
- name: version
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart version
|
||||
responses:
|
||||
'200':
|
||||
$ref: '#/definitions/Labels'
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'404':
|
||||
$ref: '#/definitions/NotFoundChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
post:
|
||||
summary: Mark label to chart.
|
||||
description: Mark label to the specified chart version.
|
||||
tags:
|
||||
- Products
|
||||
- Chart Repository
|
||||
- Label
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart name
|
||||
- name: version
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart version
|
||||
- name: label
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/Label'
|
||||
description: 'The label being marked to the chart version'
|
||||
responses:
|
||||
'200':
|
||||
description: The label is successfully marked to the chart version.
|
||||
'400':
|
||||
$ref: '#/definitions/BadRequestFormatedError'
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'404':
|
||||
$ref: '#/definitions/NotFoundChartAPIError'
|
||||
'409':
|
||||
$ref: '#/definitions/ConflictFormatedError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
/chartrepo/{repo}/charts/{name}/{version}/labels/{id}:
|
||||
delete:
|
||||
summary: Remove label from chart.
|
||||
description: Remove label from the specified chart version.
|
||||
tags:
|
||||
- Products
|
||||
- Chart Repository
|
||||
- Label
|
||||
parameters:
|
||||
- name: repo
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The project name
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart name
|
||||
- name: version
|
||||
in: path
|
||||
type: string
|
||||
required: true
|
||||
description: The chart version
|
||||
- name: id
|
||||
in: path
|
||||
type: integer
|
||||
required: true
|
||||
description: The label ID
|
||||
responses:
|
||||
'200':
|
||||
description: The label is successfully unmarked from the chart version.
|
||||
'400':
|
||||
$ref: '#/definitions/BadRequestFormatedError'
|
||||
'401':
|
||||
$ref: '#/definitions/UnauthorizedChartAPIError'
|
||||
'403':
|
||||
$ref: '#/definitions/ForbiddenChartAPIError'
|
||||
'404':
|
||||
$ref: '#/definitions/NotFoundChartAPIError'
|
||||
'500':
|
||||
$ref: '#/definitions/InternalChartAPIError'
|
||||
responses:
|
||||
OK:
|
||||
description: 'Success'
|
||||
Created:
|
||||
description: 'Created'
|
||||
headers:
|
||||
Location:
|
||||
type: string
|
||||
description: The URL of the created resource
|
||||
BadRequest:
|
||||
description: 'Bad Request'
|
||||
Unauthorized:
|
||||
description: 'Unauthorized'
|
||||
Forbidden:
|
||||
description: 'Forbidden'
|
||||
NotFound:
|
||||
description: 'Not Found'
|
||||
Conflict:
|
||||
description: 'Conflict'
|
||||
PreconditionFailed:
|
||||
description: 'Precondition Failed'
|
||||
UnsupportedMediaType:
|
||||
description: 'The Media Type of the request is not supported, it has to be "application/json"'
|
||||
InternalServerError:
|
||||
description: 'Internal Server Error'
|
||||
definitions:
|
||||
EmailServerSetting:
|
||||
type: object
|
||||
properties:
|
||||
email_host:
|
||||
type: string
|
||||
description: The host of email server.
|
||||
email_port:
|
||||
type: integer
|
||||
description: The port of email server.
|
||||
email_username:
|
||||
type: string
|
||||
description: The username of email server.
|
||||
email_password:
|
||||
type: string
|
||||
description: The password of email server.
|
||||
email_ssl:
|
||||
type: boolean
|
||||
description: Use ssl/tls or not.
|
||||
email_identity:
|
||||
type: string
|
||||
description: The dentity of email server.
|
||||
ComponentOverviewEntry:
|
||||
type: object
|
||||
properties:
|
||||
severity:
|
||||
type: integer
|
||||
description: '1-None/Negligible, 2-Unknown, 3-Low, 4-Medium, 5-High'
|
||||
count:
|
||||
type: integer
|
||||
description: number of the components with certain severity.
|
||||
Label:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: The ID of label.
|
||||
name:
|
||||
type: string
|
||||
description: The name of label.
|
||||
description:
|
||||
type: string
|
||||
description: The description of label.
|
||||
color:
|
||||
type: string
|
||||
description: The color of label.
|
||||
scope:
|
||||
type: string
|
||||
description: 'The scope of label, g for global labels and p for project labels.'
|
||||
project_id:
|
||||
type: integer
|
||||
description: The project ID if the label is a project label.
|
||||
creation_time:
|
||||
type: string
|
||||
description: The creation time of label.
|
||||
update_time:
|
||||
type: string
|
||||
description: The update time of label.
|
||||
deleted:
|
||||
type: boolean
|
||||
description: The label is deleted or not.
|
||||
ChartAPIError:
|
||||
description: The error object returned by chart repository API
|
||||
type: object
|
||||
required:
|
||||
- error
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: The error message returned by the chart API
|
||||
UnauthorizedChartAPIError:
|
||||
description: Unauthorized
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
ForbiddenChartAPIError:
|
||||
description: Operation is forbidden or quota exceeded
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
InternalChartAPIError:
|
||||
description: Internal server error occurred
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
NotFoundChartAPIError:
|
||||
description: Not found
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
InsufficientStorageChartAPIError:
|
||||
description: Insufficient storage
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
BadRequestFormatedError:
|
||||
description: Bad request
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
ConflictFormatedError:
|
||||
description: Conflicts
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartAPIError'
|
||||
ChartMetadata:
|
||||
type: object
|
||||
description: The metadata of chart version
|
||||
required:
|
||||
- name
|
||||
- version
|
||||
- engine
|
||||
- icon
|
||||
- apiVersion
|
||||
- appVersion
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: The name of the chart
|
||||
home:
|
||||
type: string
|
||||
description: The URL to the relevant project page
|
||||
sources:
|
||||
type: array
|
||||
description: The URL to the source code of chart
|
||||
items:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
description: A SemVer 2 version of chart
|
||||
description:
|
||||
type: string
|
||||
description: A one-sentence description of chart
|
||||
keywords:
|
||||
type: array
|
||||
description: A list of string keywords
|
||||
items:
|
||||
type: string
|
||||
engine:
|
||||
type: string
|
||||
description: The name of template engine
|
||||
icon:
|
||||
type: string
|
||||
description: The URL to an icon file
|
||||
apiVersion:
|
||||
type: string
|
||||
description: The API version of this chart
|
||||
appVersion:
|
||||
type: string
|
||||
description: The version of the application enclosed in the chart
|
||||
deprecated:
|
||||
type: boolean
|
||||
description: Whether or not this chart is deprecated
|
||||
ChartVersion:
|
||||
type: object
|
||||
description: A specified chart entry
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartMetadata'
|
||||
- type: object
|
||||
properties:
|
||||
created:
|
||||
type: string
|
||||
description: The created time of the chart entry
|
||||
removed:
|
||||
type: boolean
|
||||
description: A flag to indicate if the chart entry is removed
|
||||
digest:
|
||||
type: string
|
||||
description: The digest value of the chart entry
|
||||
urls:
|
||||
type: array
|
||||
description: The urls of the chart entry
|
||||
items:
|
||||
type: string
|
||||
properties:
|
||||
labels:
|
||||
$ref: '#/definitions/Labels'
|
||||
Labels:
|
||||
type: array
|
||||
description: A list of label
|
||||
items:
|
||||
$ref: '#/definitions/Label'
|
||||
Permission:
|
||||
type: object
|
||||
description: The permission
|
||||
properties:
|
||||
resource:
|
||||
type: string
|
||||
description: The permission resoruce
|
||||
action:
|
||||
type: string
|
||||
description: The permission action
|
||||
Namespace:
|
||||
type: object
|
||||
description: The namespace of registry
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: The name of namespace
|
||||
metadata:
|
||||
type: object
|
||||
description: The metadata of namespace
|
@ -37,9 +37,9 @@ paths:
|
||||
$ref: '#/responses/500'
|
||||
/search:
|
||||
get:
|
||||
summary: 'Search for projects, repositories and helm charts'
|
||||
summary: 'Search for projects and repositories'
|
||||
description: |-
|
||||
The Search endpoint returns information about the projects, repositories and helm charts offered at public status or related to the current logged in user. The response includes the project, repository list and charts in a proper display order.
|
||||
The Search endpoint returns information about the projects and repositories offered at public status or related to the current logged in user. The response includes the project and repository list in a proper display order.
|
||||
parameters:
|
||||
- $ref: '#/parameters/requestId'
|
||||
- name: q
|
||||
@ -6206,13 +6206,6 @@ definitions:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/SearchRepository'
|
||||
chart:
|
||||
description: Search results of the charts that macthed the filter keywords.
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/SearchResult'
|
||||
x-omitempty: true
|
||||
x-isnullable: true
|
||||
SearchRepository:
|
||||
type: object
|
||||
properties:
|
||||
@ -6234,93 +6227,6 @@ definitions:
|
||||
artifact_count:
|
||||
type: integer
|
||||
description: The count of artifacts in the repository
|
||||
SearchResult:
|
||||
type: object
|
||||
description: The chart search result item
|
||||
properties:
|
||||
Name:
|
||||
type: string
|
||||
description: The chart name with repo name
|
||||
Score:
|
||||
type: integer
|
||||
description: The matched level
|
||||
Chart:
|
||||
$ref: '#/definitions/ChartVersion'
|
||||
ChartVersion:
|
||||
type: object
|
||||
description: A specified chart entry
|
||||
allOf:
|
||||
- $ref: '#/definitions/ChartMetadata'
|
||||
- type: object
|
||||
properties:
|
||||
created:
|
||||
type: string
|
||||
description: The created time of the chart entry
|
||||
removed:
|
||||
type: boolean
|
||||
description: A flag to indicate if the chart entry is removed
|
||||
digest:
|
||||
type: string
|
||||
description: The digest value of the chart entry
|
||||
urls:
|
||||
type: array
|
||||
description: The urls of the chart entry
|
||||
items:
|
||||
type: string
|
||||
properties:
|
||||
labels:
|
||||
type: array
|
||||
description: A list of label
|
||||
items:
|
||||
$ref: '#/definitions/Label'
|
||||
ChartMetadata:
|
||||
type: object
|
||||
description: The metadata of chart version
|
||||
required:
|
||||
- name
|
||||
- version
|
||||
- engine
|
||||
- icon
|
||||
- apiVersion
|
||||
- appVersion
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: The name of the chart
|
||||
home:
|
||||
type: string
|
||||
description: The URL to the relevant project page
|
||||
sources:
|
||||
type: array
|
||||
description: The URL to the source code of chart
|
||||
items:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
description: A SemVer 2 version of chart
|
||||
description:
|
||||
type: string
|
||||
description: A one-sentence description of chart
|
||||
keywords:
|
||||
type: array
|
||||
description: A list of string keywords
|
||||
items:
|
||||
type: string
|
||||
engine:
|
||||
type: string
|
||||
description: The name of template engine
|
||||
icon:
|
||||
type: string
|
||||
description: The URL to an icon file
|
||||
apiVersion:
|
||||
type: string
|
||||
description: The API version of this chart
|
||||
appVersion:
|
||||
type: string
|
||||
description: The version of the application enclosed in the chart
|
||||
deprecated:
|
||||
type: boolean
|
||||
description: Whether or not this chart is deprecated
|
||||
Repository:
|
||||
type: object
|
||||
properties:
|
||||
@ -6956,10 +6862,6 @@ definitions:
|
||||
type: integer
|
||||
description: The number of the repositories under this project.
|
||||
x-omitempty: false
|
||||
chart_count:
|
||||
type: integer
|
||||
description: The total number of charts under this project.
|
||||
x-omitempty: false
|
||||
metadata:
|
||||
description: The metadata of the project.
|
||||
$ref: '#/definitions/ProjectMetadata'
|
||||
@ -7017,10 +6919,6 @@ definitions:
|
||||
type: integer
|
||||
description: The number of the repositories under this project.
|
||||
x-omitempty: false
|
||||
chart_count:
|
||||
type: integer
|
||||
description: The total number of charts under this project.
|
||||
x-omitempty: false
|
||||
project_admin_count:
|
||||
type: integer
|
||||
description: The total number of project admin members.
|
||||
|
@ -9,13 +9,7 @@ ARG npm_registry=https://registry.npmjs.org
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends python-yaml
|
||||
|
||||
COPY src/portal/package.json /build_dir
|
||||
COPY src/portal/package-lock.json /build_dir
|
||||
COPY src/portal/scripts /build_dir
|
||||
COPY ./api/v2.0/legacy_swagger.yaml /build_dir/swagger.yaml
|
||||
COPY ./api/v2.0/swagger.yaml /build_dir/swagger2.yaml
|
||||
COPY ./api/swagger.yaml /build_dir/swagger3.yaml
|
||||
|
||||
COPY ./api/v2.0/swagger.yaml /build_dir/swagger.yaml
|
||||
COPY src/portal /build_dir
|
||||
|
||||
ENV NPM_CONFIG_REGISTRY=${npm_registry}
|
||||
@ -23,10 +17,7 @@ RUN npm install --unsafe-perm
|
||||
RUN npm run generate-build-timestamp
|
||||
RUN node --max_old_space_size=2048 'node_modules/@angular/cli/bin/ng' build --configuration production
|
||||
RUN python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)' < swagger.yaml > dist/swagger.json
|
||||
RUN python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)' < swagger2.yaml > dist/swagger2.json
|
||||
RUN python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)' < swagger3.yaml > dist/swagger3.json
|
||||
|
||||
RUN cp swagger.yaml dist
|
||||
COPY ./LICENSE /build_dir/dist
|
||||
|
||||
RUN cd app-swagger-ui && npm install --unsafe-perm
|
||||
@ -36,7 +27,6 @@ FROM ${harbor_base_namespace}/harbor-portal-base:${harbor_base_image_version}
|
||||
|
||||
COPY --from=nodeportal /build_dir/dist /usr/share/nginx/html
|
||||
COPY --from=nodeportal /build_dir/app-swagger-ui/dist /usr/share/nginx/html
|
||||
COPY --from=nodeportal /build_dir/package*.json /usr/share/nginx/
|
||||
|
||||
VOLUME /var/cache/nginx /var/log/nginx /run
|
||||
|
||||
|
@ -6,23 +6,16 @@ const helpInfo =
|
||||
' please logout Harbor first or manually delete the cookies under the current domain.';
|
||||
const SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS', 'TRACE'];
|
||||
|
||||
// get swagger.json and swagger2.json from portal container then render swagger ui
|
||||
// get swagger.json from portal container then render swagger ui
|
||||
// before rendering, the ui shows a loading style
|
||||
Promise.all([
|
||||
fetch('/swagger.json').then(value => value.json()),
|
||||
fetch('/swagger2.json').then(value => value.json())
|
||||
])
|
||||
.then(value => {
|
||||
// merger swagger.json and swagger2.json
|
||||
const json = {};
|
||||
mergeDeep(json, value[0], value[1]);
|
||||
json['host'] = window.location.host;
|
||||
const protocal = window.location.protocol;
|
||||
json['schemes'] = [protocal.replace(':', '')];
|
||||
json.info.description = json.info.description + helpInfo;
|
||||
fetch('/swagger.json').then(value => value.json()).then(res => {
|
||||
res['host'] = window.location.host;
|
||||
const protocal = window.location.protocol;
|
||||
res['schemes'] = [protocal.replace(':', '')];
|
||||
res.info.description = res.info.description + helpInfo;
|
||||
// start to render
|
||||
SwaggerUI({
|
||||
spec: json,
|
||||
spec: res,
|
||||
dom_id: '#swagger-ui-container',
|
||||
deepLinking: true,
|
||||
presets: [SwaggerUI.presets.apis],
|
||||
@ -60,34 +53,3 @@ Promise.all([
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function mergeDeep(target, ...sources) {
|
||||
if (!sources.length) {
|
||||
return target;
|
||||
}
|
||||
const source = sources.shift();
|
||||
|
||||
if (isObject(target) && isObject(source)) {
|
||||
for (const key in source) {
|
||||
if (isObject(source[key])) {
|
||||
if (!target[key]) {
|
||||
Object.assign(target, { [key]: {} });
|
||||
}
|
||||
mergeDeep(target[key], source[key]);
|
||||
} else {
|
||||
Object.assign(target, { [key]: source[key] });
|
||||
}
|
||||
}
|
||||
}
|
||||
return mergeDeep(target, ...sources);
|
||||
}
|
||||
|
||||
function isObject(item) {
|
||||
return item && typeof item === 'object' && !Array.isArray(item);
|
||||
}
|
||||
|
@ -3,9 +3,8 @@ FROM node:16.10.0 as builder
|
||||
WORKDIR /build_dir
|
||||
|
||||
COPY src/portal /build_dir
|
||||
COPY api/v2.0/legacy_swagger.yaml /build_dir/swagger.yaml
|
||||
COPY api/v2.0/swagger.yaml /build_dir/swagger2.yaml
|
||||
COPY api/swagger.yaml /build_dir/swagger3.yaml
|
||||
COPY api/v2.0/swagger.yaml /build_dir/swagger.yaml
|
||||
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends python-yaml
|
||||
@ -14,11 +13,6 @@ RUN npm run postinstall
|
||||
RUN npm run generate-build-timestamp
|
||||
RUN node --max_old_space_size=2048 'node_modules/@angular/cli/bin/ng' build --configuration production
|
||||
RUN python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)' < swagger.yaml > dist/swagger.json
|
||||
RUN python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)' < swagger2.yaml > dist/swagger2.json
|
||||
RUN python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)' < swagger3.yaml > dist/swagger3.json
|
||||
|
||||
COPY LICENSE /build_dir/dist
|
||||
|
||||
RUN cd app-swagger-ui && npm install --unsafe-perm
|
||||
RUN cd app-swagger-ui && npm run build
|
||||
|
||||
|
@ -3,15 +3,16 @@
|
||||
1.npm install js-yaml --save-dev
|
||||
2.npm install ng-swagger-gen --save-dev
|
||||
*/
|
||||
//configuration
|
||||
//configuration. For dev build, the input path is '../../api/v2.0/swagger.yaml'
|
||||
let inputFile = '../../api/v2.0/swagger.yaml';
|
||||
const outputDir = 'ng-swagger-gen';
|
||||
|
||||
//convert swagger.yaml to swagger.json
|
||||
const yaml = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
if (fs.existsSync('swagger2.yaml')) {
|
||||
inputFile = 'swagger2.yaml';
|
||||
//when building portal container(production build), the input path is './swagger.yaml'. Refer to portal Dockerfile
|
||||
if (fs.existsSync('swagger.yaml')) {
|
||||
inputFile = 'swagger.yaml';
|
||||
}
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
fs.mkdirSync(outputDir);
|
||||
|
@ -17,14 +17,12 @@ describe('ListProjectROComponent', () => {
|
||||
let fixture: ComponentFixture<TestHostComponent>;
|
||||
const mockedProjects: Project[] = [
|
||||
{
|
||||
chart_count: 0,
|
||||
name: 'test1',
|
||||
metadata: {},
|
||||
project_id: 1,
|
||||
repo_count: 1,
|
||||
},
|
||||
{
|
||||
chart_count: 0,
|
||||
name: 'test2',
|
||||
metadata: {},
|
||||
project_id: 2,
|
||||
|
Loading…
Reference in New Issue
Block a user