renovatebot / config-help

Please use the Discussions feature of https://github.com/renovatebot/renovate instead
https://github.com/renovatebot/renovate/discussions
MIT License
27 stars 16 forks source link

Error when using self hosted renovate setup on local bitbucket server #939

Closed n00bc0der89 closed 4 years ago

n00bc0der89 commented 4 years ago

Which Renovate are you using?

Renovate docker image

Used this command: docker run --rm -v "C:\Users\XYZ\renovateConfig\renovate.js:/usr/src/app/config.js" -e LOG_LEVEL=debug renovate/renovate

Which platform are you using?

Bitbucket Server I have self hosted this bitbucket server which is running on localhost:7990

Have you checked the logs? Don't forget to include them if relevant

Config file i am using -

module.exports = {
    platform: "bitbucket-server",
    username: "<bitbucket-username>",
    password: "<bitbucket-user-accesstoken>",
    endpoint: "http://localhost:7990/",
    logFileLevel: 'warn',
    logLevel: 'debug',
    logFile: '/usr/src/app/renovate.log',
    repositories: ["doc/openjdk"],
    onboarding: true,
    onboardingConfig: {
        extends: ['config:base'],
    },
  }; 

Here, openjdk repo under doc project has a Dockerfile.

What would you like to do?

As i am pretty new to renovate and its config, I was expecting renovate to connect the local bitbucket server and scan the repo for the Dockerfile and analyse the version

However, i am facing below error

$   docker run --rm -v "C:\Users\XYZ\renovateConfig\renovate.js:/usr/src/app/config.js" -e LOG_LEVEL=debug  renovate/renovate
DEBUG: Using RE2 as regex engine
DEBUG: Parsing configs
DEBUG: Checking for config file in /usr/src/app/config
DEBUG: Enabling warn logging to /usr/src/app/renovate.log
DEBUG: File config
       "config": {
         "platform": "bitbucket-server",
         "username": "testuser",
         "password": "***********",
         "endpoint": "http://localhost:7990/",
         "logFileLevel": "warn",
         "logLevel": "debug",
         "logFile": "/usr/src/app/renovate.log",
         "repositories": ["doc/openjdk"],
         "onboarding": true,
         "onboardingConfig": {"extends": ["config:base"]}
       }
DEBUG: CLI config
       "config": {}
DEBUG: Env config
       "config": {"hostRules": [], "logLevel": "debug"}
DEBUG: Combined config
       "config": {
         "platform": "bitbucket-server",
         "username": "testuser",
         "password": "***********",
         "endpoint": "http://localhost:7990/",
         "logFileLevel": "warn",
         "logLevel": "debug",
         "logFile": "/usr/src/app/renovate.log",
         "repositories": ["doc/openjdk"],
         "onboarding": true,
         "onboardingConfig": {"extends": ["config:base"]},
         "hostRules": []
       }
DEBUG: Adding trailing slash to endpoint
DEBUG: Using default gitAuthor: Renovate Bot <renovate@whitesourcesoftware.com>
DEBUG: Using baseDir: /tmp/renovate
DEBUG: Using cacheDir: /tmp/renovate/cache
DEBUG: Initializing Renovate internal cache into /tmp/renovate/cache/renovate/renovate-cache-v1
DEBUG: Commits limit = null
 INFO: Repository started (repository=doc/openjdk)
       "renovateVersion": "23.56.0"
DEBUG: Using localDir: /tmp/renovate/repos/bitbucket-server/doc/openjdk (repository=doc/openjdk)
DEBUG: initRepo("{
         "repository": "doc/openjdk",
         "localDir": "/tmp/renovate/repos/bitbucket-server/doc/openjdk"
       }") (repository=doc/openjdk)
DEBUG: git error (repository=doc/openjdk)
       "err": {
         "task": {
           "concatStdErr": false,
           "format": "utf-8",
           "commands": [
             "ls-remote",
             "--heads",
             "http://testuser:<bitbucket-user-access-token>@localhost:7990/scm/doc/openjdk.git"
           ]
         },
         "message": "fatal: unable to access 'http://localhost:7990/scm/doc/openjdk.git/': Failed to connect to localhost port 7990: Connection refused\n",
         "stack": "Error: fatal: unable to access 'http://localhost:7990/scm/doc/openjdk.git/': Failed to connect to localhost port 7990: Connection refused\n\n    at GitExecutorChain.onFatalException
(/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:66:77)\n    at GitExecutorChain.<anonymous> (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:58:21)\n    at Generator.throw (<anonymous>)\n    at rejected (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.js:6:65)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)"
       }
ERROR: Repository has unknown error (repository=doc/openjdk)
       "err": {
         "task": {
           "concatStdErr": false,
           "format": "utf-8",
           "commands": [
             "ls-remote",
             "--heads",
             "http://testuser:<bitbucket-user-access-token>@localhost:7990/scm/doc/openjdk.git"
           ]
         },
         "message": "fatal: unable to access 'http://localhost:7990/scm/doc/openjdk.git/': Failed to connect to localhost port 7990: Connection refused\n",
         "stack": "Error: fatal: unable to access 'http://localhost:7990/scm/doc/openjdk.git/': Failed to connect to localhost port 7990: Connection refused\n\n    at GitExecutorChain.onFatalException
(/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:66:77)\n    at GitExecutorChain.<anonymous> (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:58:21)\n    at Generator.throw (<anonymous>)\n    at rejected (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.js:6:65)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)"
       }
DEBUG: Unknown res (repository=doc/openjdk)
       "res": "unknown-error"
DEBUG: Repository timing splits (milliseconds) (repository=doc/openjdk)
       "splits": {},
       "total": 45
 INFO: Repository finished (repository=doc/openjdk)
       "durationMs": 45
DEBUG: Renovate exiting
 INFO: Renovate is exiting with a non-zero code due to the following logged errors
       "loggerErrors": [
         {
           "name": "renovate",
           "level": 50,
           "logContext": "u3vAU1-9R",
           "repository": "doc/openjdk",
           "err": {
             "task": {
               "concatStdErr": false,
               "format": "utf-8",
               "commands": [
                 "ls-remote",
                 "--heads",
                 "http://testuser:<bitbucket-user-access-token>@localhost:7990/scm/doc/openjdk.git"
               ]
             },
             "message": "fatal: unable to access 'http://localhost:7990/scm/doc/openjdk.git/': Failed to connect to localhost port 7990: Connection refused\n",
             "stack": "Error: fatal: unable to access 'http://localhost:7990/scm/doc/openjdk.git/': Failed to connect to localhost port 7990: Connection refused\n\n    at GitExecutorChain.onFatalException (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:66:77)\n    at GitExecutorChain.<anonymous> (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:58:21)\n    at Generator.throw (<anonymous>)\n    at rejected (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.js:6:65)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)"
           },
           "msg": "Repository has unknown error"
         }
       ]
rarkins commented 4 years ago

It's not going to work if you run Renovate in a container but ask it to connect to localhost. Inside a container localhost IS the container - not your PC that's running Docker.

Is Bitbucket also running within a container? If so then perhaps you can expose it to Renovate from within Docker.

Otherwise you need to follow something like this: https://nickjanetakis.com/blog/docker-tip-65-get-your-docker-hosts-ip-address-from-in-a-container

n00bc0der89 commented 4 years ago

Thanks rarkins, yeah i had both service running as a container. i could make the renovate locate the bitbucket server using the network mode bridge and using the docker provided IP for the bitbucket server within the renovate config.