Skip to content

Conversation

@wking
Copy link
Member

@wking wking commented Feb 28, 2019

Builds on #22185; review that first.

This allows devs to link to issues in GitHub or Bugzilla without cluttering up their commit subjects.

interpret-trailers is from 2.2.0. We could re-implement it in Go (maybe someone else already has?), but there are a number of upstream quirks around trailers (preceeding blank lines. Something about unfolding? Maybe more?), so I'd rather lean on existing code if possible.

Sometimes a single pull request will address multiple issues, and
listing them all in a PR subject is not feasible.  With this commit, I
iterate over all commits in the given range (merge or not), but only
return a slice for the first-parent chain (which in most cases will be
a series of merges to master).  For commits that are part of the
retrieved graph but which lie outside the first-parent chain, I find
the nearest first-parent ancestor and attach any referenced issues to
that ancestor.  The new 'issue' structure sets the stage for future
work to also support references to GitHub and other issue stores,
although I haven't added extractors for those yet.

Ordinarily I'd use github.com/pkg/errors for the New() and Errorf()
calls, but for some reason that's forbidden [1]:

  2019/02/28 02:21:57 Inspecting imports under github.com/openshift/origin/pkg/oc...
  2019/02/28 02:21:59 -- validating imports for 129 packages in the tree
  2019/02/28 02:21:59 -- found forbidden imports for github.com/openshift/origin/pkg/oc/cli/admin/release:
  2019/02/28 02:21:59 	 vendor/github.com/pkg/errors

[1]: https://storage.googleapis.com/origin-ci-test/pr-logs/pull/22185/pull-ci-openshift-origin-master-verify/3302/build-log.txt
@openshift-ci-robot openshift-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Feb 28, 2019
This allows devs to link to issues in GitHub or Bugzilla without
cluttering up their commit subjects.  `interpret-trailers` is from
2.2.0 [1].

[1]: https://github.com/git/git/blob/v2.2.0/Documentation/RelNotes/2.2.0.txt#L89-L90
Until our CI suite gets Git 2.2.0 or later and the interpret-trailers
command, so we don't get [1]:

  <testcase name="TestCommitProcess/no_trailers" time="0.01">
    <failure message="=== RUN   TestCommitProcess/no_trailers&#xA;    --- FA ...">=== RUN   TestCommitProcess/no_trailers&#xA;    --- FA ...</failure>
    <system-out>=== RUN   TestCommitProcess/no_trailers&#xA;    --- FAIL: TestCommitProcess/no_trailers (0.01s)&#xA;    &#x9;git_test.go:98: exit status 1&#xA;</system-out>
  </testcase>

once we get a more recent Git (2.2.0 is 2014-11-26!), we can revert
this commit to get Git's more robust handling.

[1]: https://storage.googleapis.com/origin-ci-test/pr-logs/pull/22186/pull-ci-openshift-origin-master-unit/3767/artifacts/unit/unit_report_6x2xq.xml
@wking wking force-pushed the issues-from-trailers branch from ce74acb to ab318eb Compare February 28, 2019 08:44
@wking
Copy link
Member Author

wking commented Feb 28, 2019

The unit failures:

    <testcase name="TestCommitProcess/no_trailers" time="0.01">
      <failure message="=== RUN   TestCommitProcess/no_trailers&#xA;    --- FA ...">=== RUN   TestCommitProcess/no_trailers&#xA;    --- FA ...</failure>
      <system-out>=== RUN   TestCommitProcess/no_trailers&#xA;    --- FAIL: TestCommitProcess/no_trailers (0.01s)&#xA;    &#x9;git_test.go:98: exit status 1&#xA;</system-out>
    </testcase>

are probably because the test container's git predates 2.2.0. I've pushed ce74acb -> ab318eb to replace the interpret-trailers hack with a rough local Go implementation that addresses the easy case, but misses some of the finer points.

@soltysh
Copy link
Contributor

soltysh commented Mar 4, 2019

We'll need to properly document this pattern for commit messages, possibly with a handy git template to be copied 😉

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

This overall lgtm, let's get a closure on #22185 and we can get this one in.

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: soltysh, wking

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

The pull request process is described here

Details 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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 4, 2019
@openshift-ci-robot
Copy link

@wking: PR needs rebase.

Details

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.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 13, 2019
@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 11, 2019
@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci-robot openshift-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 11, 2019
@openshift-bot
Copy link
Contributor

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci-robot
Copy link

@openshift-bot: Closed this PR.

Details

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants