Skip to content
Novus Examples
jenkinsfile616 B

Jenkinsfile, Intentionally Invalid

An intentionally invalid Jenkinsfile: an unclosed stage block so braces never balance, a steps block outside any stage, and a bare identifier where the agent directive needs any, none, or a block. For testing parser error recovery and reporting.

Preview — first 25 linesjenkinsfile
// INTENTIONALLY INVALID. Three documented faults for a Groovy or declarative-pipeline parser:
//   1. the 'Build' stage block is never closed, so brace nesting does not balance
//   2. 'steps' appears directly under 'pipeline', outside any stage
//   3. 'agent' is given a bare identifier that is neither 'any', 'none', nor a block
pipeline {
    agent linux

    steps {
        sh 'echo misplaced'
    }

    stages {
        stage('Build') {
            steps {
                sh 'make build'
        }

        stage('Test') {
            steps {
                sh 'make test'
            }
        }
    }
}

Specifications

System
Jenkins
Variant
intentionally invalid
Faults
3
Braces Balanced
false

Testing contract

Expected to fail
Scenario
Parse a Jenkinsfile whose brace nesting does not balance
Expected result
Parsing fails with an unbalanced-brace or unexpected-EOF error rather than silently accepting a truncated stage tree

What is a .jenkinsfile file?

A Jenkinsfile defines a Jenkins pipeline as code. Declarative pipelines wrap a `pipeline` block containing agent, environment, options, stages, and post sections, while scripted pipelines are plain Groovy using `node` and `stage` steps; both are Groovy source, so the declarative form is validated against a schema before execution. It normally lives at the repository root with no file extension.

How to use this file

Use an example Jenkinsfile to test pipeline linters, Groovy parsers, and CI migration tooling, checking stage and parallel-branch extraction, environment-variable scoping, and that declarative-schema violations are reported with the offending block.

How to use this file for testing

“Jenkinsfile, Intentionally Invalid” is a deterministic Novus Examples fixture for Error handling, Config parsing, Schema validation. Deliberately corrupt and invalid files, clearly labelled, for testing how your tool fails.

Documented properties for this file: JENKINSFILE · 616 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.

Generated by generation/pipelines.py. Free for any use, no attribution required — license.