Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into test/preset-custom-…
Browse files Browse the repository at this point in the history
…biome-schema
  • Loading branch information
setchy committed May 10, 2024
2 parents d05d156 + 6b0d26c commit 82fb747
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/containerbase/devcontainer:10.6.5
FROM ghcr.io/containerbase/devcontainer:10.6.6
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ jobs:
show-progress: false

- name: docker-config
uses: containerbase/internal-tools@dbc381e7a824b3777dceafc226804644311ab9a1 # v3.0.82
uses: containerbase/internal-tools@2cc75ad534e90770ee88f275701c41e4693929c1 # v3.0.83
with:
command: docker-config

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
show-progress: false

- name: 'Run analysis'
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
with:
results_file: results.sarif
results_format: sarif
Expand Down
91 changes: 91 additions & 0 deletions docs/usage/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
![Renovate banner](https://app.renovatebot.com/images/whitesource_renovate_660_220.jpg){ loading=lazy }

# Renovate documentation

Automated dependency updates.
Multi-platform and multi-language.

## Why use Renovate?

<!-- markdownlint-disable list-marker-space -->
<!-- prettier-ignore-start -->

<div class="grid cards" markdown>

- :octicons-git-pull-request-24:{ .lg .middle } __Automatic updates__

---

Get pull requests to update your dependencies and lock files.

- :octicons-calendar-24:{ .lg .middle } __On your schedule__

---

Reduce noise by scheduling when Renovate creates PRs.

- :octicons-package-24:{ .lg .middle } __Works out of the box__

---

Renovate finds relevant package files automatically, including in monorepos.

- :octicons-goal-24:{ .lg .middle } __How you like it__

---

You can customize the bot's behavior with configuration files.

- :octicons-share-24:{ .lg .middle } __Share your configuration__

---

Share your configuration with ESLint-like config presets.

- :octicons-sync-24:{ .lg .middle } __Out with the old, in with the new__

---

Get replacement PRs to migrate from a deprecated dependency to the community suggested replacement, works with _most_ managers, see [issue 14149](https://github.com/renovatebot/renovate/issues/14149) for exceptions.

- :octicons-tools-24:{ .lg .middle } __Open source__

---

Renovate is licensed under the [GNU Affero General Public License](https://github.com/renovatebot/renovate/blob/main/license).

</div>

<!-- prettier-ignore-end -->
<!-- markdownlint-enable list-marker-space -->

## Supported Platforms

Renovate works on these platforms:

- [GitHub (.com and Enterprise Server)](./modules/platform/github/index.md)
- [GitLab (.com and CE/EE)](./modules/platform/gitlab/index.md)
- [Bitbucket Cloud](./modules/platform/bitbucket/index.md)
- [Bitbucket Server](./modules/platform/bitbucket-server/index.md)
- [Azure DevOps](./modules/platform/azure/index.md)
- [AWS CodeCommit](./modules/platform/codecommit/index.md)
- [Gitea and Forgejo](./modules/platform/gitea/index.md)
- [Gerrit (experimental)](./modules/platform/gerrit/index.md)

## Who Uses Renovate?

Renovate is used by:

![Renovate Matrix](https://app.renovatebot.com/images/matrix.png){ loading=lazy }

## Ways to run Renovate

You can run Renovate as:

- an [Open Source npm package](https://www.npmjs.com/package/renovate)
- a [pre-built Open Source image on Docker Hub](https://hub.docker.com/r/renovate/renovate)

Or you can use [the Mend Renovate App](https://github.com/marketplace/renovate) which is hosted by [Mend](https://www.mend.io/).

[Install the Mend Renovate app for GitHub](https://github.com/marketplace/renovate){ .md-button .md-button--primary }
[Check out our tutorial](https://github.com/renovatebot/tutorial){ .md-button }
2 changes: 1 addition & 1 deletion lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ const options: RenovateOptions[] = [
description:
'Change this value to override the default Renovate sidecar image.',
type: 'string',
default: 'ghcr.io/containerbase/sidecar:10.6.5',
default: 'ghcr.io/containerbase/sidecar:10.6.6',
globalOnly: true,
},
{
Expand Down
131 changes: 131 additions & 0 deletions lib/config/presets/internal/regex-managers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,127 @@ describe('config/presets/internal/regex-managers', () => {
});
});

describe('Update `_VERSION` variables in Bitbucket Pipelines', () => {
const customManager =
presets['bitbucketPipelinesVersions'].customManagers?.[0];

it(`find dependencies in file`, async () => {
const fileContent = codeBlock`
script:
# renovate: datasource=docker depName=node versioning=docker
- export NODE_VERSION=18
# renovate: datasource=npm depName=pnpm
- export PNPM_VERSION="7.25.1"
# renovate: datasource=npm depName=yarn
- export YARN_VERSION 3.3.1
# renovate: datasource=custom.hashicorp depName=consul
- export CONSUL_VERSION 1.3.1
# renovate: datasource=github-releases depName=kubernetes-sigs/kustomize versioning=regex:^(?<compatibility>.+)/v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$ extractVersion=^kustomize/(?<version>.+)$
- export KUSTOMIZE_VERSION v5.2.1
- pipe: something/cool:latest
variables:
# renovate: datasource=docker depName=node versioning=docker
NODE_VERSION: 18
# renovate: datasource=npm depName=pnpm
PNPM_VERSION:"7.25.1"
# renovate: datasource=npm depName=yarn
YARN_VERSION: '3.3.1'
- echo $NODE_VERSION
`;

const res = await extractPackageFile(
fileContent,
'bitbucket-pipelines.yml',
customManager!,
);

expect(res?.deps).toMatchObject([
{
currentValue: '18',
datasource: 'docker',
depName: 'node',
replaceString:
'# renovate: datasource=docker depName=node versioning=docker\n - export NODE_VERSION=18\n',
versioning: 'docker',
},
{
currentValue: '7.25.1',
datasource: 'npm',
depName: 'pnpm',
replaceString:
'# renovate: datasource=npm depName=pnpm\n - export PNPM_VERSION="7.25.1"\n',
},
{
currentValue: '3.3.1',
datasource: 'npm',
depName: 'yarn',
replaceString:
'# renovate: datasource=npm depName=yarn\n - export YARN_VERSION 3.3.1\n',
},
{
currentValue: '1.3.1',
datasource: 'custom.hashicorp',
depName: 'consul',
replaceString:
'# renovate: datasource=custom.hashicorp depName=consul\n - export CONSUL_VERSION 1.3.1\n',
},
{
currentValue: 'v5.2.1',
datasource: 'github-releases',
depName: 'kubernetes-sigs/kustomize',
replaceString:
'# renovate: datasource=github-releases depName=kubernetes-sigs/kustomize versioning=regex:^(?<compatibility>.+)/v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$ extractVersion=^kustomize/(?<version>.+)$\n - export KUSTOMIZE_VERSION v5.2.1\n',
extractVersion: '^kustomize/(?<version>.+)$',
versioning:
'regex:^(?<compatibility>.+)/v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$',
},
{
currentValue: '18',
datasource: 'docker',
depName: 'node',
replaceString:
'# renovate: datasource=docker depName=node versioning=docker\n NODE_VERSION: 18\n',
versioning: 'docker',
},
{
currentValue: '7.25.1',
datasource: 'npm',
depName: 'pnpm',
replaceString:
'# renovate: datasource=npm depName=pnpm\n PNPM_VERSION:"7.25.1"\n',
},
{
currentValue: '3.3.1',
datasource: 'npm',
depName: 'yarn',
replaceString:
"# renovate: datasource=npm depName=yarn\n YARN_VERSION: '3.3.1'\n",
},
]);
});

describe('matches regexes patterns', () => {
it.each`
path | expected
${'bitbucket-pipelines.yml'} | ${true}
${'bitbucket-pipelines.yaml'} | ${true}
${'foo/bitbucket-pipelines.yml'} | ${true}
${'foo/bitbucket-pipelines.yaml'} | ${true}
${'foo/bar/bitbucket-pipelines.yml'} | ${true}
${'foo/bar/bitbucket-pipelines.yaml'} | ${true}
${'bitbucket-pipelines'} | ${false}
`('$path', ({ path, expected }) => {
expect(regexMatches(path, customManager!.fileMatch)).toBe(expected);
});
});
});

describe('Update `_VERSION` variables in Dockerfiles', () => {
const customManager = presets['dockerfileVersions'].customManagers?.[0];

Expand All @@ -57,6 +178,9 @@ describe('config/presets/internal/regex-managers', () => {
# renovate: datasource=npm depName=pnpm
ENV PNPM_VERSION="7.25.1"
# renovate: datasource=npm depName=pnpm
ENV PNPM_VERSION='7.25.1'
# renovate: datasource=npm depName=yarn
ENV YARN_VERSION 3.3.1
Expand Down Expand Up @@ -91,6 +215,13 @@ describe('config/presets/internal/regex-managers', () => {
replaceString:
'# renovate: datasource=npm depName=pnpm\nENV PNPM_VERSION="7.25.1"\n',
},
{
currentValue: '7.25.1',
datasource: 'npm',
depName: 'pnpm',
replaceString:
"# renovate: datasource=npm depName=pnpm\nENV PNPM_VERSION='7.25.1'\n",
},
{
currentValue: '3.3.1',
datasource: 'npm',
Expand Down
14 changes: 13 additions & 1 deletion lib/config/presets/internal/regex-managers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ export const presets: Record<string, Preset> = {
description:
'Update `$schema` version in `biome.json` configuration files.',
},
bitbucketPipelinesVersions: {
customManagers: [
{
customType: 'regex',
fileMatch: ['(^|/)bitbucket-pipelines\\.ya?ml$'],
matchStrings: [
'# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?(?: registryUrl=(?<registryUrl>[^\\s]+?))?\\s+.*\\s+[A-Za-z0-9_]+?_VERSION[ =:]\\s?["\']?(?<currentValue>.+?)["\']?\\s',
],
},
],
description: 'Update `_VERSION` variables in Bitbucket Pipelines',
},
dockerfileVersions: {
customManagers: [
{
Expand All @@ -27,7 +39,7 @@ export const presets: Record<string, Preset> = {
'(^|/)([Dd]ocker|[Cc]ontainer)file[^/]*$',
],
matchStrings: [
'# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?(?: registryUrl=(?<registryUrl>[^\\s]+?))?\\s(?:ENV|ARG) .+?_VERSION[ =]"?(?<currentValue>.+?)"?\\s',
'# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?(?: registryUrl=(?<registryUrl>[^\\s]+?))?\\s(?:ENV|ARG)\\s+[A-Za-z0-9_]+?_VERSION[ =]["\']?(?<currentValue>.+?)["\']?\\s',
],
},
],
Expand Down
3 changes: 0 additions & 3 deletions tools/docs/test/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ describe('index', async () => {
const todo = await glob('**/*.md', { cwd: 'tmp/docs' });
const files = new Set(todo);

// Files from https://github.com/renovatebot/renovatebot.github.io/tree/main/src
files.add('index.md');

let c = 0;

for (const file of todo) {
Expand Down

0 comments on commit 82fb747

Please sign in to comment.