Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Partially revert "1.1 / 2024-09-25" #9

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# KineticCafe/docker-image-update-checker Changelog

## 1.1 / 2024-09-25
## NEXT / YYYY-MM-DD

- Add the ability to pass the registry token as part of the request.
- Update dependencies.

## 1.0 / 2024-07-29

Expand Down
4 changes: 0 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ inputs:
Comma-separted list of platforms to check. Defaults to `linux/amd64`.
required: false
default: 'linux/amd64'
registry-token:
description: |
The DockerHub token to use for authenticated API requests.
required: false

outputs:
needs-updating:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kineticcafe/docker-image-update-checker",
"version": "1.1.0",
"version": "1.0.0",
"author": "Kinetic Commerce",
"type": "module",
"description": "Check pull requests for DCO sign-off",
Expand Down
15 changes: 7 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ async function getImageAuthToken(image: Image): Promise<string> {
throw new Error(`Error obtaining pull authorization token for ${image.input}.`)
}

async function buildImageContext(input: string, registryToken: string): Promise<Context> {
async function buildImageContext(input: string): Promise<Context> {
const image = parseImageName(input)
const token = registryToken === '' ? await getImageAuthToken(image) : registryToken
const token = await getImageAuthToken(image)

const res = await ky.get(`https://index.docker.io/v2/${image.repo}/tags/list`, {
headers: {
Expand All @@ -76,7 +76,7 @@ async function buildImageContext(input: string, registryToken: string): Promise<
throw new Error(`${image.input} does not exist on DockerHub as ${image.repo}`)
}

return buildImageContext(`library/${input}`, token)
return buildImageContext(`library/${input}`)
}

interface Manifest {
Expand Down Expand Up @@ -194,15 +194,14 @@ async function getImageLayers(context: Context, digest: string): Promise<Set<str
async function run(): Promise<void> {
core.info(`${NAME} ${VERSION}`)

const target = core.getInput('image', { required: true, trimWhitespace: true })
const baseImage = core.getInput('base-image', { required: true, trimWhitespace: true })
const target = core.getInput('image', { required: true })
const baseImage = core.getInput('base-image', { required: true })
const wantedPlatforms = core.getMultilineInput('platforms').flatMap((v) => v.split(','))
const registryToken = core.getInput('registry-token', { trimWhitespace: true })

const baseContext = await buildImageContext(baseImage, registryToken)
const baseContext = await buildImageContext(baseImage)
const baseManifests = await getImageManifests(baseContext)

const targetContext = await buildImageContext(target, registryToken)
const targetContext = await buildImageContext(target)
const targetManifests = await getImageManifests(targetContext)

let diff = false
Expand Down