Skip to content

Commit

Permalink
Merge branch 'main' into implement-custom-headers-2
Browse files Browse the repository at this point in the history
  • Loading branch information
hersentino authored Jan 15, 2024
2 parents 438d7e0 + 8ea6078 commit 257892d
Show file tree
Hide file tree
Showing 36 changed files with 532 additions and 236 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:9.31.3
FROM ghcr.io/containerbase/devcontainer:9.31.4
4 changes: 2 additions & 2 deletions .github/actions/calculate-prefetch-matrix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ runs:
- name: Check cache miss for MacOS
id: macos-cache
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: node_modules
key: ${{ env.MACOS_KEY }}
Expand All @@ -43,7 +43,7 @@ runs:

- name: Check cache miss for Windows
id: windows-cache
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: node_modules
key: ${{ env.WINDOWS_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ runs:
- name: Restore `node_modules`
id: node-modules-restore
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: node_modules
key: ${{ env.CACHE_KEY }}
Expand Down Expand Up @@ -67,7 +67,7 @@ runs:

- name: Write `node_modules` cache
if: inputs.save-cache == 'true' && env.CACHE_HIT != 'true'
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache/save@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: node_modules
key: ${{ env.CACHE_KEY }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ jobs:
os: ${{ runner.os }}

- name: Restore eslint cache
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: .cache/eslint
key: eslint-main-cache
Expand All @@ -200,7 +200,7 @@ jobs:
- name: Save eslint cache
if: github.event_name == 'push'
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache/save@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: .cache/eslint
key: eslint-main-cache
Expand All @@ -224,7 +224,7 @@ jobs:
os: ${{ runner.os }}

- name: Restore prettier cache
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: .cache/prettier
key: prettier-main-cache
Expand All @@ -243,7 +243,7 @@ jobs:
- name: Save prettier cache
if: github.event_name == 'push'
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache/save@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: .cache/prettier
key: prettier-main-cache
Expand Down Expand Up @@ -328,7 +328,7 @@ jobs:
os: ${{ runner.os }}

- name: Cache jest
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: .cache/jest
key: |
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ nav:
- ... | getting-started
- Troubleshooting: 'troubleshooting.md'
- Configuration:
- 'Self-hosted': 'self-hosted-configuration.md'
- 'Repository': 'configuration-options.md'
- 'Self-hosted': 'self-hosted-configuration.md'
- 'Presets': 'config-presets.md'
- 'Validation': 'config-validation.md'
- ... | key-concepts
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ To get access to the token a custom Renovate Docker image is needed that include
The Dockerfile to create such an image can look like this:
```Dockerfile
FROM renovate/renovate:37.126.2
FROM renovate/renovate:37.131.0
# Include the "Docker tip" which you can find here https://cloud.google.com/sdk/docs/install
# under "Installation" for "Debian/Ubuntu"
RUN ...
Expand Down
12 changes: 11 additions & 1 deletion docs/usage/self-hosted-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ description: Self-Hosted configuration usable in config file, CLI or environment

# Self-Hosted configuration options

You can only use these configuration options when you're self-hosting Renovate.
Only use these configuration options when you _self-host_ Renovate.

Do _not_ put the self-hosted config options listed on this page in your "repository config" file (`renovate.json` for example), because Renovate will ignore those config options, and may also create a config error issue.

The config options below _must_ be configured in the bot/admin config, so in either a environment variable, CLI option, or a special file like `config.js`.

Please also see [Self-Hosted Experimental Options](./self-hosted-experimental.md).

Expand Down Expand Up @@ -944,6 +948,12 @@ This is currently applicable to `npm` only, and only used in cases where bugs in
If enabled emoji shortcodes are replaced with their Unicode equivalents.
For example: `:warning:` will be replaced with `⚠️`.

## useCloudMetadataServices

Some cloud providers offer services to receive metadata about the current instance, for example [AWS Instance metadata](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html)
or [GCP VM metadata](https://cloud.google.com/compute/docs/metadata/overview).
Use this option to control whether Renovate should try to access these services.

## username

You may need to set a `username` if you:
Expand Down
10 changes: 9 additions & 1 deletion lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ const options: RenovateOptions[] = [
default: false,
globalOnly: true,
},
{
name: 'useCloudMetadataServices',
description:
'If `false`, Renovate does not try to access cloud metadata services.',
type: 'boolean',
default: true,
globalOnly: true,
},
{
name: 'allowPostUpgradeCommandTemplating',
description:
Expand Down Expand Up @@ -409,7 +417,7 @@ const options: RenovateOptions[] = [
description:
'Change this value to override the default Renovate sidecar image.',
type: 'string',
default: 'ghcr.io/containerbase/sidecar:9.31.3',
default: 'ghcr.io/containerbase/sidecar:9.31.4',
globalOnly: true,
},
{
Expand Down
4 changes: 4 additions & 0 deletions lib/config/presets/internal/monorepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,14 @@ const repoGroups = {
],
groovy: 'https://github.com/apache/groovy',
'grpc-dotnet': 'https://github.com/grpc/grpc-dotnet',
'grpc-java': 'https://github.com/grpc/grpc-java',
guava: 'https://github.com/google/guava',
Hangfire: 'https://github.com/HangfireIO/Hangfire',
'hickory-dns': 'https://github.com/hickory-dns/hickory-dns',
'infrastructure-ui': 'https://github.com/instructure/instructure-ui',
'ionic-native': 'https://github.com/ionic-team/ionic-native',
istanbuljs: 'https://github.com/istanbuljs/istanbuljs',
jackson: 'https://github.com/FasterXML/jackson',
jasmine: 'https://github.com/jasmine/jasmine',
javahamcrest: 'https://github.com/hamcrest/JavaHamcrest',
javascriptengineswitcher:
Expand Down Expand Up @@ -390,6 +392,7 @@ const repoGroups = {
'opentelemetry-erlang-contrib':
'https://github.com/open-telemetry/opentelemetry-erlang-contrib',
'opentelemetry-go': 'https://github.com/open-telemetry/opentelemetry-go',
'opentelemetry-java': 'https://github.com/open-telemetry/opentelemetry-java',
'opentelemetry-js': 'https://github.com/open-telemetry/opentelemetry-js',
orleans: 'https://github.com/dotnet/orleans',
'panda-css': 'https://github.com/chakra-ui/panda',
Expand Down Expand Up @@ -443,6 +446,7 @@ const repoGroups = {
'shopify-app-bridge': 'https://github.com/Shopify/app-bridge',
'sitecore-jss': 'https://github.com/Sitecore/jss',
skiasharp: 'https://github.com/mono/SkiaSharp',
slf4j: 'https://github.com/qos-ch/slf4j',
'spectre-console': 'https://github.com/spectreconsole/spectre.console',
springfox: 'https://github.com/springfox/springfox',
steeltoe: 'https://github.com/SteeltoeOSS/steeltoe',
Expand Down
5 changes: 4 additions & 1 deletion lib/config/presets/internal/regex-managers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export const presets: Record<string, Preset> = {
customManagers: [
{
customType: 'regex',
fileMatch: ['^.github/(?:workflows|actions)/.+\\.ya?ml$'],
fileMatch: [
'(^|/)(workflow-templates|\\.(?:github|gitea|forgejo)/(?:workflows|actions))/.+\\.ya?ml$',
'(^|/)action\\.ya?ml$',
],
matchStrings: [
'# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (?:lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?\\s+[A-Za-z0-9_]+?_VERSION\\s*:\\s*["\']?(?<currentValue>.+?)["\']?\\s',
],
Expand Down
1 change: 1 addition & 0 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export interface GlobalOnlyConfig {
repositories?: RenovateRepository[];
platform?: PlatformId;
endpoint?: string;
useCloudMetadataServices?: boolean;
}

// Config options used within the repository worker, but not user configurable
Expand Down
6 changes: 5 additions & 1 deletion lib/config/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ export async function validateConfig(
});
continue;
}
if (parentPath && topLevelObjects.includes(key)) {
if (
parentPath &&
parentPath !== 'onboardingConfig' &&
topLevelObjects.includes(key)
) {
errors.push({
topic: 'Configuration Error',
message: `The "${key}" object can only be configured at the top level of a config but was found inside "${parentPath}"`,
Expand Down
8 changes: 8 additions & 0 deletions lib/modules/datasource/docker/common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ describe('modules/datasource/docker/common', () => {
registryHost: 'https://index.docker.io',
},
},
{
name: 'registry-1.docker.io/bitnamicharts/cert-manager',
url: 'https://index.docker.io',
res: {
dockerRepository: 'bitnamicharts/cert-manager',
registryHost: 'https://index.docker.io',
},
},
])('($name, $url)', ({ name, url, res }) => {
expect(getRegistryRepository(name, url)).toStrictEqual(res);
});
Expand Down
7 changes: 3 additions & 4 deletions lib/modules/datasource/docker/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,9 @@ export function getRegistryRepository(
dockerRepository = `${trimTrailingSlash(path)}/${dockerRepository}`;
}

registryHost = registryHost.replace(
'https://docker.io',
'https://index.docker.io',
);
registryHost = registryHost
.replace('https://docker.io', 'https://index.docker.io')
.replace('https://registry-1.docker.io', 'https://index.docker.io');

const opts = hostRules.find({
hostType: dockerDatasourceId,
Expand Down
41 changes: 41 additions & 0 deletions lib/modules/datasource/docker/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,47 @@ describe('modules/datasource/docker/index', () => {
});
});

it('Uses Docker Hub tags for registry-1.docker.io', async () => {
process.env.RENOVATE_X_DOCKER_HUB_TAGS = 'true';
httpMock
.scope(dockerHubUrl)
.get('/library/node/tags?page_size=1000')
.reply(200, {
next: `${dockerHubUrl}/library/node/tags?page=2&page_size=1000`,
results: [
{
name: '1.0.0',
tag_last_pushed: '2021-01-01T00:00:00.000Z',
digest: 'aaa',
},
],
})
.get('/library/node/tags?page=2&page_size=1000')
.reply(200, {
results: [
{
name: '0.9.0',
tag_last_pushed: '2020-01-01T00:00:00.000Z',
digest: 'bbb',
},
],
});
const res = await getPkgReleases({
datasource: DockerDatasource.id,
packageName: 'registry-1.docker.io/library/node',
});
expect(res?.releases).toMatchObject([
{
version: '0.9.0',
releaseTimestamp: '2020-01-01T00:00:00.000Z',
},
{
version: '1.0.0',
releaseTimestamp: '2021-01-01T00:00:00.000Z',
},
]);
});

it('adds library/ prefix for Docker Hub (implicit)', async () => {
process.env.RENOVATE_X_DOCKER_HUB_TAGS = 'true';
const tags = ['1.0.0'];
Expand Down
42 changes: 42 additions & 0 deletions lib/modules/datasource/go/base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { mockDeep } from 'jest-mock-extended';
import { Fixtures } from '../../../../test/fixtures';
import * as httpMock from '../../../../test/http-mock';
import { mocked } from '../../../../test/util';
import { GlobalConfig } from '../../../config/global';
import * as _hostRules from '../../../util/host-rules';
import { GitTagsDatasource } from '../git-tags';
import { GithubTagsDatasource } from '../github-tags';
Expand Down Expand Up @@ -34,6 +35,7 @@ describe('modules/datasource/go/base', () => {
beforeEach(() => {
hostRules.find.mockReturnValue({});
hostRules.hosts.mockReturnValue([]);
GlobalConfig.reset();
});

describe('meta name=go-source', () => {
Expand Down Expand Up @@ -394,6 +396,46 @@ describe('modules/datasource/go/base', () => {

expect(res).toBeNull();
});

it('it correctly splits a URL where the endpoint is contained', async () => {
hostRules.hostType.mockReturnValue('gitlab');

GlobalConfig.set({ endpoint: 'https://example.com/gitlab/api/v4/' });

const meta =
'<meta name="go-import" content="example.com/gitlab/my-project/my-repo.git git https://example.com/gitlab/my-project/my-repo" />';
httpMock
.scope('https://example.com')
.get('/gitlab/my-project/my-repo.git?go-get=1')
.reply(200, meta);

const res = await BaseGoDatasource.getDatasource(
'example.com/gitlab/my-project/my-repo.git',
);

expect(res).toEqual({
datasource: GitlabTagsDatasource.id,
packageName: 'my-project/my-repo',
registryUrl: 'https://example.com/gitlab/',
});

GlobalConfig.set({ endpoint: 'https://example.com/gitlab/' });

httpMock
.scope('https://example.com')
.get('/gitlab/my-project/my-repo.git?go-get=1')
.reply(200, meta);

const res2 = await BaseGoDatasource.getDatasource(
'example.com/gitlab/my-project/my-repo.git',
);

expect(res2).toEqual({
datasource: GitlabTagsDatasource.id,
packageName: 'my-project/my-repo',
registryUrl: 'https://example.com/gitlab/',
});
});
});
});
});
Loading

0 comments on commit 257892d

Please sign in to comment.