Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/containerbase/devcontainer:13.8.11
FROM ghcr.io/containerbase/devcontainer:13.8.12

# https://github.com/pnpm/pnpm/issues/8971
# renovate: datasource=npm
Expand Down
3 changes: 2 additions & 1 deletion docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,7 @@ But if you're embedding changelogs in commit information, you may use `fetchChan
Renovate can fetch changelogs when they are hosted on one of these platforms:

- Bitbucket Cloud
- Bitbucket Server / Data Center
- GitHub (.com and Enterprise Server)
- GitLab (.com and CE/EE)

Expand Down Expand Up @@ -2739,7 +2740,7 @@ To read the changelogs you must use the link.

<!-- prettier-ignore -->
!!! note
Renovate can fetch changelogs from Bitbucket, Gitea (Forgejo), GitHub and GitLab platforms only, and setting the URL to an unsupported host/platform type won't change that.
Renovate can fetch changelogs from Bitbucket, Bitbucket Server / Data Center, Gitea (Forgejo), GitHub and GitLab platforms only, and setting the URL to an unsupported host/platform type won't change that.

For more details on supported syntax see Renovate's [string pattern matching documentation](./string-pattern-matching.md).

Expand Down
2 changes: 1 addition & 1 deletion lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ const options: RenovateOptions[] = [
description:
'Change this value to override the default Renovate sidecar image.',
type: 'string',
default: 'ghcr.io/containerbase/sidecar:13.8.11',
default: 'ghcr.io/containerbase/sidecar:13.8.12',
globalOnly: true,
},
{
Expand Down
13 changes: 13 additions & 0 deletions lib/constants/platform.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BitbucketServerTagsDatasource } from '../modules/datasource/bitbucket-server-tags';
import { BitbucketTagsDatasource } from '../modules/datasource/bitbucket-tags';
import { GiteaTagsDatasource } from '../modules/datasource/gitea-tags';
import { GithubReleasesDatasource } from '../modules/datasource/github-releases';
Expand All @@ -11,6 +12,7 @@ import { id as GITHUB_CHANGELOG_ID } from '../workers/repository/update/pr/chang
import { id as GITLAB_CHANGELOG_ID } from '../workers/repository/update/pr/changelog/gitlab';
import {
BITBUCKET_API_USING_HOST_TYPES,
BITBUCKET_SERVER_API_USING_HOST_TYPES,
GITEA_API_USING_HOST_TYPES,
GITHUB_API_USING_HOST_TYPES,
GITLAB_API_USING_HOST_TYPES,
Expand Down Expand Up @@ -71,4 +73,15 @@ describe('constants/platform', () => {
).toBeTrue();
expect(BITBUCKET_API_USING_HOST_TYPES.includes('bitbucket')).toBeTrue();
});

it('should be part of the BITBUCKET_SERVER_API_USING_HOST_TYPES', () => {
expect(
BITBUCKET_SERVER_API_USING_HOST_TYPES.includes(
BitbucketServerTagsDatasource.id,
),
).toBeTrue();
expect(
BITBUCKET_SERVER_API_USING_HOST_TYPES.includes('bitbucket-server'),
).toBeTrue();
});
});
6 changes: 5 additions & 1 deletion lib/constants/platforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ export const BITBUCKET_API_USING_HOST_TYPES = [
'bitbucket-tags',
];

export const BITBUCKET_SERVER_API_USING_HOST_TYPES = ['bitbucket-server'];
export const BITBUCKET_SERVER_API_USING_HOST_TYPES = [
'bitbucket-server',
'bitbucket-server-changelog',
'bitbucket-server-tags',
];
2 changes: 2 additions & 0 deletions lib/modules/datasource/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AwsRdsDatasource } from './aws-rds';
import { AzureBicepResourceDatasource } from './azure-bicep-resource';
import { AzurePipelinesTasksDatasource } from './azure-pipelines-tasks';
import { BazelDatasource } from './bazel';
import { BitbucketServerTagsDatasource } from './bitbucket-server-tags';
import { BitbucketTagsDatasource } from './bitbucket-tags';
import { BitriseDatasource } from './bitrise';
import { BuildpacksRegistryDatasource } from './buildpacks-registry';
Expand Down Expand Up @@ -79,6 +80,7 @@ api.set(AwsRdsDatasource.id, new AwsRdsDatasource());
api.set(AzureBicepResourceDatasource.id, new AzureBicepResourceDatasource());
api.set(AzurePipelinesTasksDatasource.id, new AzurePipelinesTasksDatasource());
api.set(BazelDatasource.id, new BazelDatasource());
api.set(BitbucketServerTagsDatasource.id, new BitbucketServerTagsDatasource());
api.set(BitbucketTagsDatasource.id, new BitbucketTagsDatasource());
api.set(BitriseDatasource.id, new BitriseDatasource());
api.set(BuildpacksRegistryDatasource.id, new BuildpacksRegistryDatasource());
Expand Down
236 changes: 236 additions & 0 deletions lib/modules/datasource/bitbucket-server-tags/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
import { getDigest, getPkgReleases } from '..';
import * as httpMock from '../../../../test/http-mock';
import { HttpError } from '../../../util/http';
import { BitbucketServerTagsDatasource } from '.';

const datasource = BitbucketServerTagsDatasource.id;
const baseUrl = 'https://bitbucket.some.domain.org';
const apiBaseUrl = 'https://bitbucket.some.domain.org/rest/api/1.0/';

describe('modules/datasource/bitbucket-server-tags/index', () => {
describe('getReleases', () => {
it('returns tags', async () => {
httpMock
.scope(apiBaseUrl)
.get('/projects/some-org/repos/some-repo/tags?limit=100')
.reply(200, {
size: 3,
limit: 100,
isLastPage: true,
start: 0,
values: [
{
displayId: 'v17.7.2-deno',
hash: '430f18aa2968b244fc91ecd9f374f62301af4b63',
},
{
displayId: 'v17.7.2',
hash: null,
},
{
displayId: 'v17.7.1-deno',
hash: '974b64a175bf11c81bfabfeb4325c74e49204b77',
},
],
});

const res = await getPkgReleases({
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/some-repo',
});
expect(res).toMatchObject({
sourceUrl:
'https://bitbucket.some.domain.org/projects/some-org/repos/some-repo',
registryUrl: 'https://bitbucket.some.domain.org',
releases: [
{
version: 'v17.7.1-deno',
gitRef: 'v17.7.1-deno',
newDigest: '974b64a175bf11c81bfabfeb4325c74e49204b77',
},
{
version: 'v17.7.2-deno',
gitRef: 'v17.7.2-deno',
newDigest: '430f18aa2968b244fc91ecd9f374f62301af4b63',
},
{
version: 'v17.7.2',
gitRef: 'v17.7.2',
newDigest: undefined,
},
],
});
});

it('returns null on empty result', async () => {
httpMock
.scope(apiBaseUrl)
.get('/projects/some-org/repos/empty/tags?limit=100')
.reply(200, {});

const res = await getPkgReleases({
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/empty',
});
expect(res).toBeNull();
});

it('returns null on missing registryUrl', async () => {
const res = await getPkgReleases({
datasource,
packageName: 'some-org/notexisting',
});
expect(res).toBeNull();
});

it('handles not found', async () => {
httpMock
.scope(apiBaseUrl)
.get('/projects/some-org/repos/notexisting/tags?limit=100')
.reply(404);

const res = await getPkgReleases({
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/notexisting',
});
expect(res).toBeNull();
});
});

describe('getTagCommit', () => {
it('returns commit hash of provided tag', async () => {
httpMock
.scope(apiBaseUrl)
.get('/projects/some-org/repos/some-repo/tags/v1.0.0')
.reply(200, {
displayId: 'v1.0.0',
hash: '430f18aa2968b244fc91ecd9f374f62301af4b62',
});

const res = await getDigest(
{
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/some-repo',
},
'v1.0.0',
);
expect(res).toBe('430f18aa2968b244fc91ecd9f374f62301af4b62');
});

it('missing hash', async () => {
httpMock
.scope(apiBaseUrl)
.get('/projects/some-org/repos/some-repo/tags/v1.0.0')
.reply(200, {
displayId: 'v1.0.0',
hash: null,
});

const res = await getDigest(
{
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/some-repo',
},
'v1.0.0',
);
expect(res).toBeNull();
});
});

describe('getDigest', () => {
it('returns most recent commit hash', async () => {
httpMock
.scope(apiBaseUrl)
.get(
'/projects/some-org/repos/some-repo/commits?ignoreMissing=true&limit=1',
)
.reply(200, {
size: 1,
limit: 1,
isLastPage: false,
start: 0,
values: [
{
id: '0c95f9c79e1810cf9c8964fbf7d139009412f7e7',
displayId: '0c95f9c79e1',
},
],
});

const res = await getDigest({
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/some-repo',
});
expect(res).toBe('0c95f9c79e1810cf9c8964fbf7d139009412f7e7');
});

it('no commits', async () => {
httpMock
.scope(apiBaseUrl)
.get(
'/projects/some-org/repos/some-repo/commits?ignoreMissing=true&limit=1',
)
.reply(200, {
size: 0,
limit: 1,
isLastPage: true,
start: 0,
values: [],
});

const res = await getDigest({
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/some-repo',
});
expect(res).toBeNull();
});

it('returns null on empty result', async () => {
httpMock
.scope(apiBaseUrl)
.get(
'/projects/some-org/repos/empty/commits?ignoreMissing=true&limit=1',
)
.reply(200, {});

const res = await getDigest({
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/empty',
});
expect(res).toBeNull();
});

it('returns null on missing registryUrl', async () => {
const res = await getDigest({
datasource,
packageName: 'some-org/notexisting',
});
expect(res).toBeNull();
});

it('handles not found', async () => {
httpMock
.scope(apiBaseUrl)
.get(
'/projects/some-org/repos/notexisting/commits?ignoreMissing=true&limit=1',
)
.reply(404);

await expect(
getDigest({
registryUrls: [baseUrl],
datasource,
packageName: 'some-org/notexisting',
}),
).rejects.toThrow(HttpError);
});
});
});
Loading
Loading