Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Adding build numbers listing #3005

Merged
merged 1 commit into from
Mar 28, 2019

Conversation

krzysied
Copy link
Contributor

Adding listing of available build numbersfor the given job from the Google project's GCS bucket.

ref kubernetes/perf-tests#469

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 27, 2019
@krzysied
Copy link
Contributor Author

/cc @mm4tt

@k8s-ci-robot k8s-ci-robot requested a review from mm4tt March 27, 2019 17:19
@krzysied
Copy link
Contributor Author

/assign @freehan
PTAL

Copy link

@mm4tt mm4tt left a comment

Choose a reason for hiding this comment

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

Thanks, @krzysied!

q := url.Values{}
// GCS api doesn't like preceding '/', so remove it.
q.Set("prefix", strings.TrimPrefix(joinStringsAndInts(pathElements...)+"/", "/"))
q.Set("delimiter", "/")
Copy link

Choose a reason for hiding this comment

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

This method is almost exactly ExpandListUrl, the only difference is this line.
Consider introducing a new method, e.g.

func (b *Bucket) buildUrl(parameters map[string]string) *url.URL {
  q := url.Values{}
  for key, val := range parameters {
    q.Set(key, val)
  }
  return &url.URL{
		Scheme:   b.scheme,
       ...
  }
}

And calling it from ExpandListUrl and ExpandListDirUrl

@@ -218,7 +282,7 @@ func (u *Utils) CheckStartedStatus(job string, buildNumber int) (*StartedFile, e
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
glog.Errorf("Got a non-success response %v while reading data for %v/%v/%v", response.StatusCode, job, buildNumber, "started.json")
return nil, fmt.Errorf("non-success response: %v", response.StatusCode)
return nil, err
Copy link

Choose a reason for hiding this comment

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

Could you update the method documentation as well? This method doesn't return bool (second sentence).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@@ -128,6 +129,35 @@ func (u *Utils) deref(job string, buildNumber int) (directory string, err error)
return out, nil
}

// derefJob reads the file in GCS to figure out where the desired file is. We
Copy link

Choose a reason for hiding this comment

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

I'm not sure if I follow this. Which file it reads? Looks like the method accepts a single string (job) and returns directory. Could you explain what it does in terms of 1) what is input and output 2) how input is transformed to output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realized that this function had no sense. I removed it.

@mm4tt
Copy link

mm4tt commented Mar 28, 2019

/LGTM

I'm not sure if I fully follow the dereferencing logic, but otherwise it looks good.

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2019
@k8s-ci-robot k8s-ci-robot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Mar 28, 2019
Copy link
Contributor

@freehan freehan left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: freehan, krzysied, mm4tt

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2019
@k8s-ci-robot k8s-ci-robot merged commit 8888e4c into kubernetes-retired:master Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. 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.

4 participants