Skip to content

Commit

Permalink
Fix dockerfile paths with relative decorators (#20365)
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek authored Nov 14, 2024
1 parent 177367e commit 7d3f447
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/server/src/workspace/config-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class ConfigProvider {
}
const repoHost = hostContext.services;
const lastDockerFileSha = await repoHost.fileProvider
.getLastChangeRevision(repository, revisionOrTagOrBranch, user, dockerFilePath)
.getLastChangeRevision(repository, revisionOrTagOrBranch, user, path.normalize(dockerFilePath))
.catch((e) => {
if (e instanceof RevisionNotFoundError) {
return ImageFileRevisionMissing;
Expand Down
12 changes: 9 additions & 3 deletions components/server/src/workspace/image-source-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/

import { injectable, inject } from "inversify";
import { createHash } from "crypto";
import path from "path";
import { HostContextProvider } from "../auth/host-context-provider";
import { TraceContext } from "@gitpod/gitpod-protocol/lib/util/tracing";
import {
Expand All @@ -18,7 +20,6 @@ import {
User,
AdditionalContentContext,
} from "@gitpod/gitpod-protocol";
import { createHash } from "crypto";
import { ImageFileRevisionMissing, RevisionNotFoundError } from "../repohost";

@injectable()
Expand All @@ -45,7 +46,12 @@ export class ImageSourceProvider {
throw new Error(`Cannot fetch workspace image source for host: ${repository.host}`);
}
const lastDockerFileSha = await hostContext.services.fileProvider
.getLastChangeRevision(repository, imgcfg.externalSource.revision, user, imgcfg.file)
.getLastChangeRevision(
repository,
imgcfg.externalSource.revision,
user,
path.normalize(imgcfg.file),
)
.catch((e) => {
if (e instanceof RevisionNotFoundError) {
return ImageFileRevisionMissing;
Expand Down Expand Up @@ -76,7 +82,7 @@ export class ImageSourceProvider {
throw new Error(`Cannot fetch workspace image source for host: ${context.repository.host}`);
}
const lastDockerFileSha = await hostContext.services.fileProvider
.getLastChangeRevision(context.repository, context.revision, user, imgcfg.file)
.getLastChangeRevision(context.repository, context.revision, user, path.normalize(imgcfg.file))
.catch((e) => {
if (e instanceof RevisionNotFoundError) {
return ImageFileRevisionMissing;
Expand Down

0 comments on commit 7d3f447

Please sign in to comment.