{"id":26493664,"url":"https://github.com/redhat-openstack/container-validations","last_synced_at":"2025-03-20T09:56:39.281Z","repository":{"id":40562477,"uuid":"204637931","full_name":"redhat-openstack/container-validations","owner":"redhat-openstack","description":"Provide a container allowing to run validations","archived":false,"fork":false,"pushed_at":"2022-05-02T16:02:32.000Z","size":53,"stargazers_count":3,"open_issues_count":1,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2023-04-30T01:21:30.873Z","etag":null,"topics":["container","docker","openstack","podman","tripleo","validations"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redhat-openstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-27T06:44:10.000Z","updated_at":"2020-06-28T22:09:12.000Z","dependencies_parsed_at":"2022-08-09T23:11:04.704Z","dependency_job_id":null,"html_url":"https://github.com/redhat-openstack/container-validations","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-openstack%2Fcontainer-validations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-openstack%2Fcontainer-validations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-openstack%2Fcontainer-validations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-openstack%2Fcontainer-validations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhat-openstack","download_url":"https://codeload.github.com/redhat-openstack/container-validations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244591486,"owners_count":20477709,"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":["container","docker","openstack","podman","tripleo","validations"],"created_at":"2025-03-20T09:56:38.735Z","updated_at":"2025-03-20T09:56:39.270Z","avatar_url":"https://github.com/redhat-openstack.png","language":"Python","readme":"# container-validations\n\nThis project provides a container-based mechanism to run validations.\n\n\n## How to use this project?\n\nAll is relying on a python script: validation.py. Using this script, you will\nget the following:\n- a container image able to run the validations\n- a run of a container based on this image\n- information on the validations available to run\n\nAll the logs will be in the container stdout/stderr, meaning you're able\nto rely on the container engine's logging configuration in order to get a proper\nstatus.\n\n\n### Inventory file\n\nThe repository holds an inventory file which holds connection information for\nall relevant hosts. You can add or edit host information here before the first\nrun or provide your own inventory file using the `--inventory` option.\n\n\n#### TripleO\n\nIf you're working in a TripleO environment, you can use the\n`scripts/tripleo-inventory` script to create an inventory file from the\ntripleo-ansible-inventory. The resulting file will contain connection\ninformation for the undercloud and overcloud nodes, as well as some additional\ninformation that can be used in validations. For now the script is tested with\nthe Newton release of OpenStack. It can be used like this:\n\n```Bash\nsource ~/stackrc\ntripleo-ansible-inventory | ./scripts/tripleo-inventory \u003e tripleo-inventory.yaml\n```\n\n\n### First run / building the container image\n\nThe script first needs to build a container image which will be able to run the\nvalidations. To build the immage using the default options run:\n\n```Bash\n./validation.py --build\n```\n\nPlease note that the default container cli is `podman` if you don't have podman\ninstalled use `--container=docker` instead.\n\nOnce the container is built you can test it by running:\n```Bash\n./validation.py --inventory-ping\n```\n\nThis will test the connection information inside the inventory file.\n\n\n### Running validations\n\nIf you want to run a specific validation run:\n```Bash\n./validation.py --run --validations=openstack-endpoints\n```\n\nIf you want to run all validations for a certain group run:\n```Bash\n./validation.py --run --group pre-deployment\n```\n\nIf you want to run all validations run:\n```Bash\n./validation.py --run\n```\n\n### Listing validations\n\nIf you want to list validations run:\n```Bash\n./validation.py --list --group pre-deployment\n```\n\nor\n\n```Bash\n./validation.py --list\n```\n\n### Using a config file\n\nIf you regularly run validations with similar settings it might make sense to\nuse a config file instead of adding all arguments to each call.\n\nFirst you need to create one:\n\n```Bash\n./validation.py --create-config my-config.ini --container docker --repository /home/stack/tripleo-validations\n```\n\nThis will create a config file `my-config.ini` and add the values for the\n`--container` and `repository` arguments to it, so you don't have to add them\nto the call any more. You can use the file like this:\n\n```Bash\n./validation.py --config my-config.ini --list\n```\n\nYou can of course edit the file with a text editor, too.\n\n\n### Logging\n\nIf you want to have the validation results logged into a file you can use the `--log-path \u003clocal file path\u003e` option. Instead of just outputting the validation results on stdout it will log the results to the given log file path. If the file already exists the entries will be appended to the file, otherwise the file will be created.\n\n\n### Options\n\nTo see the complete list of options run\n```Bash\n./validation.py -h\n```\n\n## Developing validations\n\nBy default container-validations downloads and installs the upstream master\nduring build time. You can use the `--repository` option to change this to\neither a remote git repository or a local path.\n\nHere's a step to step guide to test a new validation in container-validations:\n\n1. Make sure to use a correct inventory file\n\nFor example if you want to test a new validation that runs on the host from\nwhich you're running container-validations your inventory file should look\nsomething like this:\n\n```\n---\nall:\n  hosts:\n  children:\n    undercloud:          # The validation playbook should point to this host\n      hosts:\n        172.16.0.95:     # This is your local IP\n```\n\nReference the inventory file using the `--inventory` option:\n\n```Bash\n(sudo) validation.py --run --inventory my-inventory.yaml\n```\n\nPlease note that you can test all connections in your inventory file:\n\n```Bash\n./validation.py --inventory my-inventory.ini --inventory-ping\n```\n\n\n2. Define a development repository\n\nUsually you want to use a local repository for development. You can use the\n`--repository` option to define a path to a local repository (remember you can\nstore the value in a config file):\n\n```Bash\n./validations.py --repository /home/stack/tripleo-validations --validations my-validation\n```\n\nIf you want to switch between branches of you repository, use `--branch`:\n\n```Bash\n./validations.py --repository /home/stack/tripleo-validations --validations my-validation --branch my-feature\n```\n\nPlease note: If you use that option with the `--build` command it will install\nthe repository's dependencies inside the container, so you should do this at\nleast once. If you use `--repository` together with the `--run` command it will\nonly bind-mount the local path into the container. This means that you don't\nneed to bulid the container everytime you make changes to your validations,\nonly when there are changes with the dependencies.\n\n\n## Other\n\n### Containerfile.sample\nIf you want to bypass the script, you can take the provided\nContainerfile.sample and build the container on your own. Please keep in mind\nsome packages are mandatory: ansible and git.\n\nPlease also ensure the init.sh script is copied inside your image, since it's\nthe default command.\n\nIn order to build it on your own, you can run:\n```Bash\n(podman|docker) build -t validations -f Containerfile\n```\n\nIn order to manually run the container, you can run:\n```Bash\n(podman|docker) run --rm -e \"INVENTORY=localhost,\" \\\n  -e \"VALIDATIONS=dns,no-op\" \\\n  -v $(pwd)/.ssh/id_rsa:/home/my-user/.ssh/id_rsa \\\n  validations\n```\n\n### Additional options\n\n#### `--user` and `--uid`\n\nThis will use a different user and UID than the current one when trying to connect to\nhosts.\n\n\n#### `--keyfile`\n\nSet the keyfile manually (usually /home/\u003ccurrent user\u003e/.ssh/id_rsa).\n\n\n#### `--extra-pkgs`\n\nInstall additional packages into your container image if they're needed by\ncustom validations.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-openstack%2Fcontainer-validations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhat-openstack%2Fcontainer-validations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-openstack%2Fcontainer-validations/lists"}