This document aims to have relevant information for people contributing to and maintaining the CFEngine CLI. It is not necessary for users of the tool to know about these processes. For general user information, see the README.
Releases are automated using a GH Action We create tags and releases through the GitHub UI. Go to the releases section in GitHub:
https://github.com/cfengine/cfengine-cli/releases
Determine the new version number according to SemVer:
- Look at what is the latest released version.
- Increase the first number if you are releasing breaking changes.
- Or, increase the second number if there are new features (but no breaking changes).
- Otherwise, increase the last number (only backwards compatible bugfixes).
Sometimes, it's not 100% clear, so use your best judgement.
Once you know the version number, proceed with making the release:
- Enter the version number into the Choose a tag dropdown.
- Click the Create new tag on publish alternative.
- Target should say main, don't change it.
- Put exactly the same version number into the Release title field.
- Click Generate release notes.
- In general, it's not necessary to edit the release notes.
- Sometimes you might want to add a link to a release blog post.
- Or, if there is a lot of noise, for example changes to docs and tests which don't affect users, you can remove those.
- Leave the checkboxes below as is (latest release checked, pre-release unchecked).
- Click Publish release.
- Watch the release happen:
- In GitHub Actions: https://github.com/cfengine/cfengine-cli/actions
- And if all is well, the new version should appear on PyPI: https://pypi.org/project/cfengine/
If it does not work, click the failing GitHub Actions and try to understand what went wrong.
The process is virtually identical to using the GUI.
Once you've determined what the version number should be, use the gh release create, and answer the prompts in a similar way to above:
gh release createGo through the prompts:
? Choose a tag Create a new tag
? Tag name 0.2.0
? Title (optional) 0.2.0
? Release notes Write using generated notes as template
? Is this a prerelease? No
? Submit? Publish release
https://github.com/cfengine/cfengine-cli/releases/tag/0.2.0
Then check that everything went well;
https://github.com/cfengine/cfengine-cli/actions
https://pypi.org/project/cfengine/
The GH Action shown above requires a PyPI token to have access to publish new versions to PyPI. Sometimes, this needs to be rotated. Log in to PyPI (need account access) and go to account settings:
https://pypi.org/manage/account/
Delete the old cfengine-cli token and generate a new one with the same name and correct scope (only access to cfengine project).
Copy the token and paste it into the GitHub Secret named PYPI_PASSWORD.
PYPI_USERNAME should be there already, you don't have to edit it, it is simply __token__.
Don't store the token anywhere else - we generate new tokens if necessary.
We use automated code formatters to ensure consistent code style / indentation. Please format Python code with black, and YAML and markdown files with Prettier. For simplicity's sake, we don't have a custom configuration, we use the tool's defaults.
If your editor does not do this automatically, you can run these tools from the command line:
black . && prettier . --writeThis project uses uv.
This makes it easy to run commands without installing the project, for example:
uv run cfengine formatgit fetch --all --tags
pip3 install .Unit tests:
py.testShell tests (requires installing first):
cat tests/shell/*.sh | bashcfengine run- The command could automatically detect that you have CFEngine installed on a remote hub, and run it there instead (using
cf-remote). - Handle when
cf-agentis not installed, help users install. - Prompt / help users do what they meant (i.e. build and deploy and run).
- The command could automatically detect that you have CFEngine installed on a remote hub, and run it there instead (using
cfengine format- Automatically break up and indent method calls, function calls, and nested function calls.
- Smarter placement of comments based on context.
- The command should be able to take a filename as an argument, and also operate using stdin and stdout. (Receive file content on stdin, file type using command line arg, output formatted file to stdout).
- We can add a shortcut,
cfengine fmt, since that matches other tools, likedeno.
cfengine lint- The command should be able to take a filename as an argument, and also take file content from stdin.
- It would be nice if we refactored
validate_config()incfbsso it would take a simple dictionary (JSON) instead of a special CFBSConfig object.
- Missing commands:
cfengine install- Install CFEngine packages / binaries (Wrappingcf-remote install).