Skip to content

dependabot-dance: new tool for managing revendor PRs#7465

Merged
openshift-merge-robot merged 1 commit into
containers:masterfrom
edsantiago:dependabot_dance
Sep 17, 2020
Merged

dependabot-dance: new tool for managing revendor PRs#7465
openshift-merge-robot merged 1 commit into
containers:masterfrom
edsantiago:dependabot_dance

Conversation

@edsantiago
Copy link
Copy Markdown
Member

dependabot seems to submit PRs without running 'make vendor'.
This script automates (with some safety checks) the manual
process for pulling the PR, running 'make vendor-in-container',
and force-pushing the PR.

Usage: ./contrib/dependabot-dance PR-NUMBER

It should take care of identifying your github repo, pulling
the PR, running the make, git-add and commit under vendor (or,
if nothing changed, aborting), then git-pushing.

Signed-off-by: Ed Santiago santiago@redhat.com

@edsantiago
Copy link
Copy Markdown
Member Author

@rhatdan PTAL. I tested with #7421 and #7422, it ran all the steps up until "No files changed under 'vendor' -- nothing to do, aborting"

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Aug 27, 2020

/approve
LGTM

I will pull this and replace the one I have been using to try it out.

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 27, 2020
@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Aug 27, 2020

One problem I have with this is, I often go into a repo and manually do a
git pull --all, and then do

dependabot-dance dependabot/go_modules/github.com/containers/storage-1.23.2

Which switches to each new dependabot.

I always thought a good new feature would be to enhance the script to run this automatically.

IE
git checkout master
dependabots=$(git pull --all | grep dependabot)
for id in $dependabot {
dance
}

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Aug 27, 2020

I also want to use this tool for more then just podman, I use it for storage, common, buildah, podman, skopeo ...

@edsantiago
Copy link
Copy Markdown
Member Author

/hold

looks like I deeply misunderstood the way this is intended to be invoked.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 27, 2020
@vrothberg
Copy link
Copy Markdown
Member

See dependabot/dependabot-core#670 for an upstream issue.

@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago, rhatdan

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

@edsantiago
Copy link
Copy Markdown
Member Author

@rhatdan could you please download and try the latest copy?

(It worked for me on containers/storage#720, up to the git-push, which failed because I have no privs on that repo).

Usage is now: dependabot-dance (no args)

Code flow is now:

  • remove all dependabot branches, before we:
  • git pull --all; then
  • (check to make sure there are no git-modified files, that would be bad); then
  • for each dependabot/go_modules/ branch; do
    ** check out branch
    ** make vendor-in-container
    ** if nothing changed, bail out peacefully
    ** git add, git commit --amend -s, git push --force
    ** clean up

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Sep 17, 2020

Ok I tried this out on Podman today, and it worked for two dependabots, but it also got confused by some old dependabot branches in my repo. IE I had not destroyed all of my branches after I had updated.

I think if I have a clean dependabot git branch then this will work fine. Since these branches are just there because of my previous way of running it, I would say this looks good.

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Sep 17, 2020

BTW, I think this PR needs to be rebased. It should not include the APIV2 stuff?

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Sep 17, 2020

I tried to run this command on Buildah, which had no dependabots available and it pulls down an old one and fails.

$ dependabot-dance
Deleted remote-tracking branch origin/dependabot/go_modules/github.com/containers/common-0.22.0 (was 7276a654).
Deleted remote-tracking branch origin/dependabot/go_modules/github.com/containers/image/v5-5.4.1 (was a4b593ac).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/containers/common-0.11.3 (was cc458689).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/containers/common-0.15.2 (was 9fb931ca).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/containers/image/v5-5.2.1 (was b34b932b).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/containers/image/v5-5.3.0 (was 54c40b31).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/containers/image/v5-5.4.1 (was a4b593ac).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/containers/storage-1.16.3 (was 0e529877).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/containers/storage-1.21.0 (was cbc6c8a1).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/onsi/ginkgo-1.10.2 (was 320e67f1).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/onsi/ginkgo-1.12.0 (was 74addde4).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/onsi/ginkgo-1.13.0 (was 743b6623).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/onsi/ginkgo-1.14.0 (was 7a74de8d).
Deleted remote-tracking branch rhatdan/dependabot/go_modules/github.com/onsi/gomega-1.7.1 (was c6d23998).
Fetching origin
From github.com:containers/buildah
 * [new branch]        dependabot/go_modules/github.com/containers/common-0.22.0  -> origin/dependabot/go_modules/github.com/containers/common-0.22.0
 * [new branch]        dependabot/go_modules/github.com/containers/image/v5-5.4.1 -> origin/dependabot/go_modules/github.com/containers/image/v5-5.4.1
Fetching rhatdan
From github.com:rhatdan/buildah
 * [new branch]        dependabot/go_modules/github.com/containers/common-0.11.3  -> rhatdan/dependabot/go_modules/github.com/containers/common-0.11.3
 * [new branch]        dependabot/go_modules/github.com/containers/common-0.15.2  -> rhatdan/dependabot/go_modules/github.com/containers/common-0.15.2
 * [new branch]        dependabot/go_modules/github.com/containers/image/v5-5.2.1 -> rhatdan/dependabot/go_modules/github.com/containers/image/v5-5.2.1
 * [new branch]        dependabot/go_modules/github.com/containers/image/v5-5.3.0 -> rhatdan/dependabot/go_modules/github.com/containers/image/v5-5.3.0
 * [new branch]        dependabot/go_modules/github.com/containers/image/v5-5.4.1 -> rhatdan/dependabot/go_modules/github.com/containers/image/v5-5.4.1
 * [new branch]        dependabot/go_modules/github.com/containers/storage-1.16.3 -> rhatdan/dependabot/go_modules/github.com/containers/storage-1.16.3
 * [new branch]        dependabot/go_modules/github.com/containers/storage-1.21.0 -> rhatdan/dependabot/go_modules/github.com/containers/storage-1.21.0
 * [new branch]        dependabot/go_modules/github.com/onsi/ginkgo-1.10.2        -> rhatdan/dependabot/go_modules/github.com/onsi/ginkgo-1.10.2
 * [new branch]        dependabot/go_modules/github.com/onsi/ginkgo-1.12.0        -> rhatdan/dependabot/go_modules/github.com/onsi/ginkgo-1.12.0
 * [new branch]        dependabot/go_modules/github.com/onsi/ginkgo-1.13.0        -> rhatdan/dependabot/go_modules/github.com/onsi/ginkgo-1.13.0
 * [new branch]        dependabot/go_modules/github.com/onsi/ginkgo-1.14.0        -> rhatdan/dependabot/go_modules/github.com/onsi/ginkgo-1.14.0
 * [new branch]        dependabot/go_modules/github.com/onsi/gomega-1.7.1         -> rhatdan/dependabot/go_modules/github.com/onsi/gomega-1.7.1
Already up to date.

>>>>> origin/dependabot/go_modules/github.com/containers/common-0.22.0
+ git checkout -t origin/dependabot/go_modules/github.com/containers/common-0.22.0
Branch 'dependabot/go_modules/github.com/containers/common-0.22.0' set up to track remote branch 'dependabot/go_modules/github.com/containers/common-0.22.0' from 'origin'.
Switched to a new branch 'dependabot/go_modules/github.com/containers/common-0.22.0'
+ set +x
dependabot-dance: Author of pr/ is 'Daniel J Walsh' (expected 'dependabot')

@edsantiago
Copy link
Copy Markdown
Member Author

pulls down an old one and fails.
...
dependabot-dance: Author of pr/ is 'Daniel J Walsh' (expected 'dependabot')

It's easy to remove the git-author check, of course; but what is the right thing to do? Is there a way to clean up the old branches?

@edsantiago edsantiago force-pushed the dependabot_dance branch 2 times, most recently from 39ccedd to f772314 Compare September 17, 2020 11:20
@edsantiago
Copy link
Copy Markdown
Member Author

Rebased, and updated so the author check will issue a "Continue?" prompt

dependabot seems to submit PRs without running 'make vendor'.
This script automates (with some safety checks) the manual
process for pulling the PR, running 'make vendor-in-container',
and force-pushing the PR.

Usage: ./contrib/dependabot-dance

It should take care of identifying your github repo, finding
all active dependabot branches, running the make, git-add,
and commit, then git-pushing.

Signed-off-by: Ed Santiago <santiago@redhat.com>
@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Sep 17, 2020

I do
git branch | grep dependa | xargs git branch -D

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Sep 17, 2020

Actually I ran this again, and it is working pretty well.

@TomSweeneyRedHat
Copy link
Copy Markdown
Member

LGTM
I didn't actually run it though.
Tests looked to have had a hiccup, I've re-ran

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Sep 17, 2020

This works pretty good, so I think we merge and then fix it going forward.
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2020
@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Sep 17, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2020
@openshift-merge-robot openshift-merge-robot merged commit 99015f8 into containers:master Sep 17, 2020
@edsantiago edsantiago deleted the dependabot_dance branch September 17, 2020 20:17
@github-actions github-actions Bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 24, 2023
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. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants