Skip to content

Commit

Permalink
fix(gcp-cloud-run): Return error if invalid ingress option is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Dec 6, 2023
1 parent 00c9587 commit 3960ba6
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions packages/gcp-cloud-run/src/executors/deploy/deploy.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { join } from 'path'

import { ExecutorSchema } from '../schema'

export function deployExecutor(
export async function deployExecutor(
options: ExecutorSchema,
context: ExecutorContext
): Promise<{ success: boolean }> {
Expand Down Expand Up @@ -106,19 +106,16 @@ export function deployExecutor(
return secret
}

logger.warn(
`"${secret}" is not a valid secret! It should be in the following format "ENV_VAR_NAME=SECRET:VERSION"`
)
logger.warn(`"${secret}" is not a valid secret! It should be in the following format "ENV_VAR_NAME=SECRET:VERSION"`)
return false
})
.filter(Boolean)

const ingressOpts = ["all", "internal", "internal-and-cloud-load-balancing"];
const validIngress = (typeof ingress === "string") && ingressOpts.includes(ingress);
if (!validIngress) {
logger.warn(
`"${ingress}" is not a valid ingress option! Only the following few options are supported: ${ingressOpts}`
)
const ingressOpts = ['all', 'internal', 'internal-and-cloud-load-balancing']
if (ingress && !ingressOpts.includes(ingress)) {
logger.error(`"${ingress}" is not a valid ingress option! Only the following few options are supported: ${ingressOpts}`)

return { success: false }
}

if (generateRepoInfoFile) {
Expand Down Expand Up @@ -165,15 +162,13 @@ export function deployExecutor(

// There can be a question if a repo should be created
buildWithArtifactRegistry && autoCreateArtifactsRepo && '--quiet',
validIngress && `--ingress=${ingress}`

ingress && `--ingress=${ingress}`
])

return Promise.resolve(
execCommand(deployCommand, {
cwd: distDirectory
})
)
return execCommand(deployCommand, {
cwd: distDirectory
})
}

export default deployExecutor

0 comments on commit 3960ba6

Please sign in to comment.