Skip to content

Commit

Permalink
Merge branch 'main' into feat/dockerfile-filematch-lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
dotboris committed May 1, 2023
2 parents 0a4e15d + 619cc51 commit 85aecb7
Show file tree
Hide file tree
Showing 22 changed files with 586 additions and 434 deletions.
8 changes: 6 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Expand Up @@ -3,12 +3,16 @@ description: Bug reports are only for maintainers. If you are a Renovate user, c
labels:
['type:bug', 'status:requirements', 'priority-5-triage', 'needs-discussion']
body:
- type: markdown
attributes:
value: '# This form is for Renovate maintainers only.'

- type: markdown
attributes:
value: |
STOP! Only create a Bug Report if you're a maintainer of Renovate.
**Stop!** Only create a Bug Report if you're a maintainer of Renovate.
If you're a user of Renovate, please create a GitHub Discussion.
Please go back a step and select Discussion instead of Issue.
Please go back a step and select _Start a discussion_ instead of Issue.
- type: dropdown
id: how-are-you-running-renovate
Expand Down
14 changes: 12 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
@@ -1,7 +1,17 @@
name: Feature request
description: For maintainers only. For everyone else, please start an Ideas [discussion](https://github.com/renovatebot/renovate/discussions/new).
labels: ['type:feature', 'status:requirements', 'priority-5-triage']
description: For maintainers only. For everyone else, please start an Ideas discussion.
labels:
[
'type:feature',
'status:requirements',
'priority-5-triage',
'needs-discussion',
]
body:
- type: markdown
attributes:
value: '# This form is for Renovate maintainers only.'

- type: textarea
id: what-would-you-like-renovate-to-be-able-to-do
attributes:
Expand Down
10 changes: 8 additions & 2 deletions .github/ISSUE_TEMPLATE/refactor.yml
@@ -1,6 +1,12 @@
name: Refactor (internal)
description: For internal use only.
labels: ['type:refactor', 'status:requirements', 'priority-5-triage']
description: For maintainers only.
labels:
[
'type:refactor',
'status:requirements',
'priority-5-triage',
'needs-discussion',
]
body:
- type: markdown
attributes:
Expand Down
1 change: 0 additions & 1 deletion .releaserc
Expand Up @@ -17,7 +17,6 @@
[
"@semantic-release/exec",
{
"verifyConditionsCmd": "run-s verify",
"prepareCmd": "run-s \"release:prepare -- {@}\" -- --release=${nextRelease.version} --sha=${nextRelease.gitHead} --tag=${nextRelease.channel}",
"publishCmd": "run-s \"release:publish -- {@}\" -- --release=${nextRelease.version} --sha=${nextRelease.gitHead} --tag=${nextRelease.channel}"
}
Expand Down
45 changes: 40 additions & 5 deletions docs/development/adding-a-package-manager.md
Expand Up @@ -14,11 +14,23 @@ Common application logic for Renovate, not specific to particular managers, usua

The manager's `index.ts` file supports the following values/functions:

- extractPackageFile
- extractAllPackageFiles
- getRangeStrategy (optional)
- language (optional)
- supportsLockFileMaintenance (optional)
| Value/function | Optional | Async |
| ----------------------------- | -------- | ----- |
| `bumpPackageVersion` | yes | |
| `extractPackageFile` | | yes |
| `extractAllPackageFiles` | yes | yes |
| `getRangeStrategy` | yes | |
| `language` | yes | |
| `supportsLockFileMaintenance` | yes | |
| `updateArtifacts` | yes | yes |
| `updateDependency` | yes | |
| `updateLockedDependency` | yes | |

### `bumpPackageVersion` (optional)

Use this function to allow version bumps of updated packages.
For example, to increase the version of a Maven module if a package has been updated.
Another example would be to bump the Helm chart version, if a subchart version has been updated.

### `extractPackageFile(content, packageFile, config)` (async, semi-mandatory)

Expand Down Expand Up @@ -67,3 +79,26 @@ This is used when more than one package manager shares settings from a common la
### `supportsLockFileMaintenance` (optional)

Set to true if this package manager needs to update lock files in addition to package files.

### `updateArtifacts` (async, optional)

Use `updateArtifacts` to run binaries that in turn will update files.
`updateArtifacts` is often used to indirectly update lock files.

To _directly_ update dependencies in lock files: use `updateLockedDependency` instead.

`updateArtifacts` gets triggered:

- after a dependency update (for a package file), or
- during `lockfileMaintenance`

### `updateDependency` (optional)

Use `updateDependency` if _both_ conditions apply:

- the manager can't be updated to use the standard replacing mechanism
- a custom replacement has to be provided

### `updateLockedDependency` (optional)

Use `updateLockedDependency` to directly update dependencies in lock files.
2 changes: 1 addition & 1 deletion docs/usage/docker.md
Expand Up @@ -388,7 +388,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:35.58.0
FROM renovate/renovate:35.66.3
# Include the "Docker tip" which you can find here https://cloud.google.com/sdk/docs/install
# under "Installation" for "Debian/Ubuntu"
RUN ...
Expand Down
22 changes: 12 additions & 10 deletions lib/modules/datasource/docker/common.ts
Expand Up @@ -136,31 +136,33 @@ export async function getAuthHeaders(
return opts.headers ?? null;
}

let scope = `repository:${dockerRepository}:pull`;
const authUrl = new URL(`${authenticateHeader.params.realm}`);

// repo isn't known to server yet, so causing wrong scope `repository:user/image:pull`
if (
is.string(authenticateHeader.params.scope) &&
!apiCheckUrl.endsWith('/v2/')
) {
scope = authenticateHeader.params.scope;
authUrl.searchParams.append('scope', authenticateHeader.params.scope);
} else {
authUrl.searchParams.append(
'scope',
`repository:${dockerRepository}:pull`
);
}

let service = authenticateHeader.params.service;
if (is.string(service)) {
service = `service=${service}&`;
} else {
service = ``;
if (is.string(authenticateHeader.params.service)) {
authUrl.searchParams.append('service', authenticateHeader.params.service);
}

const authUrl = `${authenticateHeader.params.realm}?${service}scope=${scope}`;
logger.trace(
{ registryHost, dockerRepository, authUrl },
{ registryHost, dockerRepository, authUrl: authUrl.href },
`Obtaining docker registry token`
);
opts.noAuth = true;
const authResponse = (
await http.getJson<{ token?: string; access_token?: string }>(
authUrl,
authUrl.href,
opts
)
).body;
Expand Down
11 changes: 2 additions & 9 deletions lib/modules/datasource/rubygems/index.spec.ts
Expand Up @@ -2,7 +2,7 @@ import { getPkgReleases } from '..';
import { Fixtures } from '../../../../test/fixtures';
import * as httpMock from '../../../../test/http-mock';
import * as rubyVersioning from '../../versioning/ruby';
import { VersionsDatasource, resetCache } from './versions-datasource';
import { VersionsDatasource, memCache } from './versions-datasource';
import { RubyGemsDatasource } from '.';

const rubygemsOrgVersions = Fixtures.get('rubygems-org.txt');
Expand All @@ -13,8 +13,6 @@ const emptyMarshalArray = Buffer.from([4, 8, 91, 0]);

describe('modules/datasource/rubygems/index', () => {
describe('getReleases', () => {
const SKIP_CACHE = process.env.RENOVATE_SKIP_CACHE;

const params = {
versioning: rubyVersioning.id,
datasource: RubyGemsDatasource.id,
Expand All @@ -26,15 +24,10 @@ describe('modules/datasource/rubygems/index', () => {
};

beforeEach(() => {
resetCache();
process.env.RENOVATE_SKIP_CACHE = 'true';
memCache.clear();
jest.resetAllMocks();
});

afterEach(() => {
process.env.RENOVATE_SKIP_CACHE = SKIP_CACHE;
});

it('returns null for missing pkg', async () => {
httpMock
.scope('https://firstparty.com')
Expand Down
12 changes: 3 additions & 9 deletions lib/modules/datasource/rubygems/index.ts
Expand Up @@ -12,6 +12,7 @@ export class RubyGemsDatasource extends Datasource {

constructor() {
super(RubyGemsDatasource.id);
this.versionsDatasource = new VersionsDatasource(RubyGemsDatasource.id);
this.internalRubyGemsDatasource = new InternalRubyGemsDatasource(
RubyGemsDatasource.id
);
Expand All @@ -23,7 +24,7 @@ export class RubyGemsDatasource extends Datasource {

override readonly registryStrategy = 'hunt';

private readonly versionsDatasources: Record<string, VersionsDatasource> = {};
private readonly versionsDatasource: VersionsDatasource;

private readonly internalRubyGemsDatasource: InternalRubyGemsDatasource;

Expand All @@ -43,15 +44,8 @@ export class RubyGemsDatasource extends Datasource {
return null;
}

if (!this.versionsDatasources[registryUrl]) {
this.versionsDatasources[registryUrl] = new VersionsDatasource(
RubyGemsDatasource.id,
registryUrl
);
}

try {
return await this.versionsDatasources[registryUrl].getReleases({
return await this.versionsDatasource.getReleases({
packageName,
registryUrl,
});
Expand Down

0 comments on commit 85aecb7

Please sign in to comment.