Skip to content

Commit

Permalink
fix(cluster-buildkit): assume image needs rebuild if skopeo command f…
Browse files Browse the repository at this point in the history
…ails and print a warning (#6810)

* fix(cluster-buildkit): assume image needs rebuild if skopeo command fails and print a warning

Instead of failing completely, assume image needs to be rebuilt and print a warning. 

This is meant as a pain releave for the issue encountered in this Discord thread: https://discord.com/channels/817392104711651328/1313997959121211463/1313997959121211463

This is not a full solution for the problem encountered in the thread.

* fix: build

* Update core/src/plugins/kubernetes/container/build/common.ts

chore: fix build

* chore: fix lint errors

* chore: remove unnecessary cat to `any`

---------

Co-authored-by: Vladimir Vagaytsev <10628074+vvagaytsev@users.noreply.github.com>
  • Loading branch information
stefreak and vvagaytsev authored Feb 4, 2025
1 parent 41c8a44 commit a8918e3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions core/src/plugins/kubernetes/container/build/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { KubernetesConfig, KubernetesPluginContext, KubernetesProvider } fr
import { PodRunner, PodRunnerError, PodRunnerTimeoutError } from "../../run.js"
import type { PluginContext } from "../../../../plugin-context.js"
import { hashString, sleep } from "../../../../util/util.js"
import { ConfigurationError, RuntimeError } from "../../../../exceptions.js"
import { ConfigurationError } from "../../../../exceptions.js"
import type { Log } from "../../../../logger/log-entry.js"
import { prepareDockerAuth } from "../../init.js"
import { prepareSecrets } from "../../secrets.js"
Expand Down Expand Up @@ -285,12 +285,17 @@ export async function skopeoBuildStatus({
return { state: "not-ready", outputs, detail: { runtime } }
}

throw new RuntimeError({
message: `Unable to query registry for image status: Command "${skopeoCommand.join(
log.warn(
`Failed to check if the image has already been built: Command "${skopeoCommand.join(
" "
)}" failed: ${err.message}`,
wrappedErrors: [err],
)}" failed: ${err.message}`
)
log.debug({
error: err,
})

// If we fail to check the image status, we assume we need to rebuild it.
return { state: "not-ready", outputs, detail: { runtime } }
}

throw err
Expand Down Expand Up @@ -732,7 +737,7 @@ const baseUtilService: KubernetesResource<V1Service> = {
name: "rsync",
protocol: "TCP",
port: utilRsyncPort,
targetPort: <any>utilRsyncPort,
targetPort: utilRsyncPort,
},
],
selector: {
Expand Down

0 comments on commit a8918e3

Please sign in to comment.