Freestyle versus Pipeline Jobs

Scenario: A release process lives in UI text boxes, cannot be reviewed in a pull request, and differs after disaster recovery.

Pipeline example

pipeline { agent any; stages { stage('Package') { steps { sh './package.sh' } } } }

Delivery configuration needs history

A Freestyle job stores builders, publishers, wrappers, and triggers in controller XML. It is approachable for one command or a legacy integration, but a complex release becomes UI fields with weak review and rollback. Pipeline represents stages, agents, conditions, credentials, parallelism, and post-processing as code. A Jenkinsfile beside the application changes through the same pull request as the software it delivers.

Pipeline does not automatically create quality. A thousand-line Groovy program with hidden shell logic can be worse than a small Freestyle job. Keep stages aligned with recognizable delivery states, push deterministic build commands into repository scripts, and make steps restart-aware. Declarative syntax offers validation and visible structure; Scripted syntax offers dynamic Groovy control flow with additional CPS and maintenance risks.

Migrate without losing behavior

Inventory SCM settings, credentials, environment injection, tools, triggers, concurrency, builders, publishers, retention, and permissions. Convert one boundary at a time and compare outputs for the same commit. Publishers such as JUnit and artifact archiving often belong in post-always so a failing shell command cannot skip evidence. Pin tools rather than inheriting an administrator's changing latest version.

Disable the old trigger before enabling the replacement to prevent two jobs publishing the same version. Retain the legacy job read-only long enough to compare evidence, then retire it deliberately. Migration is complete when a reviewer can derive the workflow from source, a clean controller can recreate the job, a failed run retains reports, and an artifact can be traced back to one definition and revision.

Goal: Practice the concrete behavior in jenkins-declarative-rescue. Learn sections have no Jenkins terminal; the Jenkins lab opens the real shared service in a new full-screen tab inside your private folder.