Menu

Failing an Azure DevOps Pipeline Early with a Validation Stage
📰

Failing an Azure DevOps Pipeline Early with a Validation Stage

DEV Community: cicd·Nishant Rana·about 8 hours ago
#YgGVo5jZ
#devtocicd#devto#dev#stage#validate
Reading 0:00
15s threshold

Long pipelines that fail in the last stage waste time. A short validation stage at the top fails fast instead.

The stage

stages : - stage : Validate jobs : - job : checks pool : { vmImage: ubuntu-latest } steps : - script : | test -n "$(AppName)" || { echo "AppName is not set"; exit 1; } displayName : Required variables - script : npm ci && npm run lint displayName : Lint

- stage : Deploy dependsOn : Validate condition : succeeded() jobs : - deployment : web environment : prod strategy : runOnce : deploy : steps : - script : echo "deploying"

Enter fullscreen mode

Exit fullscreen mode

A tiny helper script

export function requireEnv ( names : string [ ] ) { const missing = names . filter ( ( n ) => ! process . env [ n ] ) if ( missing .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.