{ "info": { "author": "Christian Tragesser", "author_email": "christian@evoen.net", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "# pypline-ci\n[![pipeline status](https://gitlab.com/christianTragesser/pypline-ci/badges/master/pipeline.svg)](https://gitlab.com/christianTragesser/pypline-ci/commits/master)\n\nA docker orchestration tool for container-based delivery pipelines - providing developers, testers, and operators a common automated testing tool for local workstations and delivery pipeline infrastructure.\n\nI'm currently experimenting with docker-in-docker delivery pipelines written in a *high-level language* hoping to capitalize on object-oriented concepts native to Python. While bash does provide a simple ability to script docker-in-docker pipelines; at a certain scale, creating and maintaining independent scripts across multiple integrated repositories or projects becomes cumbersome and inefficient.\n\n##### Why Python 2.7 by default?\nCurrently, Python 2.7 is native to most Docker development workstations(popular Linux distros or MacOS). A major focus of this tooling is minimal dependencies however, this library is compatible with Python 3 as well.\n\n#### Examples\nBuild image and run container:\n```python\nimport os\nfrom pyplineCI import Pipeline\n\ndirPath = os.path.dirname(os.path.realpath(__file__))\nbuildPath = dirPath+'/docker/'\nlocalTag = 'local/foo:latest'\n\npl = Pipeline()\npl.build_image(buildPath, localTag)\npl.rund(localTag)\n```\n\nImplement testing framework from dedicated testing image:\n```python\nimport os\nfrom pyplineCI import Pipeline\n\ndirPath = os.path.dirname(os.path.realpath(__file__))\nvolumes = {dirPath: {'bind': '/tmp', 'mode': 'rw'}}\ntestDir = '/tmp/tests'\n\npl = Pipeline(dockerRegistry='registry.gitlab.com/christiantragesser/')\npl.runi(image=pipeline.dockerRegistry+'my-test-image:latest',\n name='foo-test', working_dir=testDir,\n volumes=volumes, command='pytest')\n```\n\nOrchestrate application stack for UAT testing then remove all containers if tests are successful:\n```python\nimport os\nfrom pyplineCI import Pipeline\n\ndirPath = os.path.dirname(os.path.realpath(__file__))\ncleanUp = []\n\nuat_volume = {dirPath: {'bind': '/tmp', 'mode': 'rw'}}\ntestDir = '/tmp/tests'\ndb_env_vars = {'MYSQL_ROOT_PASSWORD': 'root', 'MYSQL_DATABASE': 'foo-db', 'MYSQL_ROOT_HOST': '%'}\napp_env_vars = {'DB_HOST': 'mysql-test', 'DB_USER': 'root', 'DB_PASSWORD': 'root', 'DATABASE': 'foo-db'}\n\npl = Pipeline()\ncleanUp.append(pl.rund(image='mysql:5.7', name='mysql-test', environment=db_env_vars))\ncleanUp.append(pl.rund(image='local/foo_app', name='foo-app-test', environment=app_env_vars))\npl.runi(image='tutum/curl:latest', name='foo-uat',\n working_dir=testDir, volumes=uat_volume,\n command='./uat.sh foo-app-test:5000')\npl.purge_containers(cleanUp)\n``` \nPerform CVE scan on a docker image:\n```bash\nMY_IMAGE=\"alpine:latest\"\npython3 -c \"from pyplineCI import Pipeline; Pipeline().cve_scan(${MY_IMAGE})\"\n```\n#### API reference\n* **Pipeline**(_network='ci_net', dockerRegistry='library/'_)\n\n ```class pypline-ci.pyplineCI.Pipeline```\n - **create_network(** _network_ **)** | Create docker pipeline network. \n parameters:\n + network(_str_) - Name of pipeline network, default `ci_net`\n - **build_image(** _path, tag_ **)** | Build docker image. \n parameters:\n + path(_str_) - Path to the directory containing the Dockerfile.\n + tag(_str_) - Tag applied to newly built image.\n - **pull_image(** _image_ **)** | Pull an image of the given name, similar to the `docker pull` command. If no tag is specified, all tags from that repository will be pulled. \n parameters:\n + image(_str_) - Image name to pull.\n - **rund(** _image, stderr=None, ports=None, volumes=None, name=None, environment=None, network=__, command=None, detach=True, remove=False_ **)** |\n Performs pull action on provided image, runs a daemonized container, then returns the container ID. \n parameters:\n + environment(_dict or list_) - Environment variables to set inside the container.\n + image(_str_) - The image to update and run.\n + name(_str_) - The name for this container.\n + ports(_dict_) - Port bindings to the container. The keys of the dictionary are the ports to bind inside the container, either as an integer or a string in the form port/protocol, where the protocol is either tcp or udp. The values of the dictionary are the corresponding ports to open on the host.\n + volumes(_dict_) - Configure volumes mounted inside the container.\n - **runi(** _image, command, name=None, volumes=None, working_dir='/root', tty=True, environment=None, stdin_open=True, network=__, auto_remove=False_ **)** | Performs pull action on provided image, runs an interactive container implementing provided command, then returns container stdout logs and command exit status(zero or non-zero). \n parameters:\n + command(_str_) - The command to run in the container.\n + environment(_dict or list_) - Environment variables to set inside the container.\n + image(_str_) - The image to update and run.\n + name(_str_) - The name for this container.\n + ports(_dict_) - Port bindings to the container. The keys of the dictionary are the ports to bind inside the container, either as an integer or a string in the form port/protocol, where the protocol is either tcp or udp. The values of the dictionary are the corresponding ports to open on the host.\n + volumes(_dict_) - Configure volumes mounted inside the container.\n + working_dir(_str_) - Path to the working directory.\n - **purge_containers(** _ids_ **)** | Force deletion of container by container ID. \n parameters:\n + ids(_list_) - List of container IDs to delete.\n - **cve_scan(** _scanImage_ **)** | Perform CVE scan of docker image using [CoreOS Clair](https://coreos.com/clair/docs/latest/). \n parameters:\n + scanImage(_str_) - The image to scan.\n\n#### Install\nInstall on docker host:\n* From [PyPi](https://pypi.org/project/pypline-ci/)\n```sh\n$ pip install pypline-ci\n```\n\nor\n\n* Via docker:\n\n```sh\n$ docker run --rm -it \\\n -v /var/run/docker.sock:/var/run/docker.sock \\\n -v $PWD:/tmp \\\n -w /tmp \\\n registry.gitlab.com/christiantragesser/pypline-ci:latest /bin/sh\n```\n\n* For Python 3:\n\n```sh\n$ docker run --rm -it \\\n -v /var/run/docker.sock:/var/run/docker.sock \\\n -v $PWD:/tmp \\\n -w /tmp \\\n registry.gitlab.com/christiantragesser/pypline-ci:3 /bin/sh\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/christianTragesser/pypline-ci", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pypline-ci", "package_url": "https://pypi.org/project/pypline-ci/", "platform": "", "project_url": "https://pypi.org/project/pypline-ci/", "project_urls": { "Homepage": "https://github.com/christianTragesser/pypline-ci" }, "release_url": "https://pypi.org/project/pypline-ci/0.1.30/", "requires_dist": null, "requires_python": "", "summary": "A docker pipeline library", "version": "0.1.30" }, "last_serial": 6004721, "releases": { "0.1.25": [ { "comment_text": "", "digests": { "md5": "c373332f7ac10c6d82d6dde141956a68", "sha256": "bdc386c20d139e852cd11df29dcab0cb43593a683333ae0c707f7635e52b3d0a" }, "downloads": -1, "filename": "pypline-ci-0.1.25.tar.gz", "has_sig": false, "md5_digest": "c373332f7ac10c6d82d6dde141956a68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5405, "upload_time": "2019-07-07T18:19:48", "url": "https://files.pythonhosted.org/packages/cc/e0/22f4ed5ecef8c51cfa4f63d4cfe88aa640660483079ac7f786b41953a472/pypline-ci-0.1.25.tar.gz" } ], "0.1.26": [ { "comment_text": "", "digests": { "md5": "c6f3f69f71d844b39073eb99fce06fd8", "sha256": "4f3648a2bcf8414c945e38874c3387afbf33162d1f9fcd94e2369d9f159edf40" }, "downloads": -1, "filename": "pypline-ci-0.1.26.tar.gz", "has_sig": false, "md5_digest": "c6f3f69f71d844b39073eb99fce06fd8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5459, "upload_time": "2019-07-12T13:51:44", "url": "https://files.pythonhosted.org/packages/80/7c/0af3a00681fe031777aa4a3b32062d13de1b77ef6c2a8fc1498d1c1aacf1/pypline-ci-0.1.26.tar.gz" } ], "0.1.27": [ { "comment_text": "", "digests": { "md5": "5852ac5cfd58c4b51b62386a75e79a4a", "sha256": "b0c149d9554ab83708c2bfd3cde49df52802cce3a8f96c60ba758f4d45cbbb51" }, "downloads": -1, "filename": "pypline-ci-0.1.27.tar.gz", "has_sig": false, "md5_digest": "5852ac5cfd58c4b51b62386a75e79a4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5403, "upload_time": "2019-07-12T14:05:50", "url": "https://files.pythonhosted.org/packages/e4/96/6184c8e225a8daa4c421702cf839938aa38e97952aca0c4a129432b43cc8/pypline-ci-0.1.27.tar.gz" } ], "0.1.28": [ { "comment_text": "", "digests": { "md5": "7f7b339eca3faefa7a88e88beb9b852f", "sha256": "7fcae158fb6d265370a9c4e8fb477630746b16b22ffa9bdbee7bcf0e6ba372ee" }, "downloads": -1, "filename": "pypline-ci-0.1.28.tar.gz", "has_sig": false, "md5_digest": "7f7b339eca3faefa7a88e88beb9b852f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5392, "upload_time": "2019-07-15T02:41:51", "url": "https://files.pythonhosted.org/packages/e9/5c/b7b17025a46b92d4255ca6b52bf8a9d83b3069a4ca7770cca881a91bd5a7/pypline-ci-0.1.28.tar.gz" } ], "0.1.29": [ { "comment_text": "", "digests": { "md5": "23908ec7384baa82fdcce219ced1ec4b", "sha256": "ca8aa0ccf25124bb7ea02c8d35be52cb092382feb8bf36181ec1470da3748c99" }, "downloads": -1, "filename": "pypline-ci-0.1.29.tar.gz", "has_sig": false, "md5_digest": "23908ec7384baa82fdcce219ced1ec4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5387, "upload_time": "2019-07-17T20:39:40", "url": "https://files.pythonhosted.org/packages/f6/6d/2b2b8f19696e6efafe7936ea9db5f55e22124f866fc6ce9160db0a2934eb/pypline-ci-0.1.29.tar.gz" } ], "0.1.30": [ { "comment_text": "", "digests": { "md5": "ade8fa9d5cbf97678182cae00d2d646e", "sha256": "d73d47db0a6fd670e213ac80fa1d35b6f9097d1769ef97d3b1fc1e4ccf9d6bc9" }, "downloads": -1, "filename": "pypline-ci-0.1.30.tar.gz", "has_sig": false, "md5_digest": "ade8fa9d5cbf97678182cae00d2d646e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5414, "upload_time": "2019-10-20T21:33:24", "url": "https://files.pythonhosted.org/packages/70/bf/5251c4fe48885264936ccfff0c7d798738f726a86c42a100a46da9be2c70/pypline-ci-0.1.30.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ade8fa9d5cbf97678182cae00d2d646e", "sha256": "d73d47db0a6fd670e213ac80fa1d35b6f9097d1769ef97d3b1fc1e4ccf9d6bc9" }, "downloads": -1, "filename": "pypline-ci-0.1.30.tar.gz", "has_sig": false, "md5_digest": "ade8fa9d5cbf97678182cae00d2d646e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5414, "upload_time": "2019-10-20T21:33:24", "url": "https://files.pythonhosted.org/packages/70/bf/5251c4fe48885264936ccfff0c7d798738f726a86c42a100a46da9be2c70/pypline-ci-0.1.30.tar.gz" } ] }