From 3f3cbd8b9ba4fd27a3008b65ebd69d8842ff5059 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 8 Dec 2020 12:32:48 +0100 Subject: [PATCH] docs: add bitbucket samples (#99) Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> --- README.md | 4 +-- docs/bitbucket.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 docs/bitbucket.md diff --git a/README.md b/README.md index 27d6f4d65..20ec38a4d 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ For the `latest` image see [here](https://github.com/renovatebot/docker-renovate ## Usage -See [docs](https://docs.renovatebot.com/self-hosting/) for additional information to self-hosting renovate with docker. +Read the [self-hosting docs](https://docs.renovatebot.com/self-hosting/) for more information on how to self-host Renovate with Docker. -See [Gitlab docs](./docs/gitlab.md) for some gitlab configuration samples. +See [Gitlab](./docs/gitlab.md) or [Bitbucket](./docs/bitbucket.md) docs for more configuration samples. ### Samples diff --git a/docs/bitbucket.md b/docs/bitbucket.md new file mode 100644 index 000000000..3ed9f33ec --- /dev/null +++ b/docs/bitbucket.md @@ -0,0 +1,87 @@ +# Samples for Bitbucket pipelines + +These are configuration examples for running a self-hosted Renovate on bitbucket.org pipelines. + +### bitbucket-pipelines.yml +```yml +image: renovate/renovate:23.96.2-slim + +definitions: + caches: + renovate: renovate + +pipelines: + default: + - step: + name: renovate dry-run + services: + - docker + caches: + - docker + script: + - export LOG_LEVEL=debug RENOVATE_CONFIG_FILE="$BITBUCKET_CLONE_DIR/config.js" + - renovate --dry-run + branches: + master: + - step: + name: renovate + services: + - docker + caches: + - docker + script: + - export LOG_LEVEL=debug RENOVATE_CONFIG_FILE="$BITBUCKET_CLONE_DIR/config.js" + - renovate +``` + +### config.js +Example of manual repository config: +```js +module.exports = { + platform: 'bitbucket', + username: process.env.USERNAME, + password: process.env.PASSWORD, + baseDir: `${process.env.BITBUCKET_CLONE_DIR}/renovate`, + repositories: [ "user1/repo1", "orh/repo2" ], +} +``` + +Using autodiscover: +```js +module.exports = { + platform: 'bitbucket', + username: process.env.USERNAME, + password: process.env.PASSWORD, + baseDir: `${process.env.BITBUCKET_CLONE_DIR}/renovate`, + autodiscover: true, +} +``` + +### renovate.json +Use this for self-update Renovate: +```json +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ "config:base" ], + "regexManagers": [ + { + "fileMatch": ["^bitbucket-pipelines.yml$"], + "matchStrings": [ + "image: (?[a-z/-]+)(?::(?[a-z0-9.-]+))?(?:@(?sha256:[a-f0-9]+))?" + ], + "datasourceTemplate": "docker", + "versioningTemplate": "docker" + } + ] +} +``` + +### Variables +You need to define pipeline variables: +- `USERNAME`: Bitbucket.org username +- `PASSWORD`: Bitbucket.org password +- `GITHUB_COM_TOKEN`: GitHub token to fetch changelog (optional, highly recommended) + +### Schedule + +Configure a `hourly` schedule on `master` branch with `branches: master` pipeline.