{"id":21151574,"url":"https://github.com/outstand/docker-bats","last_synced_at":"2025-06-26T09:38:00.775Z","repository":{"id":146511999,"uuid":"448065689","full_name":"outstand/docker-bats","owner":"outstand","description":"BATS image derived from buildkite/plugin-tester","archived":false,"fork":false,"pushed_at":"2022-01-18T14:16:14.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-21T08:11:51.906Z","etag":null,"topics":["bats","buildkite","buildkite-plugin","docker-image"],"latest_commit_sha":null,"homepage":"https://gallery.ecr.aws/a5k7g6j4/bats","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/outstand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-01-14T18:16:10.000Z","updated_at":"2022-01-18T14:07:46.000Z","dependencies_parsed_at":"2023-04-28T22:02:06.802Z","dependency_job_id":null,"html_url":"https://github.com/outstand/docker-bats","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outstand%2Fdocker-bats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outstand%2Fdocker-bats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outstand%2Fdocker-bats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outstand%2Fdocker-bats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outstand","download_url":"https://codeload.github.com/outstand/docker-bats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243591548,"owners_count":20315865,"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":["bats","buildkite","buildkite-plugin","docker-image"],"created_at":"2024-11-20T10:17:37.308Z","updated_at":"2025-03-14T14:26:05.941Z","avatar_url":"https://github.com/outstand.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BATS / Buildkite Plugin Tester [![Build status](https://badge.buildkite.com/500fdf41de3aedb37db15cc4d5acd6f47c8ae72ed6d1342a09.svg)](https://buildkite.com/outstand/docker-compose-buildkite-plugin)\n\nA base docker image for testing [Buildkite plugins](https://buildkite.com/docs/agent/v3/plugins) with BATS. It includes:\n\n* A non-root user/group at 1000:1000. A docker group is located at gid 900.\n* Docker compose v2 and compose-switch for v1 support.\n* [bats-core](https://github.com/bats-core/bats-core)\n* [bats-support](https://github.com/bats-core/bats-support)\n* [bats-assert](https://github.com/bats-core/bats-assert)\n* [@lox](https://github.com/lox)'s fork of [bats-mock](https://github.com/lox/bats-mock)\n* [bats-file](https://github.com/bats-core/bats-file)\n\nYour plugin’s code is expected to be mounted to `/plugin`, and by default the image will run the command `bats tests/`.\n\n## Usage\n\nFor example, say you had a plugin called `git-logger`, which took a `commit` option, and called `git log` via a command hook:\n\n```yml\nsteps:\n  - plugins:\n      - foo/git-logger#v1.0.0:\n          commit: \"abc123\"\n```\n\nTo test this, you'd add the following `docker-compose.yml` file:\n\n```yml\nversion: '3.4'\nservices:\n  tests:\n    image: buildkite/plugin-tester\n    volumes:\n      - \".:/plugin\"\n```\n\nAnd you'd create the following test in `tests/command.bats`:\n\n```bash\n#!/usr/bin/env bats\n\nload \"$BATS_PATH/load.bash\"\n\n# Uncomment to enable stub debugging\n# export GIT_STUB_DEBUG=/dev/tty\n\n@test \"calls git log\" {\n  export BUILDKITE_PLUGIN_GIT_LOGGER_COMMIT=\"abc123\"\n\n  stub git \"log abc123 : echo git log output\"\n\n  run $PWD/hooks/command\n\n  assert_output --partial \"git log output\"\n  assert_success\n  unstub git\n}\n```\n\nNow you can run your tests locally:\n\n```bash\ndocker compose run --rm tests\n```\n\nTo set up it up in Buildkite, create a `.buildkite/pipeline.yml` file that uses the [docker-compose Buildkite Plugin](https://github.com/buildkite-plugins/docker-compose-buildkite-plugin) to run that same command on CI, for example:\n\n```yml\nsteps:\n  - plugins:\n      - docker-compose#x.y.z:\n          run: tests\n```\n\n## Developing\n\nTo test plugin-tester itself, use the following command:\n\n```bash\ndocker compose run --rm tests\n```\n\n## License\n\nMIT (see [LICENSE](LICENSE))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutstand%2Fdocker-bats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutstand%2Fdocker-bats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutstand%2Fdocker-bats/lists"}