Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure in adding one label prevents adding other labels and assigning participants #31091

Closed
RahulGautamSingh opened this issue Aug 29, 2024 · 4 comments · Fixed by #32035
Closed
Labels
platform:github GitHub Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality worker:pr Related to non-onboarding PR creation or update

Comments

@RahulGautamSingh
Copy link
Collaborator

RahulGautamSingh commented Aug 29, 2024

When some of the labels configured do not get added/updated due to some issue, other labels aren't added either. This also, causes addAssignees to fail while PR creation.

It logs a Pull Request creation error, but the pull request is created, only the labels and assignees are missing.

One such case is when labels cross the 50chars limit of Github labels.

Sample debug logs

Logs
DEBUG: PR created (branch="renovate/orange-cloudfoundry-k3s-packages-boshrelease-1.28.x")
{
  "baseBranch": "master"
  "pr": 100
  "draft": false
}

DEBUG: Adding labels 'datasource/github-tags, depName/orange-cloudfoundry/k3s-packages-boshrelease, hasReleaseNotes/true, manager/regex, orange-cloudfoundry/k3s-packages-boshrelease, type/bosh-release' to #100 (branch="renovate/orange-cloudfoundry-k3s-packages-boshrelease-1.28.x")
{
  "baseBranch": "master"
}

DEBUG: POST https://api.github.com/repos/orange-cloudfoundry/paas-templates-renovate-sample/issues/100/labels = (code=ERR_NON_2XX_3XX_RESPONSE, statusCode=422 retryCount=0, duration=160) (branch="renovate/orange-cloudfoundry-k3s-packages-boshrelease-1.28.x")
{
  "baseBranch": "master"
}

DEBUG: Received invalid response - aborting (branch="renovate/orange-cloudfoundry-k3s-packages-boshrelease-1.28.x")
{
  "baseBranch": "master"
  "err": {
    "name": "HTTPError",
    "code": "ERR_NON_2XX_3XX_RESPONSE",
    "timings": {
      "start": 1724847568824,
      "socket": 1724847568824,
      "lookup": 1724847568824,
      "connect": 1724847568824,
      "secureConnect": 1724847568824,
      "upload": 1724847568824,
      "response": 1724847568984,
      "end": 1724847568984,
      "phases": {
        "wait": 0,
        "dns": 0,
        "tcp": 0,
        "tls": 0,
        "request": 0,
        "firstByte": 160,
        "download": 0,
        "total": 160
      }
    },
    "message": "Response code 422 (Unprocessable Entity)",
    "stack": "HTTPError: Response code 422 (Unprocessable Entity)\n    at Request.<anonymous> (/usr/local/renovate/node_modules/.pnpm/got@11.8.6/node_modules/got/dist/source/as-promise/index.js:118:42)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
    "options": {
      "headers": {
        "user-agent": "RenovateBot/38.56.0 (https://github.com/renovatebot/renovate)",
        "accept": "application/json, application/vnd.github.machine-man-preview+json",
        "authorization": "***********",
        "content-type": "application/json",
        "content-length": "187",
        "accept-encoding": "gzip, deflate, br"
      },
      "url": "https://api.github.com/repos/orange-cloudfoundry/paas-templates-renovate-sample/issues/100/labels",
      "hostType": "github",
      "username": "",
      "password": "",
      "method": "POST",
      "http2": false
    },
    "response": {
      "statusCode": 422,
      "statusMessage": "Unprocessable Entity",
      "body": {
        "message": "Validation Failed",
        "errors": [
          {
            "value": "depName/orange-cloudfoundry/k3s-packages-boshrelease",
            "resource": "Label",
            "field": "name",
            "code": "invalid"
          }
        ],
        "documentation_url": "https://docs.github.com/rest/issues/labels#add-labels-to-an-issue",
        "status": "422"
      },
      "headers": {
        "date": "Wed, 28 Aug 2024 12:19:28 GMT",
        "content-type": "application/json; charset=utf-8",
        "content-length": "261",
        "x-github-media-type": "github.v3; param=machine-man-preview",
        "x-accepted-github-permissions": "issues=write; pull_requests=write",
        "x-github-api-version-selected": "2022-11-28",
        "x-ratelimit-limit": "6150",
        "x-ratelimit-remaining": "6141",
        "x-ratelimit-reset": "1724851073",
        "x-ratelimit-used": "9",
        "x-ratelimit-resource": "core",
        "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
        "access-control-allow-origin": "*",
        "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
        "x-frame-options": "deny",
        "x-content-type-options": "nosniff",
        "x-xss-protection": "0",
        "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
        "content-security-policy": "default-src 'none'",
        "vary": "Accept-Encoding, Accept, X-Requested-With",
        "x-github-request-id": "4067:284A20:38BCD7F:6D29735:66CF15D0",
        "server": "github.com"
      },
      "httpVersion": "1.1",
      "retryCount": 0
    }
  }
}

DEBUG: Pull request creation error (branch="renovate/orange-cloudfoundry-k3s-packages-boshrelease-1.28.x")
{
  "baseBranch": "master"
  "err": {
    "message": "repository-changed",
    "stack": "Error: repository-changed\n    at handleGotError (/usr/local/renovate/lib/util/http/github.ts:141:14)\n    at GithubHttp.request (/usr/local/renovate/lib/util/http/github.ts:380:13)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at GithubHttp.requestJson (/usr/local/renovate/lib/util/http/index.ts:291:17)\n    at addLabels (/usr/local/renovate/lib/modules/platform/github/index.ts:1494:5)\n    at Proxy.createPr (/usr/local/renovate/lib/modules/platform/github/index.ts:1764:3)\n    at ensurePr (/usr/local/renovate/lib/workers/repository/update/pr/index.ts:487:14)\n    at processBranch (/usr/local/renovate/lib/workers/repository/update/branch/index.ts:790:28)\n    at writeUpdates (/usr/local/renovate/lib/workers/repository/process/write.ts:166:17)\n    at update (/usr/local/renovate/lib/workers/repository/process/extract-update.ts:213:11)\n    at Object.renovateRepository (/usr/local/renovate/lib/workers/repository/index.ts:89:19)\n    at attributes.repository (/usr/local/renovate/lib/workers/global/index.ts:202:11)\n    at start (/usr/local/renovate/lib/workers/global/index.ts:187:7)\n    at /usr/local/renovate/lib/renovate.ts:18:22"
  }
}

Originally posted by @gberche-orange in #31080

@RahulGautamSingh RahulGautamSingh added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality worker:pr Related to non-onboarding PR creation or update platform:github GitHub Platform labels Aug 29, 2024
@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Aug 29, 2024

Its not possible to prevent this in the platform where we add/update all labels in one api call. (this must be causing some issue with updating labels as well, need to debug to confirm)

We can add a try-catch block still which should prevent the issue with assigning assginees.

@rarkins
Copy link
Collaborator

rarkins commented Aug 29, 2024

There's three potential parts to this in order of importance:

  1. We should trim labels to 50 chars
  2. We should try/catch label addition so that assignee addition can continue even if labels fails
  3. If one label fails to validate retry with the remaining ones (if relevant)

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Oct 17, 2024

Related Info:

Platform Label Char Limit Tested on
Github 50 Github UI
Gitlab 255 Gitlab UI
Gitea 50 Gitea UI

I will add this info to the docs and also filter out labels which exceed this limit with a debug message at the platform level.

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 38.128.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:github GitHub Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality worker:pr Related to non-onboarding PR creation or update
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants