#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🤵 FREE · DECLARATIVE

Jenkinsfile Generator: A Declarative Pipeline to Start From

Fill in your build, test and deploy commands and get a Jenkinsfile for your repository.

  • 🐳 Docker or label agent
  • 🧪 JUnit test reports
  • 🚀 Main-branch deploy stage

How to use the Jenkinsfile Generator

  1. 1. Choose the agentRun in a Docker image, on a labelled node, or on any agent.
  2. 2. Add commandsBuild, test, image and deploy steps; leave a box empty to skip a stage.
  3. 3. Commit itSave as Jenkinsfile in the repository root and point a pipeline job at it.

The default pipeline

The defaults produce 3 stages that run inside a node:24-alpine container: Checkout runs checkout scm, Build runs npm ci && npm run build, and Test runs npm test and always publishes JUnit results from reports/junit/*.xml, even when tests fail. Options add timestamps to the console, stop builds after 30 minutes, keep the last 20 builds and prevent two builds of the same branch at once.

Add an image name and the pipeline gains a Docker image stage that builds, tags with the build number and pushes using stored credentials. Add a deploy command and a Deploy stage appears; both run only on main.

Plugins and good practice

  • The Docker agent and docker.build need the Docker Pipeline plugin and Docker on the agent.
  • junit needs the JUnit plugin; cleanWs() needs Workspace Cleanup.
  • when { branch 'main' } works in multibranch pipelines, where Jenkins knows the branch name.
  • Store registry passwords as Jenkins credentials and refer to them by ID; never type them in the file.

Commands you enter are put inside single-quoted Groovy strings with quotes escaped, so a stray apostrophe does not break the file. Generate the same CI on GitHub with the GitHub Actions workflow generator, and plan what to test with the test plan template generator.

Frequently asked questions

Declarative or scripted pipeline?

Declarative, which is the syntax Jenkins recommends for most pipelines. It is easier to read and validate.

How do I check the file before committing?

Jenkins has a declarative linter you can call through its CLI or the Pipeline Syntax pages in your Jenkins instance.

Is the Jenkinsfile Generator free?

Yes, the Jenkinsfile Generator is free. The first time you generate your first Jenkinsfile, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.

More free tools

See all free tools