Skip to content

Commit

Permalink
chore: Partially revert "1.1 / 2024-09-25"
Browse files Browse the repository at this point in the history
This partially reverts commit 7e358d4,
removing incorrect authentication code in advance of making it work
later.
  • Loading branch information
halostatue committed Sep 25, 2024
1 parent 7e358d4 commit 46475e7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
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

0 comments on commit 46475e7

Please sign in to comment.