-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] CCCP API server #656
Conversation
4ab9d20
to
f46fea6
Compare
Looks really cool. We just update the appropriate controllers :) |
44cd9f2
to
5e81471
Compare
# from ccp.apis.server.ccp_server.models.all_scanner_logs import AllScannerLogs | ||
# from ccp.apis.server.ccp_server.models.app_id_job_id_tag import AppIdJobIdTag | ||
# from ccp.apis.server.ccp_server.models.app_id_job_id_tags import AppIdJobIdTags | ||
# from ccp.apis.server.ccp_server.models.build_logs import BuildLogs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are all these imports commented ?
@mohammedzee1000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were causing error, once i updated the references. The errors failed once i removed these imports and the server works fine.
Need to still figure out what happened there
ProjectMetadata # noqa: E501 | ||
from ccp.apis.server.ccp_server.models.target_file import\ | ||
TargetFile # noqa: E501 | ||
from ccp.apis.server.ccp_server.test import BaseTestCase | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for this change.
@@ -17,10 +17,14 @@ ENV PYTHONPATH="/opt/ccp_api_server" | |||
|
|||
COPY . /opt/ccp_api_server | |||
|
|||
RUN useradd 1001 && usermod -aG 0 1001 && chown 1001:0 /opt/ccp_api_server && chmod -R g+x /opt/ccp_api_server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chown -R 1001:0 /opt/ccp_api_server
We need to change the permissions to root and all subsequent dirs recursively in that repo, WDYT ?
@mohammedzee1000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a problem, but to be safe, yea, i guess it makes sense
@@ -17,10 +17,14 @@ ENV PYTHONPATH="/opt/ccp_api_server" | |||
|
|||
COPY . /opt/ccp_api_server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking, now that /opt/ccp_api_server
hosts the complete service code, we should name it as our service repo name or ccp-openshift
as we did in slave container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did right from the start
9c709d6
to
6d37300
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review is only for the swagger.yaml file.
- Do we really need to put server code into
ccp/apis/v1/server/ccp_server
. Isccp/apis/v1/server
not enough? I can't think of another server being written for these APIs. - Ending this review early because of the api endpoints of the format
/namespace/{namespace}/app-id/{app_id}/job-id/{job_id}/desired-tag/{desired_tag}
. I think we had discussed to go with something liker.c.o/api/v1/{app_id}/{job_id}/{desired_tag}
. Not sure why we're havingnamespace
here and why we're making the URLs longer by doing/app-id/{app_id}/job-id/{job_id}/desired-tag/{desired_tag}
basePath: "/api/v1/" | ||
tags: | ||
- name: "infra" | ||
description: "APIs serving infra related information as liveness, help." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/infra/infrastructure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are liveness
and help
two examples of the kind of information being served? Below sounds more appropriate in that case:
'APIs serving infrastructure related information such as liveness, help.'
- name: "infra" | ||
description: "APIs serving infra related information as liveness, help." | ||
- name: "meta" | ||
description: "APIs serving meta information for projects, namespaces, etc." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/meta/metadata
schema: | ||
$ref: "#/definitions/Namespaces" | ||
x-swagger-router-controller: "ccp_server.controllers.meta_controller" | ||
/namespace/{namespace}/projects: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By namespace, do we mean an OpenShift namespace? At the moment, we have only one OpenShift namespace. So how does having this API endpoint help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, do we want to have /namespaces
and /namespace/{namespace}/projects
separate? There's a missing s
in namespace
in the latter. Or do we mean these two endpoints:
/namespaces
/namespaces/{namespace}/projects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once again, only reviewing the swagger.yaml
file because, IIUC, that's the base for rest of the 3,500+ lines of code in this PR.
- Can we please use fewer abbreviations like
info
,meta
, etc. for documentation (I can't find a better word for theyaml
specification) and use the full words instead? - Do we really need
/namespace/{namespace]/
? We are having only one namespace in OpenShift at the moment. Yes, we discussed having separate namespaces for projects and their weekly scan builds but that's not in place at the moment. Is it a good idea to have provision for something in the API that's not yet implemented? - Without deciding if we want to fetch details for all builds/weekly-scan build or only for the latest success/failure, we're going to add more logic to the backend or API (wherever we decide to process things.) Is this really required? We could modify the API endpoints and resulting backend functions to just fetch the latest success and failure results, no?
get: | ||
tags: | ||
- "builds" | ||
summary: "Get all the builds info for given project" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Get information for all builds of the given project" sounds more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember we discussed having only the latest failure and success builds. Does this API endpoint assume otherwise? I think that goes into the def project_builds()
function but just raising it so that it's discussed.
tags: | ||
- "builds" | ||
summary: "Get all the builds info for given project" | ||
description: "Get all the builds number, name and status for given project" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Get build number, name and status of all builds for the given project" sounds appropriate.
99eb0b4
to
da0d5ad
Compare
This changeset adds flask implementation of CCP readonly APIs. The API server skeleton is generated by swagger <https://swagger.io/> OpenAPI implementation framework using swagger YAML API specifications. Added Dockerfile for API server at Dockerfiles/ccp-api-server/Dockerfile, which will containerize the API server and start it.
This commit adds backend module structure for wiring up the responses for each API response to respective python module file in logical API group (infra, meta, projects, builds). All of the logical API group are further grouped as per API versioning, i.e. v1 here.
in api-server container, also updates it in env_config.py
…pi-server Also parameterize the needed values in it.
removes the unnecessary server/ module
also fixes typo in swagger.yaml
merged this in #668 |
This changeset adds flask implementation of CCP readonly APIs.
The API server skeleton is generated by swagger https://swagger.io/
OpenAPI implementation framework using swagger YAML API specifications.
Added Dockerfile for API server at Dockerfiles/ccp-api-server/Dockerfile,
which will containerize the API server and start it.