Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

jenkinsfile-generator

БесплатноЗапускает вложенные скриптыНе проверен

Generate/create/scaffold Jenkinsfile — declarative, scripted, shared library, CI/CD pipelines.

akin-ozerот akin-ozer★ 346 звёзд на GitHub

Об этом скилле

Jenkinsfile Generator Skill

Generate production-ready Jenkinsfiles following best practices. All generated files are validated using devops-skills:jenkinsfile-validator skill.

Trigger Phrases

  • "Generate a CI pipeline for Maven/Gradle/npm"
  • "Create a Jenkins deployment pipeline with approvals"
  • "Build a Jenkinsfile with parallel test stages"
  • "Create a scripted pipeline with dynamic stage logic"
  • "Scaffold a Jenkins shared library"
  • "Generate a Jenkinsfile for Docker or Kubernetes agents"

When to Use

  • Creating new Jenkinsfiles (declarative or scripted)
  • CI/CD pipelines, Docker/Kubernetes deployments
  • Parallel execution, matrix builds, parameterized pipelines
  • DevSecOps pipelines with security scanning
  • Shared library scaffolding

Declarative vs Scripted Decision Tree

  1. Choose Declarative by default when stage order and behavior are mostly static.
  2. Choose Scripted when runtime-generated stages, complex loops, or dynamic control flow are required.
  3. Choose Shared Library scaffolding when request is about reusable pipeline functions (vars/, src/, resources/).
  4. If unsure, start Declarative and only switch to Scripted if requirements cannot be expressed cleanly.

Template Map

Template Path Use When
Declarative basic assets/templates/declarative/basic.Jenkinsfile Standard CI/CD with predictable stages
Declarative parallel example examples/declarative-parallel.Jenkinsfile Parallel test/build branches with fail-fast behavior
Declarative kubernetes example examples/declarative-kubernetes.Jenkinsfile Kubernetes agent execution using pod templates
Scripted basic assets/templates/scripted/basic.Jenkinsfile Complex conditional logic or generated stages
Shared library scaffold Generated by scripts/generate_shared_library.py Reusable pipeline functions and organization-wide patterns

Quick Reference

// Minimal Declarative Pipeline
pipeline {
    agent any
    stages {
        stage('Build') { steps { sh 'make' } }
        stage('Test') { steps { sh 'make test' } }
    }
}

// Error-tolerant stage
stage('Flaky Tests') {
    steps {
        catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
            sh 'run-flaky-tests.sh'
        }
    }
}

// Conditional deployment with approval
stage('Deploy') {
    when { branch 'main'; beforeAgent true }
    input { message 'Deploy to production?' }
    steps { sh './deploy.sh' }
}
Option Purpose
timeout(time: 1, unit: 'HOURS') Prevent hung builds
buildDiscarder(logRotator(numToKeepStr: '10')) Manage disk space
disableConcurrentBuilds() Prevent race conditions
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') Continue on error

Core Capabilities

1. Declarative Pipelines (RECOMMENDED)

Process:

  1. Read templates for structure reference:
    • Read assets/templates/declarative/basic.Jenkinsfile to understand the standard structure
    • Templates show the expected sections: pipeline → agent → environment → options → parameters → stages → post
    • For complex requests, adapt the structure rather than copying verbatim
  2. Consult reference documentation:
    • Read references/best_practices.md for performance, security, and reliability patterns
    • Read references/common_plugins.md for plugin-specific syntax
  3. Generate with required elements:
    • Proper stages with descriptive names
    • Environment block with credentials binding (never hardcode secrets)
    • Options: timeout, buildDiscarder, timestamps, disableConcurrentBuilds
    • Post conditions: always (cleanup), success (artifacts), failure (notifications)
    • Always add failFast true or parallelsAlwaysFailFast() for parallel blocks
    • Always include fingerprint: true when using archiveArtifacts
  4. ALWAYS validate using devops-skills:jenkinsfile-validator skill

2. Scripted Pipelines

When: Complex conditional logic, dynamic generation, full Groovy control Process:

  1. Read templates for structure reference:
    • Read assets/templates/scripted/basic.Jenkinsfile for node/stage patterns
    • Understand try-catch-finally structure for error handling
  2. Implement try-catch-finally for error handling
  3. ALWAYS validate using devops-skills:jenkinsfile-validator skill

3. Parallel/Matrix Pipelines

Use parallel {} block or matrix {} with axes {} for multi-dimensional builds.

  • Default behavior is fail-fast for generated parallel pipelines (parallelsAlwaysFailFast() or stage-level failFast true).

4. Security Scanning (DevSecOps)

Add SonarQube, OWASP Dependency-Check, Trivy stages with fail thresholds.

5. Shared Library Scaffolding

python3 scripts/generate_shared_library.py --name my-library --package org.example

Declarative Syntax Reference

Agent Types

agent any                                    //
Полный SKILL.md на GitHub

Установить jenkinsfile-generator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.gitignoreassets/templates/declarative/basic.Jenkinsfileassets/templates/scripted/basic.Jenkinsfileexamples/declarative-ci-basic.Jenkinsfileexamples/declarative-docker.Jenkinsfileexamples/declarative-kubernetes.Jenkinsfileexamples/declarative-matrix.Jenkinsfileexamples/declarative-parallel.Jenkinsfileexamples/declarative-security-scan.Jenkinsfileexamples/declarative-shared-library.Jenkinsfileexamples/scripted-basic.Jenkinsfileexamples/scripted-conditional.Jenkinsfileexamples/scripted-docker.Jenkinsfilereferences/best_practices.mdreferences/common_plugins.mdscripts/generate_declarative.pyscripts/generate_scripted.pyscripts/generate_shared_library.pyscripts/lib/__init__.pyscripts/lib/common_patterns.pyscripts/lib/syntax_helpers.pyscripts/test_generate_declarative.pyscripts/test_generate_shared_library.py

FAQ

Что делает скилл jenkinsfile-generator?

Generate/create/scaffold Jenkinsfile — declarative, scripted, shared library, CI/CD pipelines.

Как установить скилл jenkinsfile-generator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл jenkinsfile-generator запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить jenkinsfile-generator с