Merge master.
This commit is contained in:
commit
d4104a519b
|
@ -25,7 +25,7 @@ function getTestcontainers(): ContainerInfo[] {
|
|||
// We use --format json to make sure the output is nice and machine-readable,
|
||||
// and we use --no-trunc so that the command returns full container IDs so we
|
||||
// can filter on them correctly.
|
||||
return execSync("docker ps --format json --no-trunc")
|
||||
return execSync("docker ps --all --format json --no-trunc")
|
||||
.toString()
|
||||
.split("\n")
|
||||
.filter(x => x.length > 0)
|
||||
|
@ -37,6 +37,10 @@ function getTestcontainers(): ContainerInfo[] {
|
|||
)
|
||||
}
|
||||
|
||||
function removeContainer(container: ContainerInfo) {
|
||||
execSync(`docker rm ${container.ID}`)
|
||||
}
|
||||
|
||||
export function getContainerByImage(image: string) {
|
||||
const containers = getTestcontainers().filter(x => x.Image.startsWith(image))
|
||||
if (containers.length > 1) {
|
||||
|
@ -49,6 +53,10 @@ export function getContainerByImage(image: string) {
|
|||
return containers[0]
|
||||
}
|
||||
|
||||
function getContainerByName(name: string) {
|
||||
return getTestcontainers().find(x => x.Names === name)
|
||||
}
|
||||
|
||||
export function getContainerById(id: string) {
|
||||
return getTestcontainers().find(x => x.ID === id)
|
||||
}
|
||||
|
@ -116,6 +124,16 @@ export async function startContainer(container: GenericContainer) {
|
|||
key = imageName.split("@")[0]
|
||||
}
|
||||
key = key.replace(/\//g, "-").replace(/:/g, "-")
|
||||
const name = `${key}_testcontainer`
|
||||
|
||||
// If a container has died it hangs around and future attempts to start a
|
||||
// container with the same name will fail. What we do here is if we find a
|
||||
// matching container and it has exited, we remove it before carrying on. This
|
||||
// removes the need to do this removal manually.
|
||||
const existingContainer = getContainerByName(name)
|
||||
if (existingContainer?.State === "exited") {
|
||||
removeContainer(existingContainer)
|
||||
}
|
||||
|
||||
container = container
|
||||
.withReuse()
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit aa6517bfbc463b3aac4ae53245dcce3d8bb130e4
|
||||
Subproject commit abdfb720c5583256e0334330ccbea1abcbe3d434
|
|
@ -1,5 +1,4 @@
|
|||
import { auth, permissions } from "@budibase/backend-core"
|
||||
import { DataSourceOperation } from "../../../constants"
|
||||
import {
|
||||
AutomationActionStepId,
|
||||
AutomationStep,
|
||||
|
@ -231,30 +230,6 @@ export function externalSearchValidator() {
|
|||
)
|
||||
}
|
||||
|
||||
export function datasourceQueryValidator() {
|
||||
return auth.joiValidator.body(
|
||||
Joi.object({
|
||||
endpoint: Joi.object({
|
||||
datasourceId: Joi.string().required(),
|
||||
operation: Joi.string()
|
||||
.required()
|
||||
.valid(...Object.values(DataSourceOperation)),
|
||||
entityId: Joi.string().required(),
|
||||
}).required(),
|
||||
resource: Joi.object({
|
||||
fields: Joi.array().items(Joi.string()).optional(),
|
||||
}).optional(),
|
||||
body: Joi.object().optional(),
|
||||
sort: Joi.object().optional(),
|
||||
filters: filterObject().optional(),
|
||||
paginate: Joi.object({
|
||||
page: Joi.string().alphanum().optional(),
|
||||
limit: Joi.number().optional(),
|
||||
}).optional(),
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export function webhookValidator() {
|
||||
return auth.joiValidator.body(
|
||||
Joi.object({
|
||||
|
|
|
@ -45,17 +45,6 @@ export enum AuthTypes {
|
|||
EXTERNAL = "external",
|
||||
}
|
||||
|
||||
export enum DataSourceOperation {
|
||||
CREATE = "CREATE",
|
||||
READ = "READ",
|
||||
UPDATE = "UPDATE",
|
||||
DELETE = "DELETE",
|
||||
BULK_CREATE = "BULK_CREATE",
|
||||
CREATE_TABLE = "CREATE_TABLE",
|
||||
UPDATE_TABLE = "UPDATE_TABLE",
|
||||
DELETE_TABLE = "DELETE_TABLE",
|
||||
}
|
||||
|
||||
export enum DatasourceAuthTypes {
|
||||
GOOGLE = "google",
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue