{ "info": { "author": "Yusuke Tsutsumi", "author_email": "yusuke@yusuketsutsumi.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: System :: Software Distribution" ], "description": "miura\n=====\n\na Jenkins job management tool. Miura can create, update, and delete on\nmass for multiple jobs that vary slightly in configuration.\n\nUsage\n-----\n\nto create jobs with miura, the following is needed:\n\n* a job template, providing a template for a job\n* a directory, containing one or more files storing data with yaml\n* a python file, contaning\n\nTutorial\n--------\n\n### Getting Started\n\nLet's start with the most basic example. Create a directory scripts,\nand a file called example.py with the following:\n\n # scripts/example.py\n def run(options, data):\n yield {\n 'host': JENKINS_HOST_URL\n 'name': 'foo'\n 'template': 'base.xml'\n 'data': {}\n }\n\nAnd choose a job you want to copy off of, and download it to templates/base.xml:\n\n # with wget (Linux)\n mkdir -p templates && wget $JENKS_JOB_URL/config.xml -O templates/base.xml\n # with curl (OSX)\n mkdir -p templates && curl $JENKINS_JOB_URL/config.xml -o templates/base.xml\n\nAnd you're done! You can now create the foo job with:\n\n miura scripts/example.py\n\nOr the shorthand:\n\n miura example\n\nYou can delete the jobs by passing in the script\n\n # delete jobs\n miura -d example\n\nSee miura -h for a full explanation.\n\n### Using templates\n\nOf course, this is not very helpful by itself. The real power of miura\ncomes from not just generating one job, but generating multiple. Let's\nmake a series of jobs that echo different messages to the console.\n\nJenkins configurations can change over time, so this tutorial isn't\ngoing to include any examples of the xml that underlies jenkins\njobs. It's a good idea to get familiar with config.xml files yourself:\nmiura doesn't create these from scratch for you. Instead, miura\nspecializies templates you write based off a job you want to\nreplicate.\n\n* create a freestyle jenkins job \"template\" that echos 'foo' from the command line.\n* copy that job's config.xml file into templates/echo_template.xml.\n * you can access any job's config.xml file by hitting $JOB_URL/config.xml\n* replace the 'foo' in the config.xml with '{{ message }}', so it looks like the following:\n\n \n \n echo '{{message}}'\n \n\nmiura uses the [jinja2](http://jinja.pocoo.org/docs/) templating\nlanguage to specialize it's templates. In the example above, we're\ngoing to pass into the template a different message of each job, which\nwill substitute {{message}} with a real value.\n\nModify the script.py from before with the following:\n\n # scripts/example.py\n def run(options, data):\n for echo_message in ('bar', 'baz', 'bat'):\n yield {\n 'host': JENKINS_HOST_URL\n 'name': 'echo-' + echo_message\n 'template': 'echo_template.xml'\n 'data': {\n 'message': echo_message\n }\n }\n\nAnd you're done! if you run the job now, you'll make three jobs: 'echo-bar', 'echo-baz', and 'echo-bat'.\n\nthe run method in each script should yield a dictionary for each job\nto generate. our example yields through each message we want to create\na job for, which miura in turn generates.\n\n### Using data\n\nSo now we've covered how to generate multiple jobs. But storing all\nour data with the script file is not very practical: we can't share\ndata among our scripts, and we can't share data filtering code\n\nmiura solves this problem by storing data in a separate format all\ntogether, and passing an aggregate dictionary of values into each method.\n\nCreate a yaml file known as echo.yaml and add it to a directory data:\n\n # data/echo.yaml\n echo_messages:\n - 'bar'\n - 'baz'\n - 'bat'\n\nNow we have a separation of data and function. We can now remove the data from our script:\n\n # scripts/example.py\n def run(options, data):\n for echo_message in data.get('echo_messages'):\n yield {\n 'host': JENKINS_HOST_URL\n 'name': 'echo-' + echo_message\n 'template': 'echo_template.xml'\n 'data': {\n 'message': echo_message\n }\n }\n\nAnd you're done!\n\n### filtering data\n\nNow that we have our data in a format all our scripts can use, we can\nshare filtering logic as well. If you want to filter your data, you\ncan filter data with one or more filters:\n\n miura -f \"echo_messages:ba[z|t]\"\n\n### Conclusion\n\nWe've covered:\n\n* that miura runs commands through scripts (under scripts/)\n* that miura uses jinja to render templates (under templates/)\n* that miura can store data in a common location (under data/)\n\nUltimately, our folder structure looks like:\n\n* /\n * data/\n * echo.yaml\n * scripts/\n * example.py\n * templates/\n * echo_template.xml", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://toumorokoshi.github.io/miura", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "miura", "package_url": "https://pypi.org/project/miura/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/miura/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://toumorokoshi.github.io/miura" }, "release_url": "https://pypi.org/project/miura/0.1.5/", "requires_dist": null, "requires_python": null, "summary": "a Jenkins job management tool", "version": "0.1.5" }, "last_serial": 1315372, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "71ed3e640439641eff1fa006a011f28b", "sha256": "dc4c7e2abc02ec68bb7929fe1a160320a68904c2bf0e1d72ed71b81bbb117c01" }, "downloads": -1, "filename": "miura-0.0.1.tar.gz", "has_sig": false, "md5_digest": "71ed3e640439641eff1fa006a011f28b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6642, "upload_time": "2014-05-08T21:25:55", "url": "https://files.pythonhosted.org/packages/28/23/dc2443a3211f8c2af61a2eee73b422715336421d97ff92700a50c76ae759/miura-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "480542b08dedc6160e498529492562ce", "sha256": "f91f79de9050018e707cd94e51856de15f347450c4dfee281d8f9d35b1963279" }, "downloads": -1, "filename": "miura-0.0.2.tar.gz", "has_sig": false, "md5_digest": "480542b08dedc6160e498529492562ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6808, "upload_time": "2014-11-06T00:39:58", "url": "https://files.pythonhosted.org/packages/f9/d9/ac41193797c5f8a1f8862c16a06d56f62cf6d0466f8974327493b6598447/miura-0.0.2.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "94b6a55372a19339245cba1862e0a0db", "sha256": "3244f646b64c70ac13485c0f84a9869c72e127c96319684fad3d095e8cfd3548" }, "downloads": -1, "filename": "miura-0.1.0.tar.gz", "has_sig": false, "md5_digest": "94b6a55372a19339245cba1862e0a0db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7138, "upload_time": "2014-11-06T20:03:31", "url": "https://files.pythonhosted.org/packages/b9/dc/2e0f0638635e4b3c4decce15be3843a8d7c4912ad810ddcf7cda9de98d75/miura-0.1.0.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "4863558daa325a3bb98937b0dd2f17e2", "sha256": "5d4f19e3fb17c97bbfbccf9efe7a68c5800c7c03063c26a65b8271524d4c9ebf" }, "downloads": -1, "filename": "miura-0.1.2.tar.gz", "has_sig": false, "md5_digest": "4863558daa325a3bb98937b0dd2f17e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7308, "upload_time": "2014-11-13T01:58:23", "url": "https://files.pythonhosted.org/packages/5d/ba/7f7d2d232f29009c74cb3f4b994daec76155fa778d330e0eb7f6160a46fe/miura-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "34b6f888e589054e8569be81166eff64", "sha256": "f033495828686f8ab5b44de55e37f8060e00e1c6a959729cb0465f2638b48c77" }, "downloads": -1, "filename": "miura-0.1.3.tar.gz", "has_sig": false, "md5_digest": "34b6f888e589054e8569be81166eff64", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7318, "upload_time": "2014-11-21T01:55:08", "url": "https://files.pythonhosted.org/packages/bd/88/c567c146e4d82762eb95a4d02f78c7d90bfbf2096afca14e7bef89665825/miura-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "2855e07867061c3644dbf03a083683d1", "sha256": "c68f8f1d246832f097c4634e0821242c8b9dbb8ee6f7f3a4fdfb3bffcea1710f" }, "downloads": -1, "filename": "miura-0.1.4.tar.gz", "has_sig": false, "md5_digest": "2855e07867061c3644dbf03a083683d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7314, "upload_time": "2014-11-21T02:00:38", "url": "https://files.pythonhosted.org/packages/fa/60/bfcae95b6a628dba02f1fdc2f33eca0ef949e5dce75b661c0d121e922a60/miura-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "db14d5d6d0fa2c011aed915ffc1ecfec", "sha256": "0a372ea47b8c027851c48a19376df754b6dec65ee29ccbe712b34fd4ea75acdd" }, "downloads": -1, "filename": "miura-0.1.5.tar.gz", "has_sig": false, "md5_digest": "db14d5d6d0fa2c011aed915ffc1ecfec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7363, "upload_time": "2014-11-21T02:09:48", "url": "https://files.pythonhosted.org/packages/5f/c3/0a0bb9f2a7b74e2d1fb9c7bc3bd977fa2486a11d97015e71221de4d71fc0/miura-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "db14d5d6d0fa2c011aed915ffc1ecfec", "sha256": "0a372ea47b8c027851c48a19376df754b6dec65ee29ccbe712b34fd4ea75acdd" }, "downloads": -1, "filename": "miura-0.1.5.tar.gz", "has_sig": false, "md5_digest": "db14d5d6d0fa2c011aed915ffc1ecfec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7363, "upload_time": "2014-11-21T02:09:48", "url": "https://files.pythonhosted.org/packages/5f/c3/0a0bb9f2a7b74e2d1fb9c7bc3bd977fa2486a11d97015e71221de4d71fc0/miura-0.1.5.tar.gz" } ] }