Skip to content

Commit c4b7517

Browse files
committed
remove definetly-gp support
compare to previous attempts it does not remove anything related to ExternalImageConfigFile
1 parent ec7f6d6 commit c4b7517

File tree

4 files changed

+9
-134
lines changed

4 files changed

+9
-134
lines changed

components/gitpod-protocol/go/gitpod-service.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,6 @@ type WorkspaceConfig struct {
16731673
// Where the config object originates from.
16741674
//
16751675
// repo - from the repository
1676-
// definitely-gp - from github.com/gitpod-io/definitely-gp
16771676
// derived - computed based on analyzing the repository
16781677
// default - our static catch-all default config
16791678
Origin string `json:"_origin,omitempty"`

components/gitpod-protocol/src/protocol.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,12 +971,11 @@ export interface WorkspaceConfig {
971971
* Where the config object originates from.
972972
*
973973
* repo - from the repository
974-
* definitly-gp - from github.com/gitpod-io/definitely-gp
975974
* derived - computed based on analyzing the repository
976975
* additional-content - config comes from additional content, usually provided through the project's configuration
977976
* default - our static catch-all default config
978977
*/
979-
_origin?: "repo" | "definitely-gp" | "derived" | "additional-content" | "default";
978+
_origin?: "repo" | "derived" | "additional-content" | "default";
980979

981980
/**
982981
* Set of automatically infered feature flags. That's not something the user can set, but

components/server/src/workspace/config-provider.ts

Lines changed: 7 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import { inject, injectable } from "inversify";
8-
import fetch from "node-fetch";
98
import * as path from "path";
109
import * as crypto from "crypto";
1110

@@ -26,7 +25,6 @@ import {
2625
} from "@gitpod/gitpod-protocol";
2726
import { GitpodFileParser } from "@gitpod/gitpod-protocol/lib/gitpod-file-parser";
2827

29-
import { MaybeContent } from "../repohost/file-provider";
3028
import { ConfigurationService } from "../config/configuration-service";
3129
import { HostContextProvider } from "../auth/host-context-provider";
3230
import { AuthorizationService } from "../user/authorization-service";
@@ -39,13 +37,6 @@ const POD_PATH_WORKSPACE_BASE = "/workspace";
3937

4038
@injectable()
4139
export class ConfigProvider {
42-
static readonly DEFINITELY_GP_REPO: Repository = {
43-
host: "github.com",
44-
owner: "gitpod-io",
45-
name: "definitely-gp",
46-
cloneUrl: "https://github.com/gitpod-io/definitely-gp",
47-
};
48-
4940
@inject(GitpodFileParser) protected readonly gitpodParser: GitpodFileParser;
5041
@inject(HostContextProvider) protected readonly hostContextProvider: HostContextProvider;
5142
@inject(AuthorizationService) protected readonly authService: AuthorizationService;
@@ -96,15 +87,10 @@ export class ConfigProvider {
9687
config.image = this.config.workspaceDefaults.workspaceImage;
9788
} else if (ImageConfigFile.is(config.image)) {
9889
const dockerfilePath = [configBasePath, config.image.file].filter((s) => !!s).join("/");
99-
let repo = commit.repository;
100-
let rev = commit.revision;
90+
const repo = commit.repository;
91+
const rev = commit.revision;
10192
const image = config.image!;
10293

103-
if (config._origin === "definitely-gp") {
104-
repo = ConfigProvider.DEFINITELY_GP_REPO;
105-
rev = "master";
106-
image.file = dockerfilePath;
107-
}
10894
if (!(AdditionalContentContext.is(commit) && commit.additionalFiles[dockerfilePath])) {
10995
config.image = <ExternalImageConfigFile>{
11096
...image,
@@ -143,7 +129,7 @@ export class ConfigProvider {
143129
}
144130
}
145131

146-
protected async fetchCustomConfig(
132+
private async fetchCustomConfig(
147133
ctx: TraceContext,
148134
user: User,
149135
commit: CommitContext,
@@ -154,7 +140,7 @@ export class ConfigProvider {
154140

155141
try {
156142
let customConfig: WorkspaceConfig | undefined;
157-
let configBasePath = "";
143+
const configBasePath = "";
158144
if (AdditionalContentContext.is(commit) && commit.additionalFiles[".gitpod.yml"]) {
159145
customConfigString = commit.additionalFiles[".gitpod.yml"];
160146
const parseResult = this.gitpodParser.parse(customConfigString);
@@ -183,21 +169,6 @@ export class ConfigProvider {
183169
customConfigString = await contextRepoConfig;
184170
let origin: WorkspaceConfig["_origin"] = "repo";
185171

186-
if (!customConfigString) {
187-
/* We haven't found a Gitpod configuration file in the context repo - check definitely-gp.
188-
*
189-
* In case we had found a config file here, we'd still be checking the definitely GP repo, just to save some time.
190-
* While all those checks will be in vain, they should not leak memory either as they'll simply
191-
* be resolved and garbage collected.
192-
*/
193-
const definitelyGpConfig = this.fetchExternalGitpodFileContent({ span }, commit.repository);
194-
const { content, basePath } = await definitelyGpConfig;
195-
customConfigString = content;
196-
// We do not only care about the config itself but also where we got it from
197-
configBasePath = basePath;
198-
origin = "definitely-gp";
199-
}
200-
201172
if (!customConfigString) {
202173
const inferredConfig = this.configurationService.guessRepositoryConfiguration(
203174
{ span },
@@ -248,7 +219,7 @@ export class ConfigProvider {
248219
};
249220
}
250221

251-
protected async fetchWorkspaceImageSourceDocker(
222+
private async fetchWorkspaceImageSourceDocker(
252223
ctx: TraceContext,
253224
repository: Repository,
254225
revisionOrTagOrBranch: string,
@@ -287,101 +258,7 @@ export class ConfigProvider {
287258
}
288259
}
289260

290-
protected async fillInDefaultLocations(
291-
cfg: WorkspaceConfig | undefined,
292-
inferredConfig: Promise<WorkspaceConfig | undefined>,
293-
): Promise<void> {
294-
if (!cfg) {
295-
// there is no config - return
296-
return;
297-
}
298-
299-
if (!cfg.checkoutLocation) {
300-
const inferredCfg = await inferredConfig;
301-
if (inferredCfg) {
302-
cfg.checkoutLocation = inferredCfg.checkoutLocation;
303-
}
304-
}
305-
if (!cfg.workspaceLocation) {
306-
const inferredCfg = await inferredConfig;
307-
if (inferredCfg) {
308-
cfg.workspaceLocation = inferredCfg.workspaceLocation;
309-
}
310-
}
311-
}
312-
313-
protected async fetchExternalGitpodFileContent(
314-
ctx: TraceContext,
315-
repository: Repository,
316-
): Promise<{ content: MaybeContent; basePath: string }> {
317-
const span = TraceContext.startSpan("fetchExternalGitpodFileContent", ctx);
318-
span.setTag("repo", `${repository.owner}/${repository.name}`);
319-
320-
if (this.config.definitelyGpDisabled) {
321-
span.finish();
322-
return {
323-
content: undefined,
324-
basePath: `${repository.name}`,
325-
};
326-
}
327-
328-
try {
329-
const ownerConfigBasePath = `${repository.name}/${repository.owner}`;
330-
const baseConfigBasePath = `${repository.name}`;
331-
332-
const possibleConfigs = [
333-
[this.fetchDefinitelyGpContent({ span }, `${ownerConfigBasePath}/.gitpod.yml`), ownerConfigBasePath],
334-
[this.fetchDefinitelyGpContent({ span }, `${ownerConfigBasePath}/.gitpod`), ownerConfigBasePath],
335-
[this.fetchDefinitelyGpContent({ span }, `${baseConfigBasePath}/.gitpod.yml`), baseConfigBasePath],
336-
[this.fetchDefinitelyGpContent({ span }, `${baseConfigBasePath}/.gitpod`), baseConfigBasePath],
337-
];
338-
for (const [configPromise, basePath] of possibleConfigs) {
339-
const ownerConfig = await configPromise;
340-
if (ownerConfig !== undefined) {
341-
return {
342-
content: ownerConfig,
343-
basePath: basePath as string,
344-
};
345-
}
346-
}
347-
return {
348-
content: undefined,
349-
basePath: baseConfigBasePath,
350-
};
351-
} catch (e) {
352-
TraceContext.setError({ span }, e);
353-
throw e;
354-
} finally {
355-
span.finish();
356-
}
357-
}
358-
359-
protected async fetchDefinitelyGpContent(ctx: TraceContext, filePath: string) {
360-
const span = TraceContext.startSpan("fetchDefinitelyGpContent", ctx);
361-
span.setTag("filePath", filePath);
362-
363-
try {
364-
const url = `https://raw.githubusercontent.com/gitpod-io/definitely-gp/master/${filePath}`;
365-
const response = await fetch(url, {
366-
timeout: 10000,
367-
method: "GET",
368-
});
369-
let content;
370-
if (response.ok) {
371-
try {
372-
content = await response.text();
373-
} catch {}
374-
}
375-
return content;
376-
} catch (e) {
377-
TraceContext.setError({ span }, e);
378-
throw e;
379-
} finally {
380-
span.finish();
381-
}
382-
}
383-
384-
protected async validateConfig(config: WorkspaceConfig, user: User): Promise<void> {
261+
private async validateConfig(config: WorkspaceConfig, user: User): Promise<void> {
385262
// Make sure the projectRoot does not leave POD_PATH_WORKSPACE_BASE as that's a common
386263
// assumption throughout the code (e.g. ws-daemon)
387264
const checkoutLocation = config.checkoutLocation;
@@ -407,7 +284,7 @@ export class ConfigProvider {
407284
}
408285
}
409286

410-
protected leavesWorkspaceBase(normalizedPath: string) {
287+
private leavesWorkspaceBase(normalizedPath: string) {
411288
const pathSegments = normalizedPath.split(path.sep);
412289
return normalizedPath.includes("..") || pathSegments.slice(0, 2).join("/") != POD_PATH_WORKSPACE_BASE;
413290
}

components/server/src/workspace/image-source-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class ImageSourceProvider {
3737

3838
const imgcfg = config.image;
3939
if (ExternalImageConfigFile.is(imgcfg)) {
40-
// we're asked to pull the Dockerfile from a repo possibly different than the one we're opening a workspace for (e.g. definitely-gp).
40+
// we're asked to pull the Dockerfile from a repo possibly different than the one we're opening a workspace for.
4141
const repository = imgcfg.externalSource.repository;
4242
const hostContext = this.hostContextProvider.get(repository.host);
4343
if (!hostContext || !hostContext.services) {

0 commit comments

Comments
 (0)