-
Notifications
You must be signed in to change notification settings - Fork 505
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
gcbmgr: add list build jobs #1194
Conversation
@cpanato: Adding label: Reasons for blocking this PR:[Changes to certain release tools can affect our ability to test, build, and release Kubernetes. This PR must be explicitly approved by SIG Release repo admins.] Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
the test is an initial one, we can discuss how to improve it. |
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.
Alright generally LGTM, I just have a few suggestions/nits 👇
|
||
func ListJobs(project string, lastJobs int64) error { | ||
ctx := context.Background() | ||
opts := option.WithCredentialsFile("") |
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.
As a follow up I suggest to wrap this in a new struct like we do in the guthub
package. :)
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.
ok, I will review the github package and apply the same in a follow up.
thanks!
return errors.Wrap(err, "error fetching gcloud credentials... try running \"gcloud auth application-default login\"") | ||
} | ||
|
||
req, err := service.Projects.Builds.List(project).PageSize(lastJobs).Do() |
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.
Is there a maximum value for the page size? If yes, what do we do if we’re requesting more jobs?
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 tried to find in the docs but it does not say anything
https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds/list
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.
Fair, do page sizes > 100 work?
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 did with 301 and returned all 301 last jobs
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.
Sounds good to me, thanks for verifying.
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.
tried with 500 :)
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 think this is not useful but a user can do weird things 😂
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.
What happens on -1
? 😁
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 brings the jobs in the future :P
but looks like it not fail
INFO Listing last -1 GCB jobs:
+--------------------------------+--------------------------------+-----------+---------------------------------------------------------------------------------------------------------------+
| START TIME | FINISH TIME | STATUS | CONSOLE LOGS |
+--------------------------------+--------------------------------+-----------+---------------------------------------------------------------------------------------------------------------+
| 2020-03-17T18:01:39.454011569Z | 2020-03-17T18:18:42.306307Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/66caa764-d21b-465d-95d6-d8b754ed945b?project=648026197307 |
| 2020-03-17T17:05:46.596215978Z | 2020-03-17T17:58:40.563946Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/22413ad5-0e74-4118-98a8-c6a6b776f2e5?project=648026197307 |
| 2020-03-17T16:44:14.493028495Z | 2020-03-17T17:01:08.357092Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/313eaeba-386b-4744-ac5e-de2da0c0ec3a?project=648026197307 |
| 2020-03-17T15:47:22.036533888Z | 2020-03-17T16:39:33.880910Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/f7fb4817-0d2e-40ae-9fed-ec2f4ba90bb6?project=648026197307 |
| 2020-03-17T15:46:59.446635185Z | 2020-03-17T15:48:00.752557291Z | CANCELLED | https://console.cloud.google.com/cloud-build/builds/9283b1b4-e23c-4160-89d1-c9ca7e7cd326?project=648026197307 |
| 2020-03-17T15:41:08.534867366Z | 2020-03-17T15:48:10.707409281Z | CANCELLED | https://console.cloud.google.com/cloud-build/builds/afba1c94-a3b1-4a9f-a025-79549f5bf5f4?project=648026197307 |
| 2020-03-12T23:13:39.983798382Z | 2020-03-12T23:42:05.867161Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/66715bd8-93a2-4000-86e9-ab734b72766a?project=648026197307 |
| 2020-03-12T22:47:12.056531535Z | 2020-03-12T22:47:23.343306181Z | CANCELLED | https://console.cloud.google.com/cloud-build/builds/88acc767-adfe-4ea4-8646-0287b05d5410?project=648026197307 |
| 2020-03-12T22:47:18.045150178Z | 2020-03-12T23:16:03.417070Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/c0cdf52a-d386-4de8-8eaa-c6c31fe86960?project=648026197307 |
| 2020-03-12T22:46:46.270468739Z | 2020-03-12T23:17:50.062883Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/0c33f75a-fe5d-4800-8c93-4864545fc96b?project=648026197307 |
| 2020-03-12T20:56:59.329664144Z | 2020-03-12T23:09:49.748778Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/56dcfb8d-4997-4d80-a26b-d98dcb16354e?project=648026197307 |
| 2020-03-12T20:52:03.334708890Z | 2020-03-12T22:40:16.286748Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/bd24d66d-671f-480f-b940-7dd8e4b195b2?project=648026197307 |
| 2020-03-12T20:49:17.189666168Z | 2020-03-12T22:42:03.250553Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/730e2680-1117-4ceb-b7ee-244ddfc73143?project=648026197307 |
| 2020-03-12T20:25:45.541744471Z | 2020-03-12T20:55:39.045461Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/f4553143-76cf-4302-8f8a-eb378d707755?project=648026197307 |
| 2020-03-12T20:19:33.605482117Z | 2020-03-12T20:46:59.117637Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/3cb43a19-5f65-4540-8eb4-ab6a2b44d1ba?project=648026197307 |
| 2020-03-12T20:18:26.464990013Z | 2020-03-12T20:48:07.174950Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/06b6dbbc-8041-47b1-8e21-38d9a62c917a?project=648026197307 |
| 2020-03-12T18:26:12.101181631Z | 2020-03-12T20:11:08.424601Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/53df157a-1a29-45ae-9ef6-2616cf89d0f4?project=648026197307 |
| 2020-03-12T18:25:17.403597155Z | 2020-03-12T18:25:29.064243395Z | CANCELLED | https://console.cloud.google.com/cloud-build/builds/16b647fc-6609-4a3c-a108-615be37b3477?project=648026197307 |
| 2020-03-12T18:21:02.673580173Z | 2020-03-12T20:24:24.667413Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/2a8c78a4-edd6-4769-8d7e-edb6c5b4062b?project=648026197307 |
| 2020-03-12T18:20:59.567154612Z | 2020-03-12T20:16:06.787010Z | SUCCESS | https://console.cloud.google.com/cloud-build/builds/27e6b98a-c59c-41e6-8f93-b0089a88c95e?project=648026197307 |
+--------------------------------+--------------------------------+-----------+---------------------------------------------------------------------------------------------------------------+
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.
Follow-up: Normalize (set to default count) any non-positive number. Also, log that we're going to do that
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.
/lgtm
Great job, @cpanato! |
@cpanato -- I had a merge party and now this needs a rebase 😝 |
@cpanato: Adding label: Reasons for blocking this PR:[Changes to certain release tools can affect our ability to test, build, and release Kubernetes. This PR must be explicitly approved by SIG Release repo admins.] Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
7d1a8ac
to
7de7619
Compare
done @justaugustus |
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.
@cpanato -- One more thing... can you squash the commits?
I'm seeing merge conflict text between the second and third commit.
@justaugustus done. PTAL |
Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato, justaugustus, saschagrunert 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 |
What type of PR is this?
This PR adds the option to list the last X build jobs
example:
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?