Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • smartdatalab/public/applications/renovate
1 result
Select Git revision
Show changes
Commits on Source (1000)
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_style = tab
[*.{yaml,yml,conf}]
indent_size = 2
test/_fixtures
module.exports = {
env: {
node: true,
},
extends: ['airbnb-base', 'prettier'],
plugins: ['import', 'promise'],
rules: {
'no-use-before-define': 0,
'no-restricted-syntax': 0,
'no-await-in-loop': 0,
'promise/always-return': 'error',
'promise/no-return-wrap': 'error',
'promise/param-names': 'error',
'promise/catch-or-return': 'error',
'promise/no-native': 'off',
'promise/no-nesting': 'warn',
'promise/no-promise-in-callback': 'warn',
'promise/no-callback-in-promise': 'warn',
'promise/avoid-new': 'warn',
},
};
* text=auto
*.js text eol=lf
/node_modules
/config.js
/coverage
/dist
/tmp
.DS_Store
.cache
/*.log
# It would be nice to remove this file and use .gitignore instead however we need to add package.json and _fixtures
/node_modules
/config.js
/coverage
/dist
/tmp
.DS_Store
.cache
/*.log
package.json
test/_fixtures/
renovate: yarn run start-raw
web: node bin/heroku/web.js
# renovate
\ No newline at end of file
/* eslint-disable no-console */
const http = require('http');
const port = process.env.PORT || '3000';
const requestHandler = (request, response) => {
// Redirect users to Heroku dashboard
const appName = request.headers.host.split(':')[0].split('.')[0];
response.writeHead(302, {
Location: `https://dashboard.heroku.com/apps/${appName}/logs`,
});
response.end();
};
http.createServer(requestHandler).listen(port, err => {
if (err) {
console.log('Failed to start web server', err);
return;
}
console.log(`Web server is listening on ${port}`);
});
#!/usr/bin/env node
const stringify = require('json-stringify-pretty-compact');
const definitions = require('../lib/config/definitions');
const defaultsParser = require('../lib/config/defaults');
const cliParser = require('../lib/config/cli');
const envParser = require('../lib/config/env');
/* eslint-disable no-console */
// Print table header
console.log('## Configuration Options');
console.log('');
console.log('<table>');
console.log('<tr>');
const columns = [
'Name',
'Description',
'Type',
'Default value',
'Environment',
'CLI',
];
columns.forEach(column => {
console.log(` <th>${column}</th>`);
});
console.log('</tr>');
const options = definitions.getOptions();
options.forEach(option => {
let optionDefault = defaultsParser.getDefault(option);
if (optionDefault !== '') {
optionDefault = `<pre>${stringify(optionDefault)}</pre>`;
}
let envName = envParser.getEnvName(option);
if (envName.length) {
envName = `\`${envName}\``;
}
let cliName = cliParser.getCliName(option);
if (cliName.length) {
cliName = `\`${cliName}\``;
}
console.log(
`<tr>
<td>\`${option.name}\`</td>
<td>${option.description}</td>
<td>${option.type}</td>
<td>${optionDefault}</td>
<td>${envName}</td>
<td>${cliName}<td>
</tr>`
);
});
/* eslint-enable no-console */
#!/usr/bin/env bash
perl -0777 -i -pe 's/\n Usage:.*package-test\n/`node dist\/renovate --help`/se' docs/configuration.md
perl -0777 -i -pe 's/## Configuration Options.*//se' docs/configuration.md
node bin/update-configuration-table.js >> docs/configuration.md
machine:
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
YARN_PATH: "$HOME/.yarn"
node:
version: 8
dependencies:
pre:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.0.2
- yarn --version
override:
- yarn install --frozen-lockfile
cache_directories:
- ~/.cache
- ~/.yarn
- .cache
test:
override:
- yarn test
post:
- bash <(curl -s https://codecov.io/bash)
deployment:
npm:
branch: master
commands:
- yarn run semantic-release || true
# Contributing
Contributions are welcome and desirable, in the form of:
- Bug reports (raise an issue)
- Feature requests (raise an issue)
- Code (submit a Pull Request)
- Comments (comment on any of the above)
Before you submit any code, it's recommended that you raise an issue first if you have any doubts. That way you can be sure that the maintainer(s) agree on what to change and how, and you can hopefully get a quick merge afterwards.
## Running the source code locally
After you have cloned the project, first check that it's running OK locally.
First you will need to install dependencies. We use [yarn](https://github.com/yarnpkg/yarn) so run `yarn` instead of `npm install`.
`renovate` supports node versions 6.9 and above. It is written using async/await so needs `babel` transpilation for node 6.
If running in node 6, you need to run a transpiled version of the code. You can do this without an explicit transpilation step by running `yarn run start-babel`.
Examples:
```sh
$ yarn run start-babel username/reponame
$ LOG_LEVEL=verbose yarn run start-babel username/reponame
$ yarn run start-babel -- --labels=foo username/reponame
```
If running on node 7, you can run just like the above, but use the `yarn run start-raw` command instead of `yarn run start-babel`.
## Adding configuration options
We wish to keep backwards-compatibility as often as possible, as well as make the code configurable, so most new functionality should be controllable via configuration options.
Please see [Configuration docs](docs/configuration.md) for a list of current options.
If you wish to add one, add it to `lib/config/definitions.js` and then run `yarn run update-docs`.
## Running tests
You can run `yarn test` locally to test your code. We also run Continuous Integration using CircleCI.
We use [Prettier](https://github.com/prettier/prettier) for code formatting. If your code fails `yarn test` due to a `prettier` rule in `eslint` then it can be fixed by running `yarn run eslint-fix`;
This diff is collapsed.
# Deployment
Before deploying the script for scheduled runs, it's recommend you test your settings locally first.
## Server cron
Adding `renovate` as a `cron` job is the simplest way to deploy.
### Installation
Install using `npm install -g`.
### Configuration
At a minimum, you will need to configure the token and repository list.
Simplest would be to specify both via CLI.
Alternatively, configure the token via Environment Variable if you don't want it to show in any cron logs.
Running daily should suit most people. At most, hourly.
## Heroku
Heroku free dynos provide a good way to host this for free. Set it up with the following commands:
### Installation
The best way to deploy to Heroku is via git and Heroku CLI.
```
$ git clone https://github.com/singapore/renovate
$ cd renovate
$ heroku create [app name]
$ git push heroku master
```
### Configuration
You now need to set the token.
```
$ heroku config:set GITHUB_TOKEN=[YourGitHubToken]
```
(or use `GITLAB_TOKEN` if appropriate)
You should also set any other [Configuration Options](configuration.md) you need.
The app should now be ready for testing.
```
$ heroku run renovate [your/repo]
```
Once you've verified the script ran successfully, it's time to set it up for automatic scheduling.
```
$ heroku addons:create scheduler:standard
$ heroku addons:open scheduler
```
At this point you should have the Heroku Scheduler Dashboard open. Click "Add new job" and enter the same command as you ran previously (e.g. `renovate [your/repo]`). Adjust the frequency to hourly if you prefer, then click Save.
You can run `heroku logs` to check execution logs. Consider adjusting the scripts log level if you have problems (info -> verbose -> debug -> silly).
# Design Decisions
This file documents the design choices as well as configuration options.
#### Stateless
No state storage is needed on `renovate` or GitHub/GitLab apart from what you see publicly in GitHub (branches, Pull Requests). It therefore doesn't matter if you stop/restart the script and would even still work if you had it running from two different locations, as long as their configuration was the same.
#### API only
So far, nothing we need to do requires a full `git clone` of the repository. e.g. we do not need to perform a git clone of the entire repository. Therefore, all operations are performed via the API.
## Synchronous Operation
The script current processes repositories, package files, and dependencies within them all synchronously.
- Greatly reduces chance of hitting simultaneous API rate limits
- Simplifies logging
Note: Initial queries to NPM are done in parallel.
## Multiple Configuration Methods
The script supports multiple [configuration methods](configuration.md) concurrently, and processed in order of priority.
This allows examples such as token configured via environment variable and labels configured via target `package.json`.
## Cascading Configuration
Configuration options applied per-package override those applied per package-type, which override those per-repository, which override those which are global (all repositories).
The following options can be configured down to a per-package type level:
- Dependency Types
- Ignored Dependencies
The following options apply per-repository:
- Token
- Platform
- Endpoint
The following options apply globally:
- Log Level
The remaining configuration options can be applied per-package.
## Automatic discovery of package.json locations
Note: GitHub only.
Default behaviour is to auto-discover all `package.json` locations in a repository and process them all.
Doing so means that "monorepos" are supported by default.
This can be overridden by the configuration option `packageFiles`, where you list the file paths manually (e.g. limit to just `package.json` in root of repository).
## Separate Branches per dependency
By default, `renovate` will maintain separate branches per-dependency. So if 20 dependencies need updating, there will be at least 20 branches/PRs. Although this may seem undesirable, it was considered even less desirable if all 20 were in the same Pull Request and it's up to the users to determine which dependency upgrade(s) caused the build to fail.
However, it's still possible to override the default branch and PR name templates in such a way to produce a single branch for all dependencies. The `groupName` configuration option can be used at a repository level (e.g. give it the value `All`) and then all dependency updates will be in the same branch/PR.
## One PR per Major release
`renovate` will create multiple branches/PRs if multiple major branch upgrades are available. For example if the current example is 1.6.0 and upgrades to 1.7.0 and 2.0.0 exist, then `renovate` will raise PRs for both the 1.x upgrade(s) and 2.x upgrade(s).
- It's often the case that projects can't upgrade major dependency versions immediately.
- It's also often the case that previous major versions continue receiving Minor or Patch updates.
- Projects should get Minor and Patch updates for their current Major release even if a new Major release exists
This can be overriden via the config option `separateMajorReleases`.
## Branch naming
Branches are named like `renovate/webpack-1.x` instead of `renovate/webpack-1.2.0`.
- Branches often receive updates (e.g. new patches) before they're merged.
- Naming the branch like `1.x` means its name still names sense if a `1.2.1` release happens
Note: Branch names are configurable using string templates.
## Pull Request Recreation
By default, the script does not create a new PR if it finds an identical one already closed. This allows users to close unwelcome upgrade PRs and worry about them being recreated every run. Typically this is most useful for major upgrades.
This option is configurable.
## Range handling
`renovate` prefers pinned dependency versions, instead of maintaining ranges. Even if the project is using tilde ranges, why not pin them for consistency if you're also using `renovate` every day?
This is now configurable via the `pinVersions` configuration option.
## Rebasing Unmergeable Pull Requests
Note: GitHub only. GitLab does not expose enough low level git API to allow this.
With the default behaviour of one branch per dependency, it's often that case that a PR gets merge conflicts after an adjacent dependency update is merged. Although GitHub has added a web interface for simple merge conflicts, this is still annoying to resolve manually.
`renovate` will rebase any unmergeable branches and add the latest necessary commit on top of the most recent `master` commit.
Note: `renovate` will only do this if the original branch hasn't been modified by anyone else.
## Suppressing string templates from CLI
String templates (e.g. commit or PR name) are not configurable via CLI options, in order to not pollute the CLI help and make it unreadable. If you must configure via CLI, use an environment variable instead. e.g.
```sh
$ RENOVATE_BRANCH_NAME=foo renovate
```
Alternatively, consider using a Configuration File.
# FAQ
If you need a specific behaviour and it's not mentioned here - or it's more complicated - feel free to raise an [Issue](https://github.com/singapore/renovate/issues) - configuration questions are welcome in this repository.
## What Is The Default Behaviour?
Renovate will:
- Look for configuration options in a `renovate.json` file and in each `package.json` file under the `renovate` object
- Find and process all `package.json` files in each repository
- Process `dependencies`, `devDependencies` and `optionalDependencies` in each `package.json`
- Use separate branches/PR for each dependency
- Use separate branches for each *major* version of each dependency
- Pin dependencies to a single version, rather than use ranges
- Update `yarn.lock` and/or `package-lock.json` files if found
- Create Pull Requests immediately after branch creation
## What If I Need To .. ?
### Run renovate on all repositories that the account has access to
Set configuration option `autodiscover` to `true`, via CLI, environment, or configuration file. Obviously it's too late to set it in any `renovate.json` or `package.json`.
### Use an alternative branch for Pull Request target
If for example your repository default branch is `master` but your Pull Requests should target branch `next`, then you can configure this via the `baseBranch` configuration option. To do this, add this line to the `renovate.json` in the *default* branch (i.e. `master` in this example).
```
{
"baseBranch": "next"
}
```
### Support private npm modules
If you are running your own Renovate instance, then the easiest way to support private modules is to make sure the appropriate credentials are in `.npmrc` or `~/.npmrc`;
If you are using a hosted Renovate instance (such as the Renovate app), and your `package.json` includes private modules, then you can:
1. Commit an `.npmrc` file to the repository, and Renovate will use this, or
2. Add the contents of your `.npmrc` file to the config field `npmrc` in your `renovate.json` or `package.json` renovate config
3. Add a valid npm authToken to the config field `npmToken` in your `renovate.json` or `package.json` renovate config
4. If using the [GitHub App hosted service](https://github.com/apps/renovate), authorize the npm user named "renovate" with read-only access to the relevant modules. This "renovate" account is used solely for the purpose of the renovate GitHub App.
### Control renovate's schedule
Renovate itself will run as often as its administrator has configured it (e.g. hourly, daily, etc). But you may wish to update certain repositories less often, or even specific packages at a different schedule.
If you want to control the days of the week or times of day that renovate updates packages, use the `timezone` and `schedule` configuration options.
By default, Renovate schedules will use the timezone of the machine that it's running on. This can be overridden in global config. Finally, it can be overridden on a per-repository basis too, e.g.:
```
"timezone": "America/Los_Angeles",
```
The timezone must be one of the valid [IANA time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
Now that your timezone is set, you can define days of week or hours of the day in which renovate will make changes. For this we rely on text parsing of the library [later](http://bunkat.github.io/later/parsers.html#text) and its concepts of "days", "time_before", and "time_after".
Example scheduling:
```
every weekend
before 5:00am
[after 10pm, before 5:00am]
[after 10pm every weekday, before 5am every weekday]
on friday and saturday
```
This scheduling feature can be particularly useful for "noisy" packages that are updated frequently, such as `aws-sdk`.
To restrict `aws-sdk` to only weekly updates, you could add this package rule:
```
"packageRules": [
{
"packageNames": ["aws-sdk"],
"schedule": ["after 9pm on sunday"]
}
]
```
Note that schedule must be in the form of an array, even if only one schedule is present. Multiple entries in the array means "or".
### Selectively enable or disable renovate for specific `package.json` files
You could:
- Add a `renovate.json` to the root of your repository and explicitly whitelist which `package.json` files you want renovated in the `packageFiles` configuration option, or
- Add a `renovate` section to any `package.json` files you don't want renovated, with the configuration option `"enabled": false`
### Disable renovate for certain dependency types
If you want to disable `renovate` for `optionalDependencies`, for example, you could define your own `depTypes` array (in either a `renovate.json` or `package.json` file)
### Use a single branch/PR for all dependency upgrades
Add a configuration for configuration option `groupName` set to value `"all"`, at the top level of your `renovate.json` or `package.json`.
### Use separate branches per dependency, but not one per major release
Set configuration option `separateMajorReleases` to `false`.
### Keep using semver ranges, instead of pinning dependencies
Set configuration option `pinVersions` to `false`.
### Keep lock files (including sub-dependencies) up-to-date, even when `package.json` hasn't changed
This is enabled by default, but its schedule is set to `['before 5am on monday']`. If you want it more frequently, then update the `schedule` field inside the `lockFileMaintenance` object.
### Wait until tests have passed before creating the PR
Set configuration option `prCreation` to `"status-success"`
### Wait until tests have passed before creating a PR, but create the PR even if they fail
Set configuration option `prCreation` to `"not-pending"`
### Assign PRs to specific user(s)
Set the configuration option `assignees` to an array of usernames.
### Add labels to PRs
Set the configuration option `labels` to an array of labels to use
### Apply a rule, but only to package `abc`?
1. Add a `packageRules` array to your configuration.
2. Create one object inside this array
3. Set field `packageNames` to value `["abc"]`
4. Add the configuration option to the same object.
e.g.
```
"packageRules": [
{
"packageNames": ["abc"],
"assignees": ["importantreviewer"]
}
]
```
### Apply a rule, but only for packages starting with `abc`
Do the same as above, but instead of using `packageNames`, use `packagePatterns` and a regex. e.g.
```
"packageRules": [
{
"packagePatterns": "^abc",
"assignees": ["importantreviewer"]
}
]
```
### Group all packages starting with `abc` together in one PR
As above, but apply a `groupName`, e.g.
```
"packageRules": [
{
"packagePatterns": "^abc",
"groupName": ["abc packages"]
}
]
```
### Change the default branch name, commit message, PR title or PR description
Set the `branchName`, `commitMessage`, `prTitle` or `prBody` configuration options:
```
"branchName": "vroom/{{depName}}-{{newVersionMajor}}.x",
"commitMessage": "Vroom vroom dependency {{depName}} to version {{newVersion}}",
"prTitle": "Vroom {{depName}},
```
### Automatically merge passing Pull Requests
Set configuration option `autoMerge` to `minor` if you want this to apply only to minor upgrades, or set to value `all` if you want it applied to both minor and major upgrades.
### Separate patch releases from minor releases
Renovate's default behaviour is to separate major and minor releases, while patch releases are also consider "minor". For example if you were running `q@0.8.7` you would receive one branch for the minor update to `q@0.9.7` and a second for the major update to `q@1.4.1`.
If you set the configuration option `separatePatchReleases` to `true`, or you configure `automerge` to have value `"patch"`, then Renovate will then separate patch releases as well. For example, if you did this when running `q@0.8.7` then you'd receive three PRs - for `q@0.8.13`, `q@0.9.7` and `q@1.4.1`.
Of course, most people don't want *more* PRs, so you would probably want to utilise this feature to make less work for yourself instead. As an example, you might:
- Update patch updates daily and automerge if they pass tests
- Update minor and major updates weekly
The result of this would hopefully be that you barely notice Renovate during the week while still getting the benefits of patch updates.
### Update Meteor package.js files
Renovate supports Meteor's `package.js` files - specifically, the `Npm.depends` section. As with npm, it will not renovate any `http*` URLs, but will keep all semantic versions up to date. (e.g. update version `1.1.0` to `1.1.1`)
Meteor support is opt-in, meaning Renvoate won't attempt to search for Meteor files by default. To enable it, add `":meteor"` to your Renovate config `extends` array.
e.g. if your renovate.json looks like:
```json
{
"extends": [":library"]
}
```
Then update it to be:
```json
{
"extends": [":library", ":meteor"]
}
```
Once you've done this, Renovate will:
- Search the repository for all `package.js` files which include `Npm.depends`
- Check the npm registry for newer versinos for each detected dependency
- Patch the `package.js` file if updates are found and create an associated branch/PR
If you wish to combine upgrades into one PR or any other similar configuration, you can do this just like with `package.json` dependencies by adding configuration or presets to your `renovate.json` file.
### Update Dockerfile FROM dependencies
Renovate supports updating `FROM` instructions in `Dockerfile`s.
Dockerfile support is opt-in, meaning Renvoate won't attempt to search for Dockerfiles by default. To enable it, add `":docker"` to your Renovate config `extends` array.
e.g. if your renovate.json looks like:
```json
{
"extends": [":library"]
}
```
Then update it to be:
```json
{
"extends": [":library", ":docker"]
}
```
Once you've done this, Renovate will:
- Search the repository for all `Dockerfile` files that have `FROM x` as the first non-comment line
- If x includes a digest, Renovate will check the Docker registry to see if a newer digest is available for the same tag and patch the Dockerfile
- If x does not include a digest, Renovate will look up the current digest for this image/tag and add it to the Dockerfile
If you wish to combine upgrades into one PR or any other similar configuration, you can do this just like with `package.json` dependencies by adding configuration or presets to your `renovate.json` file.
# Preset configs
Renovate uses the term "presets" to refer to shareable config snippets, similar to eslint. Unlike eslint though:
- Presets may be as small as a list of package names, or as large as a full config
- Shared config files can contain many presets
## Preset config URIs
In human-understandable form, the rules are:
- A full preset URI consists of package name, preset name, and preset parameters, such as `package:preset(param)`
- If a package scope is specified and no package, then the package name is assumed to be `renovate-config`, e.g. `@rarkins:webapp` is expanded to `@rarkins/renovate-config:webapp`
- If a non-scoped package is specified then it is assumed to have prefix `renovate-config-`. e.g. `rarkins:webapp` is expanded to `renovate-config-rarkins:webapp`
- If a package name is specified and no preset name, then `default` is assumed, e.g. `@rarkins` expands in full to `@rarkins/renovate-config:default` and `rarkins` expands in full to `renovate-config-rarkins:default`
- There is a special "default" namespace where no package name is necessary. e.g. `:webapp` (not the leading `:`) expands to `renovate-config-default:webapp`
## Supported config syntax
### Scoped
```
@somescope
```
This will resolve to use the preset `default` in the npm package `@somescope/renovate-config`.
### Scoped with package name
```
@somescope/somepackagename
```
This will resolve to use the preset `default` in the npm package `@somescope/somepackagename`.
### Scoped with preset name
```
@somescope:webapp
```
This will resolve to use the preset `webapp` in the npm package `@somescope/renovate-config`.
### Scoped with params
```
@somescope(eslint, stylelint)
```
This will resolve to use the preset `default` in the npm package `@somescope/renovate-config` and pass the parameters `eslint` and `stylelint`.
### Scoped with preset name and params
```
@somescope:webapp(eslint, stylelint)
```
This will resolve to use the preset `webapp` in the npm package `@somescope/renovate-config` and pass the parameters `eslint` and `stylelint`.
### Scoped with package name and preset name
```
@somescope/somepackagename:webapp
```
This will resolve to use the preset `webapp` in the npm package `@somescope/somepackagename`.
### Scoped with package name and preset name and params
```
@somescope/somepackagename:webapp(eslint, stylelint)
```
This will resolve to use the preset `webapp` in the npm package `@somescope/somepackagename` and pass the parameters `eslint` and `stylelint`.
### Non-scoped short with preset name
Note: if using non-scoped packages, a preset name is mandatory.
```
somepackagename:default
```
This will resolve to use the preset `default` in the npm package `renovate-config-somepackagename`.
### Non-scoped short with preset name and params
Note: if using non-scoped packages, a preset name is mandatory.
```
somepackagename:default(eslint)
```
This will resolve to use the preset `default` in the npm package `renovate-config-somepackagename` with param `eslint`.
### Non-scoped full with preset name
Note: if using non-scoped packages, a preset name is mandatory.
```
renovate-config-somepackagename:default
```
This will resolve to use the preset `default` in the npm package `renovate-config-somepackagename`.
### Non-scoped full with preset name and params
Note: if using non-scoped packages, a preset name is mandatory.
```
renovate-config-somepackagename:default(eslint)
```
This will resolve to use the preset `default` in the npm package `renovate-config-somepackagename` and param `eslint`.
# Status Checks
## unpublish-safe
Renovate includes a status showing whether upgrades are "unpublish-safe". This is because [packages less than 24 hours old may be unpublished by their authors](https://docs.npmjs.com/cli/unpublish). We recommend you wait for this status check to pass before merging unless the upgrade is urgent, otherwise you may find that packages simply disappear from the npm registry, breaking your build.
If you would like to disable this status check, add `"unpublishSafe": false` to your config.
If you would like to delay creation of Pull Requests until after this check passes, then add `"prCreation": "not-pending"` to your config. This way the PR will only be created once the upgrades in the branch are at least 24 hours old because Renovate sets the status check to "pending" in the meantime.
const got = require('got');
module.exports = {
getDigest,
};
async function getDigest(name, tag, logger) {
const repository = name.includes('/') ? name : `library/${name}`;
try {
const authUrl = `https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repository}:pull`;
logger.debug(`Obtaining docker registry token for ${repository}`);
const { token } = (await got(authUrl, { json: true })).body;
if (!token) {
logger.warn('Failed to obtain docker registry token');
return null;
}
logger.debug('Got docker registry token');
const url = `https://index.docker.io/v2/${repository}/manifests/${tag ||
'latest'}`;
const headers = {
Authorization: `Bearer ${token}`,
Accept: 'application/vnd.docker.distribution.manifest.v2+json',
};
const digest = (await got(url, { json: true, headers })).headers[
'docker-content-digest'
];
logger.debug({ digest }, 'Got docker digest');
return digest;
} catch (err) {
logger.warn({ err, name, tag }, 'Error getting docker image digest');
return null;
}
}