Skip to content

Commit

Permalink
fix: docker 28 and buildx 0.21 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
miki725 committed Feb 27, 2025
1 parent bbbd5ca commit 3826f23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/docker/collect.nim
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ proc collectImageFrom(chalk: ChalkObj,
chalk.platform = platform
chalk.imageId = id
chalk.collectCommon(contents, dockerImageAutoMap)
chalk.setIfNeeded("_OP_ALL_IMAGE_METADATA", contents.nimJsonToBox())
chalk.setIfNeeded("DOCKER_PLATFORM", $platform)
chalk.setIfNeeded("_OP_ALL_IMAGE_METADATA", contents)
chalk.setIfNeeded("DOCKER_PLATFORM", $platform.normalize())
chalk.repos = newOrderedTable[string, DockerImageRepo]()
for repo in uniqdigests:
try:
Expand Down Expand Up @@ -298,7 +298,7 @@ proc collectProvenance(chalk: ChalkObj) =
for i in chalk.repos.listManifests:
try:
let json = fetchProvenance(i, chalk.platform)
chalk.setIfNeeded("_IMAGE_PROVENANCE", pack(json.nimJsonToBox()))
chalk.setIfNeeded("_IMAGE_PROVENANCE", json)
break
except:
continue
Expand All @@ -309,7 +309,7 @@ proc collectSBOM(chalk: ChalkObj) =
for i in chalk.repos.listManifests:
try:
let json = fetchSBOM(i, chalk.platform)
chalk.setIfNeeded("_IMAGE_SBOM", pack(json.nimJsonToBox()))
chalk.setIfNeeded("_IMAGE_SBOM", json)
break
except:
continue
Expand Down Expand Up @@ -366,4 +366,4 @@ proc collectContainer*(chalk: ChalkObj, name: string) =
chalk.resourceType.incl(ResourceContainer)
chalk.setIfNeeded("_OP_ARTIFACT_TYPE", artTypeDockerContainer)
chalk.collectCommon(contents, dockerContainerAutoMap)
chalk.setIfNeeded("_OP_ALL_CONTAINER_METADATA", contents.nimJsonToBox())
chalk.setIfNeeded("_OP_ALL_CONTAINER_METADATA", contents)
6 changes: 3 additions & 3 deletions src/plugins/cloudMetadata.nim
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ proc getAzureMetadata(): ChalkDict =
return
try:
let jsonValue = parseJson(value)
result.setIfNeeded("_AZURE_INSTANCE_METADATA", jsonValue.nimJsonToBox())
result.setIfNeeded("_AZURE_INSTANCE_METADATA", jsonValue)
try:
for iface in jsonValue["network"]["interface"]:
var found = false
Expand Down Expand Up @@ -140,7 +140,7 @@ proc getGcpMetadata(): ChalkDict =
let valueProj = projectOpt.get()
if valueProj.startswith("{"):
let jsonProjValue = parseJson(valueProj)
result.setIfNeeded("_GCP_PROJECT_METADATA", jsonProjValue.nimJsonToBox())
result.setIfNeeded("_GCP_PROJECT_METADATA", jsonProjValue)
else:
trace("GCP project metadata didnt respond with json object. Ignoring it")
except:
Expand Down Expand Up @@ -277,7 +277,7 @@ proc jsonKey(chalkDict: ChalkDict, token: string, keyname: string, url: string)
of AWS_IDENTITY_CREDENTIALS_SECURITY_CREDS:
jsonValue["SecretAccessKey"] = newJString("<<redacted>>")
jsonValue["Token"] = newJString("<<redacted>>")
chalkDict.setIfNeeded(keyname, jsonValue.nimJsonToBox())
chalkDict.setIfNeeded(keyname, jsonValue)
except:
trace("IMDSv2 responded with invalid json from " & url & ": " & getCurrentExceptionMsg())

Expand Down

0 comments on commit 3826f23

Please sign in to comment.