-
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.
Extract updater/proxy tags from Dockerfile
This could allow Dependabot to keep the `Dockerfile` up-to-date, and we wouldn't need another build step to use them. When running `ncc build` the referenced `Dockerfile` gets copied into `dist/main` so it's available to the code running in actions. Following on from: https://github.com/dependabot/updater-action/pull/72 Working towards: github/dependabot-updates#2102
- Loading branch information
Philip Harrison
authored and
Barry Gordon
committed
Feb 23, 2022
1 parent
360cc5e
commit c44504b
Showing
2 changed files
with
31 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# NOTE: This Dockerfile is unused, it's only here so Dependabot can update the sha's | ||
|
||
# TODO: Pin to sha256 | ||
FROM docker.pkg.github.com/dependabot/dependabot-updater:v1 | ||
FROM docker.pkg.github.com/github/dependabot-update-job-proxy:v1 |
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 |
---|---|---|
@@ -1,4 +1,26 @@ | ||
export const UPDATER_IMAGE_NAME = | ||
'docker.pkg.github.com/dependabot/dependabot-updater:v1' | ||
export const PROXY_IMAGE_NAME = | ||
'docker.pkg.github.com/github/dependabot-update-job-proxy:v1' | ||
import fs from 'fs' | ||
|
||
const dockerfile = fs.readFileSync(require.resolve('../Dockerfile'), 'utf8') | ||
|
||
const imageNames = dockerfile | ||
.split(/\n/) | ||
.filter(a => a.startsWith('FROM')) | ||
.map(a => a.replace('FROM', '').trim()) | ||
|
||
const updaterImageName = imageNames.find(a => | ||
a.includes('dependabot/dependabot-updater') | ||
) | ||
const proxyImageName = imageNames.find(a => | ||
a.includes('github/dependabot-update-job-proxy') | ||
) | ||
|
||
if (!updaterImageName) { | ||
throw new Error('Could not find dependabot-updater image name') | ||
} | ||
|
||
if (!proxyImageName) { | ||
throw new Error('Could not find dependabot-update-job-proxy image name') | ||
} | ||
|
||
export const UPDATER_IMAGE_NAME = updaterImageName | ||
export const PROXY_IMAGE_NAME = proxyImageName |