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
17.18k stars 2.24k forks source link

Renovate fails create PullRequest on Bitbucket Server (when special characters are in the chagelog?) #9219

Closed AB-xdev closed 3 years ago

AB-xdev commented 3 years ago

Similar to #6424

Background:

We use Renovate in Docker (renovate/renovate:24-slim) and set RENOVATE_UNICODE_EMOJI to false. This also get's detected by Renovate as I see in the logs (Loglevel=Debug):

DEBUG: Combined config
       "config": {
         "hostRules": [
           {"hostType": "github", "domainName": "github.com", "token": "***********"}
         ],
         "binarySource": "docker",
         "platform": "bitbucket-server",
         "endpoint": "https://bitbucket.xxx.com",
         "username": "xxx@xxx.de",
         "password": "***********",
         "gitAuthor": "Renovate Bot <xxx@xxx.de>",
         "unicodeEmoji": false,
         "repositories": ["xxx/xxx"]
       }

The targeted repo - where the problem occurs - is on a Bitbucket Server (7.6) which uses MySQL (5.7) in the background.

The problem

The creation of the PR for org.testcontainers (1.15.2) always fails silently (no bad exit code, no warning message):

    DEBUG: Pull request creation error (repository=xxx/xxx, branch=renovate/org.testcontainers.version)
           "err": {
             "name": "HTTPError",
             "timings": {
               "start": 1616158210567,
               "socket": 1616158210568,
               "lookup": 1616158210568,
               "connect": 1616158210569,
               "secureConnect": 1616158210570,
               "upload": 1616158210570,
               "response": 1616158210650,
               "end": 1616158210651,
               "phases": {
                 "wait": 1,
                 "dns": 0,
                 "tcp": 1,
                 "tls": 1,
                 "request": 0,
                 "firstByte": 80,
                 "download": 1,
                 "total": 84
               }
             },
             "message": "Response code 500 (Internal Server Error)",
             "stack": "HTTPError: Response code 500 (Internal Server Error)\n    at Request.<anonymous> (/usr/src/app/node_modules/got/dist/source/as-promise/index.js:117:42)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)",
             "options": {
               "headers": {
                 "user-agent": "https://github.com/renovatebot/renovate",
                 "accept-encoding": "gzip, deflate",
                 "x-atlassian-token": "no-check",
                 "authorization": "***********",
                 "accept": "application/json",
                 "content-type": "application/json",
                 "content-length": "15355"
               },
               "url": "https://bitbucket.xxx.com/rest/api/1.0/projects/xxx/repos/xxx/pull-requests",
               "username": "",
               "password": "",
               "method": "POST",
               "http2": false
             },
             "response": {
               "statusCode": 500,
               "statusMessage": "Internal Server Error",
               "body": {
                 "errors": [
                   {
                     "context": null,
                     "message": "A database error has occurred.",
                     "exceptionName": "com.atlassian.bitbucket.DataStoreException"
                   }
                 ]
               },
               "headers": {
                 "server": "nginx/1.14.0 (Ubuntu)",
                 "date": "Fri, 19 Mar 2021 12:50:10 GMT",
                 "content-type": "application/json;charset=UTF-8",
                 "transfer-encoding": "chunked",
                 "connection": "close",
                 "x-arequestid": "@FEWDHWx770x222259x0",
                 "x-auserid": "1603",
                 "x-ausername": "xxxx",
                 "cache-control": "no-cache, no-transform",
                 "vary": "accept-encoding,x-auserid,cookie,x-ausername,accept-encoding",
                 "x-content-type-options": "nosniff",
                 "content-encoding": "gzip"
               },
               "httpVersion": "1.1"
             }
           }

So basically a branch get's created, but the PR is missing.

I managed to extract the data which is sent to bitbucket by setting the LOG_LEVEL to TRACE:

TRACE: Applying Basic authentication (repository=xxx/xxx, branch=renovate/org.testcontainers.version)
       "url": "https://bitbucket.xxx.com/./rest/api/1.0/projects/xxx/repos/xxx/pull-requests"
TRACE: got request (repository=xxx/xxx, branch=renovate/org.testcontainers.version)
       "url": "https://bitbucket.xxx.com/./rest/api/1.0/projects/xxx/repos/xxx/pull-requests",
       "options": {
         "method": "post",
         "hostType": "bitbucket-server",
         "baseUrl": "https://bitbucket.xxx.com/",
         "json": {
           "title": "Update org.testcontainers.version to v1.15.2",
           "description": "This PR contains the following updates:\n\n| Package | Type | Update | Change |\n|---|---|---|---|\n| [org.testcontainers:selenium](https://testcontainers.org) ([source](https://github.com/testcontainers/testcontainers-java)) | test | patch | `1.15.1` -> `1.15.2` |\n| [org.testcontainers:mysql](https://testcontainers.org) ([source](https://github.com/testcontainers/testcontainers-java)) | test | patch | `1.15.1` -> `1.15.2` |\n| [org.testcontainers:testcontainers](https://testcontainers.org) ([source](https://github.com/testcontainers/testcontainers-java)) | test | patch | `1.15.1` -> `1.15.2` |\n\n---\n\n### Release Notes\n\n\n**testcontainers/testcontainers-java**\n\n### [`v1.15.2`](https://github.com/testcontainers/testcontainers-java/releases/1.15.2)\n\n[Compare Source](https://github.com/testcontainers/testcontainers-java/compare/1.15.1...1.15.2)\n\n##### What's Changed\n\n-   What `1984` means to you? To us, this number means PR [#&#8203;1984](https://github.com/testcontainers/testcontainers-java/issues/1984), one of the oldest PRs we had open and... finally merged! ๐Ÿ˜… Thanks to an amazing contribution by [@&#8203;seglo](https://github.com/seglo), we now provide an example of testing Kafka clusters where multiple `KafkaContainer`s are connected into one network. Try it!\n-   Another \"old\" PR is [#&#8203;3180](https://github.com/testcontainers/testcontainers-java/issues/3180) by [@&#8203;oussamabadr](https://github.com/oussamabadr). Those of you who run Selenium tests with Testcontainers will appreciate this newly added option to use (scrollable!) MP4 format instead of FLV.\n-   The connection with Ryuk (our watchdog sidecar container) now sets the socket timeout and retries the failures - helps with some rare networking edge cases. ([#&#8203;3682](https://github.com/testcontainers/testcontainers-java/issues/3682)) [@&#8203;diegolovison](https://github.com/diegolovison)\n-   The logs consumer no longer adds extra new lines thanks to [#&#8203;3752](https://github.com/testcontainers/testcontainers-java/issues/3752) by [@&#8203;perlun](https://github.com/perlun)\n-   Locally built images no longer get affected by the `hub.image.name.prefix` setting! ([#&#8203;3666](https://github.com/testcontainers/testcontainers-java/issues/3666)) [@&#8203;reda-alaoui](https://github.com/reda-alaoui)\n-   Jackson dependency is now forced to an older version to help with `NoClassDefFoundError (com/fasterxml/jackson/annotation/JsonMerge)`.\n\nAnd more!\n\n##### ๐Ÿš€ Features & Enhancements\n\n-   Switch to Presto image hosted on GHCR ([#&#8203;3667](https://github.com/testcontainers/testcontainers-java/issues/3667)) [@&#8203;findepi](https://github.com/findepi)\n-   Implement getDatabaseName() in CockroachContainer ([#&#8203;3778](https://github.com/testcontainers/testcontainers-java/issues/3778)) [@&#8203;croemmich](https://github.com/croemmich)\n-   Make recorder .flv videos scrollable ([#&#8203;512](https://github.com/testcontainers/testcontainers-java/issues/512)) ([#&#8203;3180](https://github.com/testcontainers/testcontainers-java/issues/3180)) [@&#8203;oussamabadr](https://github.com/oussamabadr)\n-   Support HTTP headers on HttpWaitStrategy ([#&#8203;2549](https://github.com/testcontainers/testcontainers-java/issues/2549)) [@&#8203;renatomefi](https://github.com/renatomefi)\n-   Show port mappings in HttpWaitStrategy ([#&#8203;2341](https://github.com/testcontainers/testcontainers-java/issues/2341)) [@&#8203;aguibert](https://github.com/aguibert)\n-   Support newer versions of CockroachDB by changing the docker command ([#&#8203;3608](https://github.com/testcontainers/testcontainers-java/issues/3608)) [@&#8203;giger85](https://github.com/giger85)\n-   Improve logging for port listener ([#&#8203;3736](https://github.com/testcontainers/testcontainers-java/issues/3736)) [@&#8203;artjomka](https://github.com/artjomka)\n-   couchbase: wait until all services are part of the config ([#&#8203;3003](https://github.com/testcontainers/testcontainers-java/issues/3003)) [@&#8203;daschl](https://github.com/daschl)\n-   Support Ryuk socket timeout ([#&#8203;3682](https://github.com/testcontainers/testcontainers-java/issues/3682)) [@&#8203;diegolovison](https://github.com/diegolovison)\n-   Add init command parameter to Vault container ([#&#8203;3188](https://github.com/testcontainers/testcontainers-java/issues/3188)) [@&#8203;tandrup](https://github.com/tandrup)\n-   Startables#deepStart with varargs ([#&#8203;3261](https://github.com/testcontainers/testcontainers-java/issues/3261)) [@&#8203;jochenchrist](https://github.com/jochenchrist)\n\n##### ๐Ÿ› Bug Fixes\n\n-   Remove extra newlines in container log output ([#&#8203;3752](https://github.com/testcontainers/testcontainers-java/issues/3752)) [@&#8203;perlun](https://github.com/perlun)\n-   Fix handling of locally built images when used with `hub.image.name.prefix` ([#&#8203;3666](https://github.com/testcontainers/testcontainers-java/issues/3666)) [@&#8203;reda-alaoui](https://github.com/reda-alaoui)\n\n##### ๐Ÿ“– Documentation\n\n-   Kafka cluster example ([#&#8203;1984](https://github.com/testcontainers/testcontainers-java/issues/1984), [#&#8203;3758](https://github.com/testcontainers/testcontainers-java/issues/3758)) [@&#8203;seglo](https://github.com/seglo)\n-   Documentation PostGIS JDBC url sample version update ([#&#8203;3606](https://github.com/testcontainers/testcontainers-java/issues/3606)) [@&#8203;aulea](https://github.com/aulea)\n-   GenericContainer: fix typo in Javadoc ([#&#8203;3684](https://github.com/testcontainers/testcontainers-java/issues/3684)) [@&#8203;perlun](https://github.com/perlun)\n-   Added documentation for Bigtable Emulator container ([#&#8203;3708](https://github.com/testcontainers/testcontainers-java/issues/3708)) [@&#8203;RamazanYapparov](https://github.com/RamazanYapparov)\n-   Clarify usage of host port exporting ([#&#8203;3421](https://github.com/testcontainers/testcontainers-java/issues/3421)) [@&#8203;alxgrk](https://github.com/alxgrk)\n-   Rename Presto to Trino ([#&#8203;3649](https://github.com/testcontainers/testcontainers-java/issues/3649)) [@&#8203;martint](https://github.com/martint)\n\n##### ๐Ÿงน Housekeeping\n\n-   update release drafter to v5.13.0 ([#&#8203;3632](https://github.com/testcontainers/testcontainers-java/issues/3632)) [@&#8203;jetersen](https://github.com/jetersen)\n-   Remove duplicated dependency in jdbc-test module ([#&#8203;3664](https://github.com/testcontainers/testcontainers-java/issues/3664)) [@&#8203;giger85](https://github.com/giger85)\n-   add github actions to dependabot config ([#&#8203;3633](https://github.com/testcontainers/testcontainers-java/issues/3633)) [@&#8203;jetersen](https://github.com/jetersen)\n-   Remove ciMate ([#&#8203;3631](https://github.com/testcontainers/testcontainers-java/issues/3631)) [@&#8203;bsideup](https://github.com/bsideup)\n\n##### ๐Ÿ“ฆ Dependency updates\n\n-   update release drafter to v5.13.0 ([#&#8203;3632](https://github.com/testcontainers/testcontainers-java/issues/3632)) [@&#8203;jetersen](https://github.com/jetersen)\n-   Force Jackson version ([#&#8203;3602](https://github.com/testcontainers/testcontainers-java/issues/3602)) [@&#8203;bsideup](https://github.com/bsideup)\n-   Bump aws-java-sdk-sqs from 1.11.884 to 1.11.930 in /modules/localstack ([#&#8203;3660](https://github.com/testcontainers/testcontainers-java/issues/3660)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump guava from 30.0-jre to 30.1-jre in /modules/jdbc-test ([#&#8203;3622](https://github.com/testcontainers/testcontainers-java/issues/3622)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump aws-java-sdk-s3 from 1.11.929 to 1.11.930 in /modules/localstack ([#&#8203;3659](https://github.com/testcontainers/testcontainers-java/issues/3659)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump org.jetbrains.kotlin.plugin.spring from 1.3.31 to 1.4.21-2 in /examples ([#&#8203;3646](https://github.com/testcontainers/testcontainers-java/issues/3646)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump gradle-update/update-gradle-wrapper-action from [`74a035c`](https://github.com/testcontainers/testcontainers-java/commit/74a035c) to 1.0.9 ([#&#8203;3653](https://github.com/testcontainers/testcontainers-java/issues/3653)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump cucumber-junit from 6.8.1 to 6.9.1 in /examples ([#&#8203;3625](https://github.com/testcontainers/testcontainers-java/issues/3625)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump testcontainers from 1.14.3 to 1.15.1 in /core ([#&#8203;3587](https://github.com/testcontainers/testcontainers-java/issues/3587)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump transport from 7.10.0 to 7.10.1 in /modules/elasticsearch ([#&#8203;3590](https://github.com/testcontainers/testcontainers-java/issues/3590)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump aws-java-sdk-s3 from 1.11.882 to 1.11.929 in /modules/localstack ([#&#8203;3654](https://github.com/testcontainers/testcontainers-java/issues/3654)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump s3 from 2.15.14 to 2.15.56 in /modules/localstack ([#&#8203;3650](https://github.com/testcontainers/testcontainers-java/issues/3650)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump org.jetbrains.kotlin.jvm from 1.3.31 to 1.4.21-2 in /examples ([#&#8203;3645](https://github.com/testcontainers/testcontainers-java/issues/3645)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump guava from 30.0-jre to 30.1-jre in /core ([#&#8203;3627](https://github.com/testcontainers/testcontainers-java/issues/3627)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump ad-m/github-push-action from [`68af989`](https://github.com/testcontainers/testcontainers-java/commit/68af9897f2b021035ca3952bf354bbb4675c1762) to 0.6.0 ([#&#8203;3658](https://github.com/testcontainers/testcontainers-java/issues/3658)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump aws-java-sdk-dynamodb from 1.11.901 to 1.11.929 in /modules/dynalite ([#&#8203;3652](https://github.com/testcontainers/testcontainers-java/issues/3652)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump gradle/wrapper-validation-action from [`e2c57ac`](https://github.com/testcontainers/testcontainers-java/commit/e2c57ac) to 1.0.3 ([#&#8203;3657](https://github.com/testcontainers/testcontainers-java/issues/3657)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Update actions/cache requirement to v2.1.3 ([#&#8203;3651](https://github.com/testcontainers/testcontainers-java/issues/3651)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump solr-solrj from 8.6.3 to 8.7.0 in /examples ([#&#8203;3446](https://github.com/testcontainers/testcontainers-java/issues/3446)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump cucumber-java from 6.8.1 to 6.9.1 in /examples ([#&#8203;3624](https://github.com/testcontainers/testcontainers-java/issues/3624)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump r2dbc-mariadb from 0.8.4-rc to 1.0.0 in /modules/mariadb ([#&#8203;3593](https://github.com/testcontainers/testcontainers-java/issues/3593)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump org.springframework.boot from 2.3.4.RELEASE to 2.4.1 in /examples ([#&#8203;3594](https://github.com/testcontainers/testcontainers-java/issues/3594)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump jedis from 3.3.0 to 3.4.0 in /examples ([#&#8203;3595](https://github.com/testcontainers/testcontainers-java/issues/3595)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump tomcat-jdbc from 9.0.40 to 10.0.0 in /modules/jdbc ([#&#8203;3592](https://github.com/testcontainers/testcontainers-java/issues/3592)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump elasticsearch-rest-client from 7.10.0 to 7.10.1 in /modules/elasticsearch ([#&#8203;3589](https://github.com/testcontainers/testcontainers-java/issues/3589)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump jedis from 3.3.0 to 3.4.0 in /core ([#&#8203;3586](https://github.com/testcontainers/testcontainers-java/issues/3586)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump rest-assured from 4.3.1 to 4.3.3 in /modules/vault ([#&#8203;3588](https://github.com/testcontainers/testcontainers-java/issues/3588)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump r2dbc-mssql from 0.8.4.RELEASE to 0.8.5.RELEASE in /modules/mssqlserver ([#&#8203;3397](https://github.com/testcontainers/testcontainers-java/issues/3397)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump mockito-core from 3.5.15 to 3.6.28 in /modules/junit-jupiter ([#&#8203;3539](https://github.com/testcontainers/testcontainers-java/issues/3539)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump mockito-core from 3.5.13 to 3.6.28 in /core ([#&#8203;3542](https://github.com/testcontainers/testcontainers-java/issues/3542)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump mssql-jdbc from 9.1.0.jre8-preview to 9.1.1.jre8-preview in /modules/mssqlserver ([#&#8203;3563](https://github.com/testcontainers/testcontainers-java/issues/3563)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump pulsar-client-admin from 2.6.1 to 2.7.0 in /modules/pulsar ([#&#8203;3566](https://github.com/testcontainers/testcontainers-java/issues/3566)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump pulsar-client from 2.6.1 to 2.7.0 in /modules/pulsar ([#&#8203;3565](https://github.com/testcontainers/testcontainers-java/issues/3565)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump json from [`2018081`](https://github.com/testcontainers/testcontainers-java/commit/20180813) to [`2020111`](https://github.com/testcontainers/testcontainers-java/commit/20201115) in /examples ([#&#8203;3567](https://github.com/testcontainers/testcontainers-java/issues/3567)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump influxdb-java from 2.20 to 2.21 in /modules/influxdb ([#&#8203;3568](https://github.com/testcontainers/testcontainers-java/issues/3568)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Bump assertj-core from 3.18.0 to 3.18.1 in /modules/vault ([#&#8203;3486](https://github.com/testcontainers/testcontainers-java/issues/3486)) [@&#8203;dependabot](https://github.com/dependabot)\n-   Upgrade Ryuk to 0.3.1 ([#&#8203;3629](https://github.com/testcontainers/testcontainers-java/issues/3629)) [@&#8203;rnorth](https://github.com/rnorth)\n\n\n\n---\n\n### Renovate configuration\n\n:date: **Schedule**: At any time (no schedule defined).\n\n:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\n\n:recycle: **Rebasing**: Whenever PR is behind base branch, or rename PR to start with \"rebase!\".\n\n:no_bell: **Ignore**: Close this PR and you won't be reminded about these updates again.\n\n---\n\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).",
           "fromRef": {"id": "refs/heads/renovate/org.testcontainers.version"},
           "toRef": {"id": "refs/heads/develop"},
           "reviewers": []
         },
         "responseType": "json",
         "headers": {
           "accept-encoding": "gzip, deflate",
           "X-Atlassian-Token": "no-check",
           "user-agent": "https://github.com/renovatebot/renovate",
           "authorization": "***********"
         },
         "hooks": {"beforeRedirect": [null]},
         "timeout": 60000
       }

Conclusion

I assume this happens, because the release-notes contain special characters, which are not "escaped"/fixed correctly.

I expected that - when the unicodeEmoji is set to false - it should escape/fix the emojis or at least remove them.

Possible workarounds or solutions

rarkins commented 3 years ago

This is the function which emojifies or not: https://github.com/renovatebot/renovate/blob/19e16ff7f0feb9228a8e40de20d67fd2c690ee70/lib/util/emoji.ts#L10-L12

But maybe the problem is that the emojies are already in the changelog. In which case we need that function to try to de-emoji too?

AB-xdev commented 3 years ago

@rarkins

But maybe the problem is that the emojies are already in the changelog.

Yes, I think this is exactly my problem.

rarkins commented 3 years ago

Looks like emoji.strip or emoji.replace might work, but it would need testing.

renovate-release commented 3 years ago

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

The release is available on:

Your semantic-release bot :package::rocket:

AB-xdev commented 3 years ago

@rarkins Thank you for the fix. Unfortunately I wasn't able to test it until now.

Emojis like ๐Ÿš€ are now filtered ๐Ÿ‘

However the fix only seems to only work partially. The pullrequest creation still fails, because there is somehow a "broom" emoji ๐Ÿงน included (which should have been filtered out): grafik

full log-file: renovate.txt

viceice commented 3 years ago

@AB-xdev Please open a new bug issue with full details. Rememer you need to set unicodeEmoji=false to get it working.