forked from renovatebot/renovate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(github-actions): support GitHub actions runners (renovatebot#23633)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
- Loading branch information
1 parent
15cfe4b
commit 1ecaab2
Showing
10 changed files
with
362 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { getPkgReleases } from '..'; | ||
import { GithubRunnersDatasource } from '.'; | ||
|
||
describe('modules/datasource/github-runners/index', () => { | ||
describe('getReleases', () => { | ||
it('returns releases if package is known', async () => { | ||
const res = await getPkgReleases({ | ||
datasource: GithubRunnersDatasource.id, | ||
packageName: 'ubuntu', | ||
}); | ||
|
||
expect(res).toMatchObject({ | ||
releases: [ | ||
{ version: '18.04' }, | ||
{ version: '20.04' }, | ||
{ version: '22.04' }, | ||
], | ||
}); | ||
}); | ||
|
||
it('returns null if package is unknown', async () => { | ||
const res = await getPkgReleases({ | ||
datasource: GithubRunnersDatasource.id, | ||
packageName: 'unknown', | ||
}); | ||
|
||
expect(res).toBeNull(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { id as dockerVersioningId } from '../../versioning/docker'; | ||
import { Datasource } from '../datasource'; | ||
import type { GetReleasesConfig, Release, ReleaseResult } from '../types'; | ||
|
||
export class GithubRunnersDatasource extends Datasource { | ||
static readonly id = 'github-runners'; | ||
|
||
/** | ||
* Only add stable runners to the datasource. See datasource readme for details. | ||
*/ | ||
private static readonly releases: Record<string, Release[] | undefined> = { | ||
ubuntu: [{ version: '22.04' }, { version: '20.04' }, { version: '18.04' }], | ||
macos: [ | ||
{ version: '13' }, | ||
{ version: '13-xl' }, | ||
{ version: '12' }, | ||
{ version: '12-xl' }, | ||
{ version: '11' }, | ||
{ version: '10.15' }, | ||
], | ||
windows: [{ version: '2022' }, { version: '2019' }], | ||
}; | ||
|
||
public static isValidRunner( | ||
runnerName: string, | ||
runnerVersion: string | ||
): boolean { | ||
const runnerReleases = GithubRunnersDatasource.releases[runnerName]; | ||
if (!runnerReleases) { | ||
return false; | ||
} | ||
|
||
const versionExists = runnerReleases.some( | ||
({ version }) => version === runnerVersion | ||
); | ||
|
||
return runnerVersion === 'latest' || versionExists; | ||
} | ||
|
||
override readonly defaultVersioning = dockerVersioningId; | ||
|
||
constructor() { | ||
super(GithubRunnersDatasource.id); | ||
} | ||
|
||
override getReleases({ | ||
packageName, | ||
}: GetReleasesConfig): Promise<ReleaseResult | null> { | ||
const releases = GithubRunnersDatasource.releases[packageName]; | ||
const releaseResult: ReleaseResult | null = releases | ||
? { | ||
releases, | ||
sourceUrl: 'https://github.com/actions/runner-images', | ||
} | ||
: null; | ||
return Promise.resolve(releaseResult); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
This datasource returns a list of all _stable_ runners that are hosted by GitHub. | ||
This datasource ignores beta releases. | ||
The datasource is based on [GitHub's `runner-images` repository](https://github.com/actions/runner-images). | ||
|
||
Examples: `windows-2019` / `ubuntu-22.04` / `macos-13` | ||
|
||
## Maintenance | ||
|
||
New _stable_ runner versions must be added to the datasource with a pull request. | ||
Unstable runners are tagged as `[beta]` in the readme of the [`runner-images` repository](https://github.com/actions/runner-images). | ||
Once a runner version becomes stable, the `[beta]` tag is removed and the suffix `latest` is added to its YAML label. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.