Giter Club home page Giter Club logo

bulldozer's Introduction

bulldozer

Docker Pulls

bulldozer is a GitHub App that automatically merges pull requests (PRs) when (and only when) all required status checks are successful and required reviews are provided.

Additionally, bulldozer can:

  • Only merge pull requests that match certain conditions, like having a specific label or comment
  • Ignore pull requests that match certain conditions, like having a specific label or comment
  • Automatically keep pull request branches up-to-date by merging in the target branch
  • Wait for additional status checks that are not required by GitHub

Bulldozer might be useful if you:

  • Have CI builds that take longer than the normal review process. It will merge reviewed PRs as soon as the tests pass so you don't have to watch the pull request or remember to merge it later.
  • Combine it with policy-bot to automatically merge certain types of pre-approved or automated changes.
  • Want to give contributors more control over when they can merge PRs without granting them write access to the repository.
  • Have a lot of active development that makes it difficult to merge a pull request while it is up-to-date with the target branch.

Contents

Behavior

bulldozer will only merge pull requests that GitHub allows non-admin collaborators to merge. This means that all branch protection settings, including required status checks and required reviews, are respected. It also means that you must enable branch protection to prevent bulldozer from immediately merging every pull request.

Only pull requests matching the trigger conditions (or not matching ignore conditions) are considered for merging. bulldozer is event-driven, which means it will usually merge a pull request within a few seconds of the pull request satisfying all preconditions.

Configuration

The behavior of the bot is configured by a .bulldozer.yml file at the root of the repository. The file name and location are configurable when running your own instance of the server.

  • The file is read from the most recent commit on the target branch of each pull request.

  • The file may contain a reference to a configuration in a different repository (see Remote Configuration.)

  • If the file does not exist in the repository, bulldozer tries to load a shared bulldozer.yml file at the root of the .github repository in the same organization. You can change this path and repository name when running your own instance of the server.

  • You can also define a global default configuration when running your own instance of the server. This is used if the repository or the shared organization repository do not define any configuration.

  • If configuration does not exist in the repository or in the shared organization repository and the server does not have a default configuration, bulldozer does not act on the pull request. This means it is safe to enable bulldozer on all repositories in an organization.

bulldozer.yml Specification

The .bulldozer.yml file supports the following keys.

# "version" is the configuration version, currently "1".
version: 1

# "merge" defines how and when pull requests are merged. If the section is
# missing, bulldozer will consider all pull requests and use default settings.
merge:
  # "trigger" defines the set of pull requests considered by bulldozer. If
  # the section is missing, bulldozer considers all pull requests not excluded
  # by the ignore conditions.
  trigger:
    # Pull requests with any of these labels (case-insensitive) are added to
    # the trigger.
    labels: ["merge when ready"]

    # Pull requests where the body or any comment contains any of these
    # substrings are added to the trigger.
    comment_substrings: ["==MERGE_WHEN_READY=="]

    # Pull requests where any comment matches one of these exact strings are
    # added to the trigger.
    comments: ["Please merge this pull request!"]

    # Pull requests where the body contains any of these substrings are added
    # to the trigger.
    pr_body_substrings: ["==MERGE_WHEN_READY=="]

    # Pull requests targeting any of these branches are added to the trigger.
    branches: ["develop"]

    # Pull requests targeting branches matching any of these regular expressions are added to the trigger.
    branch_patterns: ["feature/.*"]

    # Pull requests with auto merge enabled are added to the trigger.
    auto_merge: true

  # "ignore" defines the set of pull request ignored by bulldozer. If the
  # section is missing, bulldozer considers all pull requests. It takes the
  # same keys as the "trigger" section.
  ignore:
    labels: ["do not merge"]
    comment_substrings: ["==DO_NOT_MERGE=="]

  # "method" defines the merge method. The available options are "merge",
  # "rebase", "squash", and "ff-only".
  method: squash

  ##### branch_method has been DEPRECATED in favor of merge_method #####
  # 
  # Allows the merge method that is used when auto-merging a PR to be different
  # target branch. The keys of the hash are the target branch name, and the values are the merge method that
  # will be used for PRs targeting that branch. The valid values are the same as for the "method" key.
  # Note: If the target branch does not match any of the specified keys, the "method" key is used instead.
  branch_method:
    develop: squash
    master: merge
  ##### branch_method has been DEPRECATED in favor of merge_method #####

  # Allows the merge method that is used when auto-merging a PR to be different
  # based on trigger criteria. The first method where ALL triggers match will
  # be used. Otherwise, the method specified previously in "merge.method" will 
  # be used.
  # - ALL trigger criteria must match, unlike merge/trigger where ANY match 
  # will trigger bulldozer.
  # - This will override any branch_method logic if one of the methods is
  # triggered
  # - If no trigger criteria is provided the method is ignored
  merge_method:
    # "method" defines the merge method. The available options are "merge",
    # "rebase", "squash", and "ff-only".
    - method: squash
      trigger:
        # All methods from merge/trigger are supported. Additionally, the
        # following additional methods are provided:

        # Pull requests which a number of commits less than or equal to this value are added to the trigger.
        max_commits: 3

  # "options" defines additional options for the individual merge methods.
  options:
    # "squash" options are only used when the merge method is "squash"
    squash:
      # "title" defines how the title of the commit message is created when
      # generating a squash commit. The options are "pull_request_title",
      # "first_commit_title", and "github_default_title". The default is
      # "pull_request_title".
      title: "pull_request_title"

      # "body" defines how the body of the commit message is created when
      # generating a squash commit. The options are "pull_request_body",
      # "summarize_commits", and "empty_body". The default is "empty_body".
      body: "empty_body"

      # If "body" is "pull_request_body", then the commit message will be the
      # part of the pull request body surrounded by "message_delimiter"
      # strings. This is disabled (empty string) by default.
      message_delimiter: ==COMMIT_MSG==

  # "required_statuses" is a list of additional status contexts that must pass
  # before bulldozer can merge a pull request. This is useful if you want to
  # require extra testing for automated merges, but not for manual merges.
  required_statuses:
    - "ci/circleci: ete-tests"

  # If true, bulldozer will delete branches after their pull requests merge.
  delete_after_merge: true

  # If true, bulldozer will merge pull requests with no required checks. This
  # helps to protect against merging branches which inadvertently do not have
  # required status checks.
  allow_merge_with_no_checks: false

# "update" defines how and when to update pull request branches. Unlike with
# merges, if this section is missing, bulldozer will not update any pull requests.
update:
  # "trigger" defines the set of pull requests that should be updated by
  # bulldozer. It accepts the same keys as the trigger in the "merge" block.
  trigger:
    labels: ["WIP", "Update Me"]

  # "ignore" defines the set of pull requests that should not be updated by
  # bulldozer. It accepts the same keys as the ignore in the "merge" block.
  ignore:
    labels: ["Do Not Update"]

  # If true, bulldozer will ignore updating draft pull requests, unless they
  # explicitly match a configured trigger condition.
  ignore_drafts: false

  # "required_statuses" is a list of additional status contexts that must pass
  # before bulldozer will update a pull request, unless the pull request
  # explicitly matches a configured trigger condition. This is useful if you want
  # to require certain statuses to pass before automated updates are made.
  required_statuses:
    - "policy-bot: develop"

Remote Configuration

You can use a remote configuration by specifying a repository and an optional path and Git reference. Place the following in the repository's .bulldozer.yml file instead of the normal configuration:

# The remote repository to read the configuration file from. This is required,
# and must be in "org/repo-name" form. Must be a public repository.
remote: org/repo-name

# The path to the configuration file in the remote repository. If not set,
# uses the default configuration path.
path: path/to/bulldozer.yml

# The branch (or tag, or commit hash) that should be used on the remote
# repository. If not set, uses the default branch of the repository.
ref: main

The remote file must contain bulldozer configuration and cannot be another remote reference. However, the organization-level default configuration may be a remote reference.

FAQ

Can I specify both ignore and trigger?

Yes. If both ignore and trigger are specified, bulldozer will attempt to match on both. In cases where both match, ignore will take precedence.

Can I specify the body of the commit when using the squash strategy?

Yes. When the merge strategy is squash, you can set additional options under the options.squash property, including how to render the commit body.

merge:
  method: squash
  options:
    squash:
      body: summarize_commits # or `pull_request_body`, `empty_body`

You can also define part of pull request body to pick as a commit message when body is pull_request_body.

merge:
  method: squash
  options:
    squash:
      body: pull_request_body
      message_delimiter: ==COMMIT_MSG==

Anything that's contained between two ==COMMIT_MSG== strings will become the commit message instead of whole pull request body.

What if I don't want to put config files into each repo?

You can add default repository configuration in your bulldozer config file.

It will be used only when your repo config file does not exist.

options:
  default_repository_config:
    ignore:
      labels: ["do not merge"] # or any other available config.

Bulldozer isn't merging my commit when it should, what could be happening?

Bulldozer will attempt to merge a branch whenever it passes the trigger/ignore criteria. GitHub may prevent it from merging a branch in certain conditions, some of which are to be expected, and others that may be caused by mis-configuring Bulldozer.

  • Required status checks have not passed
  • Review requirements are not satisfied
  • The merge strategy configured in .bulldozer.yml is not allowed by your repository settings
  • Branch protection rules are preventing bulldozer[bot] from pushing to the branch. Github apps can be added to the list of restricted push users, so you can allow Bulldozer specifically for your repo.
  • The branch has no required checks and allow_merge_with_no_checks is set to the default value (false).

Bulldozer isn't updating my branch when it should, what could be happening?

When using the branch update functionality, Bulldozer only performs an update after updates are enabled when:

  • A label is added
  • The pull request is opened
  • The target branch is updated

For example:

  1. User A opens a pull request targetting develop
  2. User B pushes a commit to develop
  3. User A adds an update me comment to the first pull request
  4. User C pushes a commit to develop
  5. Bulldozer updates the pull request with the commits from Users B and C

Note that the update does not happen when the update me comment is added, even though there is a new commit on develop that is not part of the pull request.

Can Bulldozer work with push restrictions on branches?

As mentioned above, as of Github ~2.19.x, GitHub Apps can be added to the list of users associated with push restrictions. If you don't want to do this, or if you're running an older version of Github that doesn't support this behaviour, you may work around this:

  1. Use another app like policy-bot to implement approval restrictions as required status checks instead of using push restrictions. This effectively limits who can push to a branch by requiring changes to go through the pull request process and be approved.

  2. Configure Bulldozer to use a personal access token for a regular user to perform merges in this case. The token must have the repo scope and the user must be allowed to push to the branch. In the server configuration file, set:

    options:
      push_restriction_user_token: <token-value>

    The token is only used if the target branch has push restrictions enabled. All other merges are performed as the normal GitHub App user.

Deployment

bulldozer is easy to deploy in your own environment as it has no dependencies other than GitHub. It is also safe to run multiple instances of the server, making it a good fit for container schedulers like Nomad or Kubernetes.

We provide both a Docker container and a binary distribution of the server:

A sample configuration file is provided at config/bulldozer.example.yml. Certain values may also be set by environment variables; these are noted in the comments in the sample configuration file. By default, the environment variables for server values are prefixed with BULLDOZER_ (e.g. BULLDOZER_PORT). For configuring options the prefix is BULLDOZER_OPTIONS (e.g. BULLDOZER_OPTIONS_APP_NAME) This prefix can be overridden by setting the BULLDOZER_ENV_PREFIX environment variable.

GitHub App Configuration

To configure Bulldozer as a GitHub App, these general options are required:

  • Webhook URL: http(s)://<your-bulldozer-domain>/api/github/hook
  • Webhook secret: A random string that matches the value of the github.app.webhook_secret property in the server configuration

The app requires these permissions:

Permission Access Reason
Repository administration Read-only Determine required status checks
Checks Read-only Read checks for ref
Repository contents Read & write Read configuration, perform merges
Issues Read & write Read comments, close linked issues
Repository metadata Read-only Basic repository data
Pull requests Read & write Merge and close pull requests
Commit status Read-only Evaluate pull request status

The app should be subscribed to these events:

  • Check run
  • Commit comment
  • Pull request
  • Status
  • Push
  • Issue comment
  • Pull request review
  • Pull request review comment

Operations

bulldozer uses go-baseapp and go-githubapp, both of which emit standard metrics and structured log keys. Please see those projects for details.

Example Files

Example .bulldozer.yml files can be found in config/examples

Migrating: Version 0.4.X to 1.X

The server configuration for bulldozer allows you to specify configuration_v0_path, which is a list of paths to check for 0.4.X style bulldozer configuration. When a 1.X style configuration file does not appear at the configured path, bulldozer will attempt to read from the paths configured by configuration_v0_path, converting the legacy configuration into an equivalent v1 configuration internally.

The upgrade process is therefore to deploy the latest version of bulldozer with both configuration_path and configuration_v0_path configured, and to enable the bulldozer GitHub App on all organizations where it was previously installed.

Reducing Update Commit and CI Pressure

The Bulldozer "Update" feature is useful when keeping branches up-to-date, but can cause lots of pressure on CI build systems and Github when there are many pull requests open on a single repository.

To reduce pressure on CI systems and Github, the update feature can be disabled at the server level by specifying the following server option:

options:
  disable_update_feature: true

Development

To develop bulldozer, you will need a Go installation.

Run style checks and tests

./godelw verify

Running the server locally

# copy and edit the server config
cp config/bulldozer.example.yml config/bulldozer.yml

./godelw run bulldozer server
  • config/bulldozer.yml is used as the default configuration file
  • The server is available at http://localhost:8080/

Running the server via Docker

# copy and edit the server config
cp config/bulldozer.example.yml config/bulldozer.yml

# build the docker image
./godelw docker build --verbose

docker run --rm -v "$(pwd)/config:/secrets/" -p 8080:8080 palantirtechnologies/bulldozer:latest
  • This mounts the config directory (which should contain the bulldozer.yml configuration file) at the expected location
  • The server is available at http://localhost:8080/

Contributing

Contributions and issues are welcome. For new features or large contributions, we prefer discussing the proposed change on a GitHub issue prior to a PR.

License

This application is made available under the Apache 2.0 License.

bulldozer's People

Contributors

ajlake avatar andreyzher avatar arunsathiya avatar asvoboda avatar bluekeyes avatar chdsbd avatar clakech avatar dependabot[bot] avatar depickeresven avatar derekjobst avatar dlwyatt avatar eli-jordan avatar evancharlton avatar f1sherman avatar heuels avatar iainsteers avatar jgogstad avatar jmcampanini avatar justinlew avatar justinwyer avatar nmiyake avatar pkoenig10 avatar richard1122 avatar robert3005 avatar ryanmcnamara avatar shravan1k avatar sideeffffect avatar svc-excavator-bot avatar ungureanuvladvictor avatar wrslatz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bulldozer's Issues

Document configuration and workflows

The README includes a sample configuration, but does not describe what the behavior of any of the settings are. (This prevented us on Go Cloud from considering Bulldozer for our project, see google/go-cloud#687.) Things in particular we'd like to understand are:

  • Does this consider branch protections and code review approvals?
  • Does this wait for CI to catch up?
  • What happens if the original author adds more commits after the last review? Does that get merged in or does the bot stop?

Endpoint to exchange OAuth token for JWT

I want to enable Bulldozer using a Github OAuth Token rather than the web interface, so it would be great to have a way to request a JWT over the rest api. On a similar project this was implemented as POST /api/auth/direct

Request:

{
    "access_token": "abcdefg"
}

Response:

{
    "token": "1234567"
}

Support status checks created by Checks API

I've deployed bulldozer via the 1.4.0 tagged docker image and setup a GithubApp for our organization. I'm now trying out the config in a toy repository. In this PR the first comment is matching the configured whitelisted "comment" and the second comment the "comment_substring". In the debug output however I see

pymor_bulldozer_1 | 2019-03-07T08:03:17.357768662Z |DEBUG| pymor/ci_playground#4 is deemed not mergeable because of unfulfilled status checks: [pymor.ci_playground]

Which seems wrong since that is the name of the only required status check and that passed.

Update pr immediately when "update me" is label is added

Currently, when the update me label exists on a pr, the pr is only updated when the target branch is updated.

However, it might be the case (in fact it's likely) that the pr is out of date at the time the update me label is added, in which case it seems worth it to update the branch then.

Add user-friendly landing page at server root

Similar to policy-bot and Probot apps, Bulldozer should provide a user-friendly landing page when people visit the server root URL. It should include:

  • A brief description of the bot
  • A link to the install page on GitHub
  • Steps for getting started with a minimal configuration
  • The current server version

Improve how pull.GithubContext uses PR information

pull.GithubContext is a bit weird about how it uses github.PullRequest objects:

  1. It takes one in the constructor and several functions assume it is non-nil, but the constructor also takes 3 parameters that duplicate information from the PR
  2. Body() just returns the body value of the saved PR object, but takes a context and returns an error
  3. Title() just returns the title value of the saved PR object, but takes a context and returns an error

Assuming all callers have a full (or full-enough) github.PullRequest, we should only require that as an argument and then simplify any methods that only use data from the PR and make no additional API calls.

delete_after_merge being ignored

I'm not sure what we're doing wrong here. The branches are being merged but the delete_after_merge flag is being ignored and the branches aren't being deleted. I also can't see anything in the logs that mention deletion of the branch.

Here's the project .bulldozer.yml

version: 1

merge:
  whitelist:
    branches: ["develop", "master"]
  blacklist:
    labels: ["no merge"]
    comment_substrings: ["==DO_NOT_MERGE=="]
  method: squash
  branch_method:
    develop: squash
    master: merge
  options:
    squash:
      title: "pull_request_title"
      body: "pull_request_body"
      message_delimiter: ==COMMIT_MSG==
  delete_after_merge: true

update:
  whitelist:
    branches: ["develop", "master"]
  blacklist:
    labels: ["no update"]

Whitelist/Blacklist based on target branch

Hi,

Thanks for releasing this, it's almost exactly what I need. One workflow I have seems to require a workaround, which is whitelisting/blacklisting based on the target branch of the PR. For context, we want PR's into the production environment not be to squashed, but all other PR's to be.

I've dealt with this by whitelisting labels and only applying the label to branches that should be dealt with, but it would be helpful to be able to whitelist target branches OR if it was possible to apply merge strategies based on the target branch?

I think another workaround I could apply would be to run two bulldozer apps side-by-side, but that's also a pretty big burden.

If it's something you're open to, I'd be happy to take a shot at developing the feature.

Either way, thanks for the tool ๐Ÿ‘

Unable to Merge when GitHub Branch Protection Push Restrictions Enabled

Is there any current workarounds to use Bulldozer when Restrict who can push to matching branches is enabled on GitHub?

From looking at other projects, it appears it's currently impossible as GitHub does not provide a way to give push permission to the Bulldozer GitHub App directly, only user accounts or groups can be selected.

Some projects have worked around this by having a 'real' user account for the bot to use in this situation.

Thanks!

Create labels if they don't exist

Bulldozer is configured via labeled PRs, but a human has to create all those labels by hand. If I enable bulldozer on a repo which does not have the labels, they should be created for me.

Avoid huge commit messages when squash-merging

On one of our internal repositories, people submit changes from forks. These forks are sometimes out-of-date and are brought up-to-date by a series of merge commits. While GitHub correctly detects which files have changes, when Bulldozer squash-merges the PR, the resulting commit message can have hundreds of lines, including references to just about every commit that was included via one of the merges.

This makes history look pretty weird and can also lead to things like people getting mention emails from commits that merged months ago.

As a reviewer on the repo, it's unclear to me that this will happen before I add my approval, so it would be nice if Bulldozer could protect me from this result.

Some options:

  1. Add a configuration option to always use the PR title and either an empty message body or the body of the PR.
  2. Place some character limit on the size of the commit message; I don't know if GitHub exposes the generated message in the API
  3. Use the same method as GitHub to generate commit messages (a list containing each member commit), but ignore all merge commits

`updateWhenReady` config option

Two asks here:

  • Looking for a default behavior config option (much like strategy and deleteAfterMerge) that defaults to false and if true rebases the pr when out of date if ready

  • Also would be nice to have a config option that behaved more like "updateWhenOutOfDate" which didn't wait for the pr to be ready and just continually updated it

I really think that config options, as apposed to labels, should be prioritized, as it is better from an automation perspective

Merged pull requests are not closed when using 1.0

On some repositories, after Bulldozer merges a PR, GitHub Enterprise 2.14.6 still sees the state of the PR as open: it shows up in open PR lists and has a button to close it. The merge is complete and the commits exist in the target branch, so it is only the PR state that is incorrect.

We have an open support issue with GitHub for this, since it seems like an internal race condition or an issue with app merges, rather than a bug with Bulldozer. The 0.4.x OAuth app never had this problem despite using very similar merge code.

If we can't figure out what's wrong, we'll probably need to add a workaround to close PRs via the API after they are merged.

FR: when first enabled, process all open PRs

What happened

Someone just asked why bulldozer wasn't working on a PR and all the configuration looked right (bot enabled, correctly configured etc). Turns out it just hadn't delivered any webhooks.

What should have happened

When the bot is first enabled, it should crawl open PRs and merge ones that match the criteria already

Question: Would be open to have someone host this?

Hey all,

thank you so much for making bulldozer. We recently were looking for options to our problems, and were surprised that there is no hosted option for something like bulldozer. Would you be OK with someone hosting bulldozer as a service?

Support for ==MERGE_WHEN_READY== in PR description only

Pre-1.0, in pr_body mode, ==MERGE_WHEN_READY== was only respected in the PR description, not in comments. For some use cases, this is actually preferred over the change introduced for #31.

For one, we have a bot that comments on PRs that have passed validation that the user can add ==MERGE_WHEN_READY== to the description for it to auto-merge. In 1.0, this comment itself would cause the PR to auto-merge, so we will have to escape that text somehow.

Secondly, updating the PR description is limited to the PR author and those with write access to the repo. We limit write access generally and users submit PRs from forks, so having it be allowed in comments, which are not as locked down, opens up this configuration more broadly than we would like.

Is it possible to configure if comments should be included or not?

Different Merge Options For Different Target Branches

In our development model we are moving to using to shared branches develop and master. We would like to use different merge options for these targets. In our case, squash for merges into develop and merge for merges into master.

Something like this would be great.

method: rebase
branch_merge_method: 
   develop: squash
   master: merge

Where the method attribute is used if there is no branch specific method that matches the current PR, otherwise the branch specific method is used.

This should be pretty simple to implement, so I'm happy to create a PR if you think this makes sense.

aarch64

k@localhost:/root/image$ buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.0.5 (arm64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /usr/local/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk-arm64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-arm64/jre/bin/keytool
# Install platform
# Run "/usr/bin/python -m pip install -q --user 'appdirs' 'colorama>=0.3.3' 'jinja2' 'six'"
# Cwd None
# Apache ANT found at /home/k/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/k/.buildozer/android/platform/android-sdk-20
# Android NDK found at /home/k/.buildozer/android/platform/android-ndk-r9c
# Run '/home/k/.buildozer/android/platform/android-sdk-20/tools/android list sdk -u -e'
# Cwd /home/k/.buildozer/android/platform
SWT folder '/home/k/.buildozer/android/platform/android-sdk-20/tools/lib/aarch64' does not exist.
Please export ANDROID_SWT to point to the folder containing swt.jar for your platform.
# Command failed: /home/k/.buildozer/android/platform/android-sdk-20/tools/android list sdk -u -e
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

I tried set ANDROID_SWT to x86/swt.jar
I got same error

/home/k/.buildozer/android/platform/android-sdk-20/tools/lib/x86/swt.jar does not exist

Getting 404

I have set-up bulldozed using docker. The command being used to run the docker container is:

docker run -it -d --restart unless-stopped -v /path/to/bulldozer.yml:/secrets/bulldozer.yml -p 8400:8400 --name bulldozer palantirtechnologies/bulldozer:latest

Nginx reverse proxy has been set-up on xyz.example.com which routes traffic to the docker container running on http://localhost:8400

When I try to access the http://xyz.example.com , I am getting a 404 from the container. When I am trying to hit http://xyz.example.com/api/github/hook , I am getting a 404 again.

Can someone explain what I am doing wrong here?

FR: post a PR status when enabled, showing if its ready

right now, a user can't see if bulldozer is enabled on a repo.

if we post a status that:

  • says pending if bulldozer is waiting for something before it can try to merge (like a whitelist tag)
  • says ready if bulldozer is ready to try to merge

comment when encountering an error that is user-resolvable

there are times when bulldozer encounters an error that is user-resolvable, specifically when a merge fails due to permission settings.

we currently just log these, example:

Merge rejected due to unsatisfied condition \"You're not authorized to push to this branch. Visit https://help.github.com/enterprise/2.15/user/articles/about-protected-branches/ for more information.\

in this particular case, we should be able to add a comment to the PR with feedback on what happened and possible resolution steps

'Update Me' on fork not working

We have a repo which works with forks.
However if I put a "Update Me" label on a fork, it does not get updated.
I understand this is an issue since the branch doesn't exist on our repo, only the PR does.
Is there anyway around this?

Bug: Bulldozer does not always merge green PRs

I've recently seen a large number of PRs opened by excavator remain open although they are green and have the merge when ready label applied. Toggling the label or interacting with the PR in any way seem to trigger the merge

Merge message should contain original PR title and body

By default, when you merge a PR through the github UI, it helpfully copies the title into the commit message, that looks something like:

Merge pull request #XYZ from <branch>

<PR title>

Bulldozer actually drops the PR title and seems to push an empty commit body:

Merge pull request #XYZ from <branch>

Proposal

It would make it easier to browse history using git-log if we could include a bit more information, e.g.:

#XYZ <PR Title>

<PR Description>

cc @alicederyn

Not obeys the Github Branch protection settings

Hi Team,
This is the exact app which i looked for auto merge which should happen after all required branch protection settings are getting passed. I just did the setup by following the 'deployment' steps. I started the server and it listened on port 8080. I tried to have setup a branch protection settings for my 'master' branch in Github repo. Once I raised a PR request against that 'master' branch, it is quickly getting auto merged even before all 'branch protection settings/status updates happen'.

This is the config i am using against my Github Repo.

version: 1

merge:
  method: squash

  options:
    squash:
      body: "summarize_commits"

  required_statuses:
    - "default"

  delete_after_merge: true 

My questions are

  1. Am i missing something?
  2. Where can i find the logs? [I can see the server log with debug option where i cannot find a message other than server started and listening]

It would be great if anybody can help me out as i am struck it here.

Ability to wait for non required checks to pass before merging

It would be nice if there was a way to wait for all (or possibly some) not required checks to pass before merging. Perhaps a config option like require-all-status-checks, that defaults to false for backcompat.

The use case is that there are times where a human doesn't want to be forced to wait for a status
check to pass, but does want bulldozer to wait

bulldozer commit messages are inconsistent

When a PR containing multiple commits is merged (using squash+merge), bulldozer uses the PR title as the commit message on develop.

When a PR containing a single commit is merged (using squash+merge), the commit message of that single commit appears on develop, not the PR title. This is inconsistent.

It's particularly annoying because we enforce a convention of prefixing PRs with [fix] [improvement] etc in some of our OSS repos, which then get discarded.

Example: palantir/conjure-java@8bf6a57

FR: Update me should only update the PR once

Currently, Bulldozer's "update me" will continuously update a PR every single time that a commit is added to the base branch.

I suggest that we change the behaviour of "update me" to only update the PR once. The idea is that once the update label is applied, bulldozer would update the PR and subsequently remove the label.

I think that this change is behaviour is desirable because we have seen the previous behaviour result in unexpected load to GH/CI and interact negatively with other automation (excavator)

Question - blocking merging for other developers

In order to allow bulldozer to merge, I can not check the Restrict who can push to matching branches in the settings -> protected branch

How can I allow only bulldozer to merge PR's and not everyone with "write" permissions on the repo?

Is there any way to create some user called "bulldozer" and give these details to the bot?

Bulldozer should only merge PRs into the default branch

If a PR is created whose base branch has no branch protection rules, then bulldozer will immediately merge that PR.

This seems undesirable. Opening a PR with a non-default base branch is a common workflow when one PR depends on another currently open PR.

Could not refresh token

I just tried to run bulldozer and I'm getting the following or similar errors when receiving events from Github:

Get https://api.github.com/repos/celo-org/celo-monorepo/pulls?per_page=100&state=open: could not refresh installation id 524951's token: received non 2xx response status "404 Not Found" when fetching https://api.github.com/installations/524951/access_tokens

The installation ID is correct, so I'm not sure what the difficulty is, and I'm quite new to Golang. Are there any points for debugging this?

Delete branch *only* if no other PR depends on it

Say you have two branches A and B, each with a PR up.
The PR for A merges into develop, the PR for B merges into A.

Currently, if deleteAfterMerge is set, A gets deleted when merging and B gets automatically closed.

It would be great if deleteAfterMerge checked first that no other PR depends on A.

Use PR title as squashed commit message

Somewhat related to #22

I often update PR titles to be more accurate. When I do manual merges, I use that title in the merge, but when bulldozer squashes a 1-commit PR, it ends up using the original commit message of that commit in the squashed commit message.

MaxPullRequestPollCount shall be configurable

Hello,

first of all I wanna thank you for this great app :)

I have one issue:
It would be helpful to have MaxPullRequestPollCount in merge.go configurable via yml file.

Reason:
we have a lot of pull requests and often the use case, that branches will be merged when developers are not in office anymore.
It would be bad, if PR already max count when no one is in office. Then, benefit of Bulldozer would be gone ;)

Additionally, there is none more thin which I do not understand:
image

You can see in screenshot, bulldozer merged automatically develop branch into feature branch 4 times in a row.
After this, a merge must be dne manually (385385c), because bulldozer stopped due to max count.
But after this, bulldozer tried 7 times and it worked (bulldozer also did merge into develop).
Why was max count not respected here?

Thank you in advance!

Best regards,
Stefan

required_statuses pattern match

Hi. First, thanks for you all developers of this great tool.

I want pattern match for status checks which are defined in the required_statuses of .bulldozer.yaml because some CI status checks cannot be statically defined. For example, GitLab CI injects target branch names into their statuses (e.g. ci/gitlab/<branch-name>).

The solution will be a small change in evaluate.go where simple key existence check is used currently.

Can I hear your opinions?

Whitelist/Blacklist based on author

Awesome App, thanks!

I could find a way to set the options based on the author of the PR. Is there an option to set it?

BTW: it would be also very useful to set not only the author but to set if the author belongs to a team. E.g. merge the PR only if the author has commit rights on the repo (AKA belongs to a specific team).

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.