Skip to content

Commit

Permalink
disable runner config validation
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed Sep 23, 2019
1 parent 98d0e60 commit 5b1a30a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
14 changes: 1 addition & 13 deletions src/runners/composeFileHelper/getImage.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import ConfigurationError from '../../errors/ConfigurationError'

const getImage = ({
build,
image,
service,
}: {
build?: string
image?: string
service: string
}): { image: string } | {} => {
const getImage = ({ build, image }: { build?: string; image?: string }): { image: string } | {} | void => {
/**
* If user provided an image via interface
*/
Expand All @@ -24,8 +14,6 @@ const getImage = ({
if (build) {
return {}
}

throw new ConfigurationError(`${service} Could not determine "image" property for service`)
}

export default getImage
4 changes: 2 additions & 2 deletions src/runners/composeFileHelper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import getPorts from './getPorts'
import { RunnerConfig, ComposeService } from '../@types'

const composeFileHelper = (runnerConfig: RunnerConfig): ComposeService => {
const { dependsOn, image, build, service, ports, props, networks: userNetworks } = runnerConfig
const { dependsOn, image, build, ports, props, networks: userNetworks } = runnerConfig

let networks
if (userNetworks) {
Expand All @@ -16,7 +16,7 @@ const composeFileHelper = (runnerConfig: RunnerConfig): ComposeService => {

return {
...getDependsOn(dependsOn),
...getImage({ image, build, service }),
...getImage({ image, build }),
...(build ? { build } : {}),
...(networks ? { networks } : {}),
...getPorts(ports),
Expand Down
25 changes: 12 additions & 13 deletions src/utils/validateConfig.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import validateTypes from './validateTypes'
import { RunnerConfig } from '../runners/@types'
import ConfigurationError from '../errors/ConfigurationError'
// import validateTypes from './validateTypes'
// import { RunnerConfig } from '../runners/@types'
// import ConfigurationError from '../errors/ConfigurationError'

// @ts-ignore
export default (schema: { [key: string]: any }, config: RunnerConfig) => {
const failures = validateTypes(schema, config)

const { build, image } = config
if (!image && !build) {
failures.push(`"image" and "build" are invalid, at least one has to be present. (image: ${image}, build: ${build})`)
}

if (failures.length > 0) {
throw new ConfigurationError(`${failures.join('\n')}`)
}
// const failures = validateTypes(schema, config)
// const { build, image } = config
// if (!image && !build) {
// failures.push(`"image" and "build" are invalid, at least one has to be present. (image: ${image}, build: ${build})`)
// }
// if (failures.length > 0) {
// throw new ConfigurationError(`${failures.join('\n')}`)
// }
}

0 comments on commit 5b1a30a

Please sign in to comment.