Jobs Service Documentation
This is the core service of Greenkeeper. It takes care of the dependency update logic and the related pull request/issue creation.
Job Types
🚨🚧 The following documentation might be outdated. We are currently working on improving this section.
github-event
The github-event
job gets created by our hooks service.
It's answering all incoming webhooks from GitHub and creates this job with the full payload from github as job.data
.
It only adds one additional type
property to it with the name of the webhook event.
github-event:integration_installation
Depending on action
a new entry is added/removed to/from the installations database.
All repositories are requested from GitHub to sync them with our database.
All repositories with a package.json receive their initial pull request (create-initial-branch
).
github-event:integration_installation_repositories
Depending on action
entries are added/removed to/from the repositories database.
Added repositories with a package.json receive their initial pull request (create-initial-branch
).
github-event:push
The package.json contents are retrieved, parsed and synced to our database.
github-event:status
If the status affects a Greenkeeper pull_request the results are recorded in our repositories database with all metadata.
If the status of a branch is failing
, it will create a new branch to pin to the last working version create-pin-branch
.
When the status for that pin branch is coming, an issue is created with create-issue
.
If that issue already exists and it's still failing it will comment comment-issue
, but if it's
succeeding it will close that issue with close-issue
.
github-event:pull_request
When an initial Greenkeeper pull request is merged the repository gets enabled (enable-repository
).
When a Greenkeeper pull request is merged older/included pull requests for the same dependency are closed (delete-older-branches
).
Unmergeable Greenkeeper pull requests get "rebased" (rebase-unmergeable-branches
).
registry-change
The registry-change
job gets created by our changes service.
It's listening for changes from npm and creates this job with the full payload from npm as job.data
.
It figures out whether the change actually contains a new version, and on which dist-tag. It stores the versions in our npm database.
It figures out who is depending on the dependency that changed and schedules branch creation jobs for enabled ones. (create-version-branch
)
create-pin-branch
Creates a branch for a dependency, pinning to the version before.
create-issue
Creates an issue with the information that a dependency is failing.
Comments to an issue that a dependency is still failing.
close-issue
Closes an issue because the dependency is no longer failing.
create-version-branch
Used to be package-bump with our oAuth App.
If there are no tests detected, or the update is outside of the version range triggers create-version-pr
right away.
create-version-pr
Used to be package-send-pr with our oAuth App.
delete-branches
Deletes all branches related to a dependency which version is less or equal to the specified one.
create-initial-branch
Used to be package-pin with our oAuth App.
enable-repository
Used to happen inside webservice with our oAuth App.
delete-older-branches
Used to happen inside pull-request-close with our oAuth App.
rebase-unmergeable-branches
Used to happen inside pull-request-close with our oAuth App.
documents
installations
{
_id: '8422',
installation: 10,
plan: 'free',
login: 'finnp',
type: 'User'
}
repositories
type: repository
{
_id: '111',
type: 'repository',
enabled: false,
accountId: '8422',
fullName: 'greenkeeperio/jobs',
private: true,
fork: false,
hasIssues: true,
packages: {
'package.json': {}
}
}
type:branch
{
_id: '111:branch:deadbeefdeadbeef',
type: 'branch',
purpose: undefined,
sha: 'deadbeefdeadbeef',
base: 'master',
head: 'greenkeeper-lodash-8.0.0',
dependency: 'lodash',
version: '8.0.0',
oldVersion: '~7.0.0',
oldVersionResolved: '7.0.0',
dependencyType: 'devDependencies',
repositoryId: '111',
accountId: '8422',
processed: true,
referenceDeleted: true,
state: 'failure',
updated_at: '2016-09-28T15:07:03.022Z'
}
type:pr
{
_id: '111:pr:6',
type: 'pr',
repositoryId: 11,
accountId: 42
initial: true,
number: 6,
head: 'greenkeeper-lodash-8.0.0',
state: 'open',
merged: true,
updated_at, '2016-09-28T15:07:03.022Z'
}
type:issue
{
_id: '111:issue:6',
type: 'issue',
repositoryId: '111',
dependency: 'lodash',
version: '1.0.0',
number: 6,
state: 'open',
updated_at
}