Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Latest commit

 

History

History
92 lines (74 loc) · 2.02 KB

bitbucket.md

File metadata and controls

92 lines (74 loc) · 2.02 KB

Samples for Bitbucket pipelines

These are configuration examples for running a self-hosted Renovate on bitbucket.org pipelines. The pipeline should also work on shared runners.

bitbucket-pipelines.yml

image: renovate/renovate:37.172.2

definitions:
  caches:
    renovate: renovate

pipelines:
  default:
    - step:
        name: renovate dry-run
        caches:
          - renovate
        script:
          - export LOG_LEVEL=debug RENOVATE_CONFIG_FILE="$BITBUCKET_CLONE_DIR/config.js"
          - renovate --dry-run
  branches:
    master:
      - step:
          name: renovate
          caches:
            - renovate
          script:
            - export LOG_LEVEL=debug RENOVATE_CONFIG_FILE="$BITBUCKET_CLONE_DIR/config.js"
            - renovate

config.js

Example of manual repository config:

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:

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:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [ "config:base" ],
   "regexManagers": [
    {
      "fileMatch": ["^bitbucket-pipelines.yml$"],
      "matchStrings": [
        "image: (?<depName>[a-z/-]+)(?::(?<currentValue>[a-z0-9.-]+))?(?:@(?<currentDigest>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.