backend-common: deprecate container runners
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
+3
@@ -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 {
|
||||
/**
|
||||
+1
@@ -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;
|
||||
+3
@@ -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,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, '\\$&');
|
||||
};
|
||||
Reference in New Issue
Block a user