repo-operator
is a modular and extensible repository management tool that streamlines development workflows by providing reusable, Docker-based, hermetic Makefile targets for common tasks. This ensures that all builds, tests, and operations are fully isolated and reproducible, regardless of the local environment. The project can be added as a Git submodule and used to manage operations like building, testing, and generating documentation across multiple repositories.
- Modular Structure: Reuse and include Makefile targets across projects.
- Hermetic Targets: All operations are executed within Docker containers, ensuring reproducibility and isolation from the host environment.
- Customizable: Allows the overwriting of key variables to suit the specific project needs.
- Dyanamic Targets: Supports dynamic Makefile targets that allow you to customize the behavior of commands by passing variables at runtime, to reuse the same target for different operations, such as building Docker images or running specific tasks, without hardcoding values for each case.
repo-operator/
├── makefiles/
│
├── github-actions/
│
├── gitignore/
│
├── scripts/
│
├── editorconfig/
│
├── README.md
- docker,make,git
To integrate the repo-operator
into your project:
git submodule add https://github.com/ioaiaaii/repo-operator.git repo-operator
This adds the repo-operator
submodule, making its Makefiles and scripts available for reuse in your project.
In your project's root Makefile
, include the repo-operator
Makefiles:
# +++ Overrides to Repo Operator
override OPERATOR_PATH := repo-operator
override OPENAPI_FILE := api/OpenAPI/openapi.yaml
override OPENAPI_DOCS_PATH := docs/api
# +++ Include make files from Repo Operator
include ${OPERATOR_PATH}/makefiles/base.mk
include ${OPERATOR_PATH}/makefiles/openapi.mk
include ${OPERATOR_PATH}/makefiles/golang.mk
include ${OPERATOR_PATH}/makefiles/package.mk
# +++ Local configuration starts, hit `make help` to fetch all available targets
These Makefiles contain reusable targets that automate tasks like building, testing, and generating OpenAPI documentation.
To view all the available targets, run:
make help
help autogenerated help target
add info to your command inserting before definition:
"## <text>"
environment Prints the current tag,branch and version
gitignore Syncs gitignore configuration
generate-docs: Generate OpenAPI documentation as Markdown
go-mod-update: Update depts
go-mod-sync: Runs go mod {tidy,vendor,verify}
go-lint: Runs linter
go-test: Runs tests
go-build-linux: Builds linux bin for amd64 arch
go-build-darwin: Builds darwin bin for amd64 arch
go-build-all: Builds all bins
docker-lint Runs hadolint on Dockerfile. Call it with DOCKER_IMAGE arg to parse the image name.
docker-image: Builds image. Call it with DOCKER_IMAGE arg to parse the image name.
Dockerfile should be under ${BUILD_PATH}/package/${DOCKER_IMAGE}
e.g. `make docker-image DOCKER_IMAGE=coooool`
docker-run: Detects the default exposed port from container's image, and run the container with the exposed port
All targets run within Docker containers, ensuring isolation from the local environment and full reproducibility. The targets came from repo-operator, due to includes in the local Makefile.
The repo-operator
is highly configurable, allowing you to override key variables to fit the structure and needs of your project. For instance, if your OpenAPI file or docs are in different paths, you can override the defaults:
override OPENAPI_FILE := path/to/your/custom_openapi.yaml
override OPENAPI_DOCS_PATH := path/to/your/docs/api
Similarly, other variables like OPERATOR_PATH
or Go build options can be customized as needed.
To ensure that the repo-operator
is up-to-date, run the following commands whenever updates are available:
git submodule update --remote
This ensures that your submodule stays synced with the latest changes in the repo-operator
repository.
This project is licensed under the MIT License. See the LICENSE file for details.