Merge pull request #25269 from backstage/mark-container-runners-deprecated

Mark container runners deprecated
This commit is contained in:
Fredrik Adelöw
2024-06-17 16:15:56 +02:00
committed by GitHub
12 changed files with 20 additions and 116 deletions
+7 -7
View File
@@ -137,7 +137,7 @@ export function cacheToPluginCacheManager(cache: CacheService): {
// @public @deprecated
export const coloredFormat: winston.Logform.Format;
// @public
// @public @deprecated
export interface ContainerRunner {
runContainer(opts: RunContainerOptions): Promise<void>;
}
@@ -215,7 +215,7 @@ export class DatabaseManager implements LegacyRootDatabaseService {
// @public @deprecated (undocumented)
export type DatabaseManagerOptions = DatabaseManagerOptions_2;
// @public
// @public @deprecated
export class DockerContainerRunner implements ContainerRunner {
constructor(options: { dockerClient: Docker });
// (undocumented)
@@ -367,20 +367,20 @@ export const isChildPath: typeof isChildPath_2;
// @public @deprecated (undocumented)
export const isDatabaseConflictError: typeof isDatabaseConflictError_2;
// @public
// @public @deprecated
export class KubernetesContainerRunner implements ContainerRunner {
constructor(options: KubernetesContainerRunnerOptions);
// (undocumented)
runContainer(options: RunContainerOptions): Promise<void>;
}
// @public
// @public @deprecated
export type KubernetesContainerRunnerMountBase = {
volumeName: string;
basePath: string;
};
// @public
// @public @deprecated
export type KubernetesContainerRunnerOptions = {
kubeConfig: KubeConfig;
name: string;
@@ -474,7 +474,7 @@ export type PluginDatabaseManager = DatabaseService;
// @public @deprecated (undocumented)
export type PluginEndpointDiscovery = DiscoveryService;
// @public
// @public @deprecated
export interface PullOptions {
// (undocumented)
[key: string]: unknown;
@@ -552,7 +552,7 @@ export const resolvePackagePath: typeof resolvePackagePath_2;
// @public @deprecated (undocumented)
export const resolveSafeChildPath: typeof resolveSafeChildPath_2;
// @public
// @public @deprecated
export type RunContainerOptions = {
imageName: string;
command?: string | string[];
@@ -104,6 +104,7 @@ export * from './tokens';
export * from './logging';
export * from './service';
export * from './middleware';
export * from './util';
/**
* @public
@@ -22,6 +22,7 @@ import { Writable } from 'stream';
* {@link https://github.com/apocas/dockerode?tab=readme-ov-file#pull-from-private-repos}
*
* @public
* @deprecated This interface is deprecated and will be removed in a future release.
*/
export interface PullOptions {
authconfig?: {
@@ -39,6 +40,7 @@ export interface PullOptions {
* Options passed to the {@link ContainerRunner.runContainer} method.
*
* @public
* @deprecated This type is deprecated and will be removed in a future release.
*/
export type RunContainerOptions = {
imageName: string;
@@ -57,6 +59,7 @@ export type RunContainerOptions = {
* Handles the running of containers, on behalf of others.
*
* @public
* @deprecated This interface is deprecated and will be removed in a future release.
*/
export interface ContainerRunner {
/**
@@ -28,6 +28,7 @@ export type UserOptions = {
* A {@link ContainerRunner} for Docker containers.
*
* @public
* @deprecated This class is deprecated and will be removed in a future release.
*/
export class DockerContainerRunner implements ContainerRunner {
private readonly dockerClient: Docker;
@@ -37,6 +37,7 @@ import { v4 as uuid } from 'uuid';
* Every mount must start with the 'basePath'.
*
* @public
* @deprecated This type is deprecated and will be removed in a future release.
*/
export type KubernetesContainerRunnerMountBase = {
volumeName: string;
@@ -53,6 +54,7 @@ export type KubernetesContainerRunnerMountBase = {
* a volume definition named as the {@link KubernetesContainerRunnerMountBase} 'volumeName'.
*
* @public
* @deprecated This type is deprecated and will be removed in a future release.
*/
export type KubernetesContainerRunnerOptions = {
kubeConfig: KubeConfig;
@@ -69,6 +71,7 @@ export type KubernetesContainerRunnerOptions = {
* Runs containers leveraging Jobs on a Kubernetes cluster
*
* @public
* @deprecated This class is deprecated and will be removed in a future release.
*/
export class KubernetesContainerRunner implements ContainerRunner {
private readonly kubeConfig: KubeConfig;
-1
View File
@@ -30,4 +30,3 @@ export * from './hot';
export * from './logging';
export * from './middleware';
export * from './service';
export * from './util';
@@ -1,84 +0,0 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { escapeRegExp } from './escapeRegExp';
describe('escapeRegExp', () => {
test('does not escape non-regex characters', () => {
expect(escapeRegExp('Backstage Backstage')).toBe('Backstage Backstage');
});
test('all the characters', () => {
expect(escapeRegExp('^$\\.*+?()[]{}|')).toBe(
'\\^\\$\\\\\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|',
);
});
test('character: ^', () => {
expect(escapeRegExp('^')).toBe('\\^');
});
test('character: $', () => {
expect(escapeRegExp('$')).toBe('\\$');
});
test('character: \\', () => {
expect(escapeRegExp('\\')).toBe('\\\\');
});
test('character: .', () => {
expect(escapeRegExp('.')).toBe('\\.');
});
test('character: *', () => {
expect(escapeRegExp('*')).toBe('\\*');
});
test('character: +', () => {
expect(escapeRegExp('+')).toBe('\\+');
});
test('character: ?', () => {
expect(escapeRegExp('?')).toBe('\\?');
});
test('character: (', () => {
expect(escapeRegExp('(')).toBe('\\(');
});
test('character: )', () => {
expect(escapeRegExp(')')).toBe('\\)');
});
test('character: [', () => {
expect(escapeRegExp('[')).toBe('\\[');
});
test('character: ]', () => {
expect(escapeRegExp(']')).toBe('\\]');
});
test('character: {', () => {
expect(escapeRegExp('{')).toBe('\\{');
});
test('character: }', () => {
expect(escapeRegExp('}')).toBe('\\}');
});
test('character: |', () => {
expect(escapeRegExp('|')).toBe('\\|');
});
});
@@ -1,24 +0,0 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Escapes a given string to be used inside a RegExp.
*
* Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
*/
export const escapeRegExp = (text: string) => {
return text.replace(/[.*+?^${}(\)|[\]\\]/g, '\\$&');
};