renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
16.58k stars 2.14k forks source link

PR created outside of schedule #2536

Closed ajafff closed 5 years ago

ajafff commented 5 years ago

What Renovate type are you using? Renovate GitHub App

Describe the bug https://github.com/fimbullinter/wotan/pull/422 was created around 12:00 which is definitely not "after 10pm,before 5am" in timezone Europe/Berlin.

The branch was created within the configured schedule. I guess the timeout waiting for CI to finish ended after the scheduled time.

To Reproduce Steps to reproduce the behavior:

Just a guess: configure a schedule on a repo where a required status check is never reported.

Expected behavior Wait until the next time slot within the schedule

rarkins commented 5 years ago

Can you log into renovatebot.com/dashboard and locate the exact job & log for when the PR was created? It might give a hint as to why it was opened.

ajafff commented 5 years ago

I found the job and the relevant section in the log

https://renovatebot.com/dashboard#fimbullinter/wotan/20558468

Also note that INFO: Adding branch automerge failure message to PR wasn't actually executed. As you can see there is no comment on the PR.

From the log I can see that it knows the current time doesn't match the schedule, but opens the PR anyway.

Another thing to note: the same upgrade was already made 5 days ago in https://github.com/fimbullinter/wotan/commit/c64a3890f49e029ab55ffed99e3d8b55dd88776b I effectively downgraded (according to semver) the dependency by switching back to 3.1.0-dev. That previous upgrade was directly commited to master (as configured), that's why there is no closed PR that would prevent opening the same PR again.

DEBUG: processBranch with 1 upgrades
DEBUG: processBranch()
DEBUG: branchExists(renovate/typescript-3.x)=true
DEBUG: branchExists=true
DEBUG: Branch has 1 upgrade(s)
DEBUG: recreateClosed is false
DEBUG: findPr(renovate/typescript-3.x, Update dependency typescript to v3.1.0-rc.20180911, !open)
DEBUG: Retrieving PR list
DEBUG: Retrieved 215 Pull Requests
DEBUG: prAlreadyExisted=false
DEBUG: Checking if PR has been edited
DEBUG: getBranchPr(renovate/typescript-3.x)
DEBUG: findPr(renovate/typescript-3.x, null, open)
DEBUG: Checking schedule(after 10pm,before 5am, Europe/Berlin)
DEBUG: Found timezone
{
  "timezone": "Europe/Berlin"
}
DEBUG: Adjusting now for timezone
DEBUG: Checking 2 schedule(s)
DEBUG: Checking schedule "after 10pm"
{
  "parsedSchedule": {
    "schedules": [
      {
        "t_a": [
          79200
        ]
      }
    ],
    "exceptions": [],
    "error": -1
  }
}
DEBUG: Does not match schedule because 43226 is earlier than 79200
DEBUG: Checking schedule "before 5am"
{
  "parsedSchedule": {
    "schedules": [
      {
        "t_b": [
          18000
        ]
      }
    ],
    "exceptions": [],
    "error": -1
  }
}
DEBUG: Does not match schedule because 43226 is later than 18000
DEBUG: Package not scheduled
DEBUG: Branch exists but is not scheduled -- will update if necessary
DEBUG: branchExists(renovate/typescript-3.x)=true
DEBUG: Branch already exists
DEBUG: getBranchPr(renovate/typescript-3.x)
DEBUG: findPr(renovate/typescript-3.x, null, open)
DEBUG: Found branch protection
DEBUG: Branch protection: PRs must be up-to-date before merging
DEBUG: isBranchStale(renovate/typescript-3.x)
DEBUG: branchCommit=e000fa154a7a9ab5a561c357debfe463c78e856e
DEBUG: getCommitDetails(e000fa154a7a9ab5a561c357debfe463c78e856e)
DEBUG: parentSha=4ed8f37ebcc4fe36da0ba223ae98bb64572815fe
DEBUG: baseCommitSHA=4ed8f37ebcc4fe36da0ba223ae98bb64572815fe
DEBUG: Branch does not need rebasing
DEBUG: Using parentBranch: renovate/typescript-3.x
DEBUG: manager.getUpdatedPackageFiles()
DEBUG: Retrieved fileList with length 995
DEBUG: npm.updateDependency(): devDependencies.typescript = 3.1.0-rc.20180911
DEBUG: Version is already updated
DEBUG: bumpVersion()
DEBUG: No package files need updating
DEBUG: Getting updated lock files
DEBUG: lock file dirs
{
  "dirs": {
    "yarnLockDirs": [],
    "npmLockDirs": [],
    "pnpmShrinkwrapDirs": [],
    "lernaDirs": []
  }
}
DEBUG: Writing package.json files
{
  "packageFiles": [
    "package.json",
    "packages/bifrost/package.json",
    "packages/disir/package.json",
    "packages/heimdall/package.json",
    "packages/mimir/package.json",
    "packages/valtyr/package.json",
    "packages/ve/package.json",
    "packages/wotan/package.json",
    "packages/ymir/package.json"
  ]
}
DEBUG: Writing yarn.lock
DEBUG: Writing yarn.lock
DEBUG: Writing yarn.lock
DEBUG: Writing yarn.lock
DEBUG: Writing yarn.lock
DEBUG: Writing yarn.lock
DEBUG: Writing yarn.lock
DEBUG: Writing yarn.lock
DEBUG: Writing yarn.lock
DEBUG: Writing any updated package files
DEBUG: No updated lock files in branch
DEBUG: No files to commit
DEBUG: Checking if we can automerge branch
DEBUG: getBranchPr(renovate/typescript-3.x)
DEBUG: findPr(renovate/typescript-3.x, null, open)
DEBUG: getBranchStatus(renovate/typescript-3.x)
DEBUG: branch status check result
{
  "state": "failure",
  "statuses": [
    {
      "url": "https://api.github.com/repos/fimbullinter/wotan/statuses/e000fa154a7a9ab5a561c357debfe463c78e856e",
      "avatar_url": "https://avatars2.githubusercontent.com/oa/4808?v=4",
      "id": 5514347130,
      "node_id": "MDEzOlN0YXR1c0NvbnRleHQ1NTE0MzQ3MTMw",
      "state": "failure",
      "description": "Your tests failed on CircleCI",
      "target_url": "https://circleci.com/gh/fimbullinter/wotan/8675?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link",
      "context": "ci/circleci: build",
      "created_at": "2018-09-17T23:51:11Z",
      "updated_at": "2018-09-17T23:51:11Z"
    },
    {
      "url": "https://api.github.com/repos/fimbullinter/wotan/statuses/e000fa154a7a9ab5a561c357debfe463c78e856e",
      "avatar_url": "https://avatars2.githubusercontent.com/oa/39145?v=4",
      "id": 5514348586,
      "node_id": "MDEzOlN0YXR1c0NvbnRleHQ1NTE0MzQ4NTg2",
      "state": "failure",
      "description": "AppVeyor build failed",
      "target_url": "https://ci.appveyor.com/project/ajafff/wotan/build/1.0.2121",
      "context": "continuous-integration/appveyor/branch",
      "created_at": "2018-09-17T23:51:36Z",
      "updated_at": "2018-09-17T23:51:36Z"
    }
  ]
}
DEBUG: mergeStatus=branch status error
INFO: Branch automerge not possible
{
  "mergeStatus": "branch status error"
}
DEBUG: Ensuring PR
DEBUG: There are 0 errors and 0 warnings
DEBUG: getBranchPr(renovate/typescript-3.x)
DEBUG: findPr(renovate/typescript-3.x, null, open)
DEBUG: getChangeLogJSON(args)
{
  "args": {
    "manager": "npm",
    "versionScheme": "semver",
    "depType": "devDependencies",
    "depName": "typescript",
    "fromVersion": "3.1.0-dev.20180915",
    "toVersion": "3.1.0-rc.20180911",
    "repositoryUrl": "https://github.com/Microsoft/TypeScript"
  }
}
DEBUG: Creating PR
{
  "branchName": "renovate/typescript-3.x",
  "prTitle": "Update dependency typescript to v3.1.0-rc.20180911"
}
DEBUG: Creating PR
{
  "title": "Update dependency typescript to v3.1.0-rc.20180911",
  "head": "fimbullinter:renovate/typescript-3.x",
  "base": "master"
}
DEBUG: PR created
{
  "branchName": "renovate/typescript-3.x",
  "pr": 422
}
DEBUG: Adding labels to #422
INFO: PR created
{
  "branchName": "renovate/typescript-3.x",
  "pr": 422
}
INFO: Adding branch automerge failure message to PR
DEBUG: getBranchStatus(renovate/typescript-3.x)
DEBUG: branch status check result
{
  "state": "failure",
  "statuses": [
    {
      "url": "https://api.github.com/repos/fimbullinter/wotan/statuses/e000fa154a7a9ab5a561c357debfe463c78e856e",
      "avatar_url": "https://avatars2.githubusercontent.com/oa/4808?v=4",
      "id": 5514347130,
      "node_id": "MDEzOlN0YXR1c0NvbnRleHQ1NTE0MzQ3MTMw",
      "state": "failure",
      "description": "Your tests failed on CircleCI",
      "target_url": "https://circleci.com/gh/fimbullinter/wotan/8675?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link",
      "context": "ci/circleci: build",
      "created_at": "2018-09-17T23:51:11Z",
      "updated_at": "2018-09-17T23:51:11Z"
    },
    {
      "url": "https://api.github.com/repos/fimbullinter/wotan/statuses/e000fa154a7a9ab5a561c357debfe463c78e856e",
      "avatar_url": "https://avatars2.githubusercontent.com/oa/39145?v=4",
      "id": 5514348586,
      "node_id": "MDEzOlN0YXR1c0NvbnRleHQ1NTE0MzQ4NTg2",
      "state": "failure",
      "description": "AppVeyor build failed",
      "target_url": "https://ci.appveyor.com/project/ajafff/wotan/build/1.0.2121",
      "context": "continuous-integration/appveyor/branch",
      "created_at": "2018-09-17T23:51:36Z",
      "updated_at": "2018-09-17T23:51:36Z"
    }
  ]
}
INFO: Created Pull Request #422
DEBUG: Checking #422 for automerge
{
  "automerge": true,
  "automergeType": "branch",
  "automergeComment": "automergeComment"
}
DEBUG: PR is configured for automerge
INFO: PR is not ready for merge

Btw: that dashboard is pretty helpful. Maybe you could add a link to it in the issue template.

rarkins commented 5 years ago

So in cases where PR creation is delayed compared to branch creation (e.g. due to configuration), you would prefer if the PR creation is skipped "out of schedule" even though the branch itself got created within it? i.e. don't create a branch OR a PR outside of schedule and it's OK to wait multiple "windows" to get PRs?

ajafff commented 5 years ago

Yeah, that's exactly what I want to propose. I configured the schedule to reduce noise during my working hours. I don't care about branches created outside the schedule, but I do care about PRs created as I get notified for each of them.

rarkins commented 5 years ago

I agree that we should stop creating PRs out of schedule. I did that originally because people were creating unreasonably short schedule windows that didn’t leave enough time to create a branch, pass tests, and then create the PR. But I think the result is too unintuitive.

For now I won’t allow a separate schedule or option for branches but it’s an option for later. Eg opt in to creating branches out of schedule. Some people use scheduling as a way to stop Renovate clogging CI resources during working hours so that’s why they obey schedules too.

renovate-bot commented 5 years ago

:tada: This issue has been resolved in version 13.74.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: