{"id":16732647,"url":"https://github.com/randycoulman/jujube","last_synced_at":"2025-03-21T21:31:23.566Z","repository":{"id":14908499,"uuid":"17632489","full_name":"randycoulman/jujube","owner":"randycoulman","description":"Ruby front-end for jenkins-job-builder","archived":false,"fork":false,"pushed_at":"2024-05-07T04:39:19.000Z","size":119,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T05:23:32.669Z","etag":null,"topics":["jenkins-jobs","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/randycoulman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-03-11T14:04:41.000Z","updated_at":"2024-05-07T04:38:17.000Z","dependencies_parsed_at":"2024-10-28T11:45:05.658Z","dependency_job_id":null,"html_url":"https://github.com/randycoulman/jujube","commit_stats":{"total_commits":94,"total_committers":6,"mean_commits":"15.666666666666666","dds":0.0957446808510638,"last_synced_commit":"40075f28969b0d211b907d9f2c920a9be351806a"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randycoulman%2Fjujube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randycoulman%2Fjujube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randycoulman%2Fjujube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randycoulman%2Fjujube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/randycoulman","download_url":"https://codeload.github.com/randycoulman/jujube/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244874208,"owners_count":20524576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jenkins-jobs","ruby"],"created_at":"2024-10-12T23:45:56.760Z","updated_at":"2025-03-21T21:31:23.134Z","avatar_url":"https://github.com/randycoulman.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jujube\n\n[![Gem Version](https://badge.fury.io/rb/jujube.png)](http://badge.fury.io/rb/jujube)\n[![Build Status](https://travis-ci.org/randycoulman/jujube.svg?branch=master)](https://travis-ci.org/randycoulman/jujube)\n[![Code Climate](https://codeclimate.com/github/randycoulman/jujube.png)](https://codeclimate.com/github/randycoulman/jujube)\n![Maintenance Status](https://img.shields.io/badge/maintenance-active-green.svg)\n\n**Jujube** is a Ruby front-end for\n[jenkins-job-builder](https://opendev.org/jjb/jenkins-job-builder).\n\njenkins-job-builder allows you to specify Jenkins jobs in YAML and then creates or\nupdates the jobs in a running Jenkins instance.  It provides some tools for removing\nduplication from job definitions, but sometimes more abstraction capability is needed.\n**Jujube** provides that capability.\n\nUsing **Jujube**, you can specify Jenkins jobs using a Ruby DSL (domain-specific language).\n**Jujube** then generates the YAML input needed by jenkins-job-builder.  **Jujube** also makes\nit easy to define methods that act as job templates or pre-configured components.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'jujube'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install jujube\n\n## Usage Instructions\n\n### Running Jujube\n\nTo run **Jujube** and convert one or more job definitions to YAML for use by jenkins-job-builder:\n\n```\njujube [--output output-file] file-or-directory*\n```\n\n**Jujube** will load all of the specified files (or all of the files in the specified directories)\nand generate a single YAML file containing all of the jenkins-job-builder job definitions.\n\nIf the `--output` (or `-o` for short) option is provided, the job definitions will be generated into\nthe specified file.  Any intermediate directories that do not already exist will be created\nautomatically.\n\nIf no output filename is specified, then a file named `jobs.yml` in the current working directory\nwill be used.\n\n### Defining Jobs\n\nTo define a Jenkins job using **Jujube**, use the `job` DSL function.  The most basic job definition\nis just a job name:\n\n```ruby\njob \"my-job\"\n```\n\nSuch a job does absolutely nothing, so you will most likely want to provide a configuration block as\nwell:\n\n```ruby\njob \"my-job\" do |j|\n  # Job configuration goes here...\nend\n```\n\nIn the job configuration block, you can specify attributes for the job and add components to sections.\nFor example:\n\n```ruby\njob \"my-job\" do |j|\n  j.description = \"This is my job.\"  # Specify attributes\n  j.quiet_period = 5\n\n  j.axes \u003c\u003c slave(:arch, %w{i386 amd64}) # Add components to sections\n\n  j.scm \u003c\u003c git(url: \"https://example.com/git/my-project\", branches: %w{master dev})\n\n  j.triggers \u003c\u003c pollscm(\"@hourly\")\n\n  j.wrappers \u003c\u003c timeout(type: 'elastic', elastic_percentage: 150, elastic_default_timeout: 5, fail: true)\n  j.wrappers \u003c\u003c timestamps\n\n  j.builders \u003c\u003c shell(\"bundle \u0026\u0026 bundle exec rake deploy\")\n\n  j.publishers \u003c\u003c email_ext(recipients: %w{me@example.com you@example.com})\nend\n```\n\nThe following job attributes are supported:\n\n* `project_type` -- doesn't normally need to be specified.  If any `axes` are added to the\n  job, then `project_type` is automatically inferred to be `matrix`\n* `description`\n* `node`\n* `block_upstream`\n* `block_downstream`\n* `quiet_period`\n* `concurrent`\n* `disabled`\n\nThe following sections and components are supported:\n\n* `axes`: (`label_expression`, `slave`)\n* `parameters`: (`string`, `validating_string`)\n* `properties`: (`throttle`)\n* `scm`: (`git`, `store`)\n* `triggers`: (`pollscm`, `pollurl`, `reverse`)\n* `wrappers`: (`timeout`, `timestamps`)\n* `builders`: (`copyartifact`, `shell`)\n* `publishers`: (`archive`, `cppcheck`, `email_ext`, `fitnesse`, `ircbot`, `junit`,\n  `trigger`, `trigger_parameterized_builds`, `xunit` (types `gtest` and `unittest`))\n* `notifications`: None defined yet\n\nSee [the end-to-end example job](acceptance/fixtures/endToEnd/endToEnd.job) for example\nuses of all of the supported attributes, sections, and components.\n\nIn general, component options are typically specified as standard Ruby hashes.  The option\nnames are the same as in the\n[jenkins-job-builder documentation](https://jenkins-job-builder.readthedocs.io/en/latest/),\nexcept that you need to use underscores (`_`) instead of dashes (`-`) in the option names.\n\n### Helper Methods\n\nIn your own projects, you can define helper methods that pre-configure jobs or components.\nSimply `require` the Ruby files containing your helper methods into your job files and use\nthem just like the **Jujube** supplied methods.  For example:\n\n```ruby\ndef template_job(name, description)\n  job name do |j|\n    j.description = description\n    j.quiet_period = 5\n    j.scm \u003c\u003c standard_git(name)\n    j.triggers \u003c\u003c pollscm(\"@hourly\")\n    j.wrappers \u003c\u003c timestamps\n\n    yield j if block_given?\n  end\nend\n\ndef standard_git(repo_name)\n  git(url: \"https://example.com/git/#{repo_name}\", branches: %w{master dev})\nend\n\ntemplate_job \"my-job\", \"This is my job\" do |j|\n  j.builders \u003c\u003c shell(\"rake deploy\")\nend\n```\n\n### Things to Note\n\n* **Jujube** doesn't do any input validation.  Rather than duplicating the validation that\n  jenkins-job-builder already does, **Jujube** accepts any component options provided in a job\n  definition and passes them through to the YAML file.  This actually makes **Jujube** quite\n  flexible and able to automatically support new options that are added in jenkins-job-builder.\n\n* **Jujube** does not yet support all of the components that jenkins-job-builder supports.  New\n  components are easy to add, and pull requests are more than welcome.\n\n## Extending Jujube\n\nThe `Job` class is the main class in **Jujube**.  It should be essentially complete now.  The\nmain work left to be done is to define the remaining components supported by jenkins-job-builder.\nComponents are defined in the various files in the `components` sub-directory.  There is one file\nper component type.\n\nMost components can be defined using the `standard_component` \"macro\".  If the component simply\ntakes a hash of options, then it is a standard component.  Otherwise, a specialized method must\nbe written for the component.  There are a few examples of these in the codebase.\n\nIf you'd like to add a component that requires some odd configuration and you're not sure how to\ntackle it, contact me and I'll be happy to help.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Make your change.  Please follow the coding conventions of the project and write good unit tests.\n   If you are adding a new component, please update `acceptance/fixtures/endToEnd/endToEnd.job` and\n   `acceptance/fixtures/endToEnd/expected.yml` as well.\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create new Pull Request\n\n## Acknowledgements\n\nThanks to Jason Roelofs, Chris Gaffney, and Sarah Mei for their input and feedback as I worked\non this project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandycoulman%2Fjujube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandycoulman%2Fjujube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandycoulman%2Fjujube/lists"}