Skip to content
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

Fix the API for getting devops project #435

Merged
merged 2 commits into from
Jan 12, 2022

Conversation

LinuxSuRen
Copy link
Member

@LinuxSuRen LinuxSuRen commented Jan 7, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

Currently, the UI try to use this API to find if the desired name is duplicated. But for DevOpsProject, we should use the generateName instead of the resource real name.

Which issue(s) this PR fixes:

Fixes #

This PR should be able to fix part of #635

Special notes for reviewers:

surenpi/devops-apiserver:dev-v3.2.1-0740803

Does this PR introduce a user-facing change??

Fix the API for getting devops project

Test results

image

image

/cc @kubesphere/sig-devops

@ks-ci-bot ks-ci-bot requested a review from a team January 7, 2022 15:54
@ks-ci-bot ks-ci-bot added release-note kind/bug Categorizes issue or PR as related to a bug. labels Jan 7, 2022
@ks-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LinuxSuRen

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ks-ci-bot ks-ci-bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 7, 2022
@LinuxSuRen
Copy link
Member Author

I'm not sure if there are other purposes for this API. So I will do more tests on it.
/hold

@codecov
Copy link

codecov bot commented Jan 7, 2022

Codecov Report

Merging #435 (39bce37) into master (83760ce) will increase coverage by 1.22%.
The diff coverage is 82.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     kubesphere/console#435      +/-   ##
==========================================
+ Coverage   75.46%   76.69%   +1.22%     
==========================================
  Files         108      108              
  Lines       22314    22022     -292     
==========================================
+ Hits        16840    16889      +49     
+ Misses       5309     4960     -349     
- Partials      165      173       +8     
Flag Coverage Δ
unittests 76.69% <82.00%> (+1.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/kapis/devops/v1alpha3/handler.go 63.42% <72.72%> (+18.85%) ⬆️
pkg/kapis/devops/v1alpha3/register.go 100.00% <100.00%> (ø)
pkg/models/devops/devops.go 19.33% <100.00%> (+6.94%) ⬆️
controllers/s2irun/s2irun_controller.go 33.57% <0.00%> (-3.65%) ⬇️
...rs/devopscredential/devopscredential_controller.go 33.10% <0.00%> (-3.38%) ⬇️
pkg/kapis/oauth/register.go 100.00% <0.00%> (ø)
pkg/client/devops/jenkins/jenkins.go 0.00% <0.00%> (ø)
pkg/client/devops/jenkins/project.go 0.00% <0.00%> (ø)
controllers/pipeline/pipeline_controller.go 38.23% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83760ce...39bce37. Read the comment docs.

@LinuxSuRen
Copy link
Member Author

/unhold

@LinuxSuRen
Copy link
Member Author

/hold

@LinuxSuRen LinuxSuRen force-pushed the fix-get-devops-project branch from 1ef78b9 to a2fb9c9 Compare January 10, 2022 05:57
@LinuxSuRen
Copy link
Member Author

LinuxSuRen commented Jan 10, 2022

/unhold

Some changes for API /workspaces/{workspace}/devops/{devops}:

  • query the DevOpsProject via generateName of the Kubernetes resource if ?generateName=true
  • query the real name of the Kubernetes resource for other cases

func (h *devopsHandler) GetDevOpsProject(request *restful.Request, response *restful.Response) {
workspace := request.PathParameter("workspace")
devops := request.PathParameter("devops")
devopsProject := request.PathParameter("devops")
generateNameFlag := request.QueryParameter("generateName")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary. We can use xx == 'true'

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LinuxSuRen LinuxSuRen merged commit 098e587 into kubesphere:master Jan 12, 2022
@LinuxSuRen LinuxSuRen deleted the fix-get-devops-project branch January 12, 2022 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. release-note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants