Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/features/feeds/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { AwsElasticContainerRegistryFeed } from "./awsElasticContainerRegis
import type { BuiltInFeed } from "./builtInFeed";
import type { DockerFeed } from "./dockerFeed";
import { FeedType } from "./feedType";
import type { GcsStorageFeed } from "./gcsStorageFeed";
import type { GitHubFeed } from "./gitHubFeed";
import type { HelmFeed } from "./helmFeed";
import type { MavenFeed } from "./mavenFeed";
Expand All @@ -12,7 +13,7 @@ import type { NugetFeed } from "./nugetFeed";
import type { OctopusProjectFeed } from "./octopusProjectFeed";
import { every } from "lodash";

export type ExternalFeed = NugetFeed | DockerFeed | MavenFeed | GitHubFeed | HelmFeed | AwsElasticContainerRegistryFeed | NpmFeed;
export type ExternalFeed = NugetFeed | DockerFeed | MavenFeed | GitHubFeed | HelmFeed | AwsElasticContainerRegistryFeed | GcsStorageFeed | NpmFeed;

export type Feed = ExternalFeed | BuiltInFeed | OctopusProjectFeed;

Expand Down
1 change: 1 addition & 0 deletions src/features/feeds/feedType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export enum FeedType {
AwsElasticContainerRegistry = "AwsElasticContainerRegistry",
BuiltIn = "BuiltIn",
Docker = "Docker",
GcsStorage = "GcsStorage",
GitHub = "GitHub",
Helm = "Helm",
Maven = "Maven",
Expand Down
48 changes: 48 additions & 0 deletions src/features/feeds/gcsStorageFeed.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import type { GcsStorageFeed } from "./gcsStorageFeed";
import { FeedType } from "./feedType";

describe("gcsStorageFeed", () => {
test("can create with service account key", () => {
const feed: GcsStorageFeed = {
Id: "feeds-123",
Name: "Test GCS Feed",
FeedType: FeedType.GcsStorage,
SpaceId: "Spaces-1",
UseServiceAccountKey: true,
ServiceAccountJsonKey: {
HasValue: true,
NewValue: '{"type":"service_account"}',
},
Project: "my-project",
DownloadAttempts: 5,
DownloadRetryBackoffSeconds: 10,
};

expect(feed.Name).toBe("Test GCS Feed");
expect(feed.UseServiceAccountKey).toBe(true);
expect(feed.DownloadAttempts).toBe(5);
expect(feed.DownloadRetryBackoffSeconds).toBe(10);
});

test("can create with OIDC authentication", () => {
const feed: GcsStorageFeed = {
Id: "feeds-456",
Name: "Test GCS Feed OIDC",
FeedType: FeedType.GcsStorage,
SpaceId: "Spaces-1",
UseServiceAccountKey: false,
OidcAuthentication: {
Audience: "api://AzureADTokenExchange",
SubjectKeys: ["space", "feed"],
},
DownloadAttempts: 3,
DownloadRetryBackoffSeconds: 5,
};

expect(feed.Name).toBe("Test GCS Feed OIDC");
expect(feed.UseServiceAccountKey).toBe(false);
expect(feed.OidcAuthentication?.Audience).toBe("api://AzureADTokenExchange");
expect(feed.DownloadAttempts).toBe(3);
expect(feed.DownloadRetryBackoffSeconds).toBe(5);
});
});
19 changes: 19 additions & 0 deletions src/features/feeds/gcsStorageFeed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { FeedType } from "./feedType";
import type { SensitiveValue } from "../variables";
import { SpaceScopedResource } from "../../spaceScopedResource";
import { NamedResource } from "../../namedResource";
import type { RetryFeed } from "./retryFeed";

export interface GoogleOidcAuthentication {
Audience?: string;
SubjectKeys: string[];
}

export interface GcsStorageFeed extends SpaceScopedResource, NamedResource, RetryFeed {
FeedType: FeedType.GcsStorage;
Name: string;
UseServiceAccountKey: boolean;
ServiceAccountJsonKey?: SensitiveValue;
Project?: string;
OidcAuthentication?: GoogleOidcAuthentication;
}
1 change: 1 addition & 0 deletions src/features/feeds/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from "./dockerFeed";
export * from "./feed";
export * from "./feedRepository";
export * from "./feedType";
export * from "./gcsStorageFeed";
export * from "./gitHubFeed";
export * from "./helmFeed";
export * from "./mavenFeed";
Expand Down
Loading