Thank you for contributing to the RHOAS CLI. See below for guides to help you contribute.
The following will need to be installed on your device in order to contribute to this project.
- Go >= v1.16
- golangci-lint
- OpenAPI Generator
- Yarn
- GoReleaser (optional)
You can run the CLI commands files directly with go run
. All commands and subcommands are in the ./pkg/cmd
folder.
go run ./cmd/rhoas kafka create "test" --provider=aws --region=us-east-1
Run make githooks
to install important Githooks
This will symlink the files from ./githooks
to .git/hooks
Runs a linter on the Go source code. Configuration can be found in .golangci.yaml
.
There are a number of lint rules enabled. You can find a full list of rules here with usage and configuration guides.
Builds a binary in the $GOPATH/bin
directory. Can be executed globally as it is in your $PATH
.
Builds an executable binary rhoas
of the CLI in the project root. Executable only inside the workspace.
Formats source code.
Generates code based on comments in code. This is primarily used to generate interface stubs using moq.
If you have the Go extension for VS Code, you can generate test stubs for a file, package or function. See Go#Test
Runs unit tests
Runs integration tests
RHOAS SDK provides mock for all supported APIs. To use mock you need to have NPM installed on your system and have free port 8000 To work and test CLI locally please follow the mock readme and then login into cli using dev profile:
rhoas login --api-gateway=http://localhost:8000
Starts the mock all services Manager API and Instance API at http://localhost:8000
.
To log in to the mock API, run rhoas login against the local server
with your authentication token:
rhoas login --api-gateway=http://localhost:8000
All text strings are placed in ./pkg/localizer/assets
directory.
The main CLI documentation can be found in the ./docs
folder.
Documentation can be generated from the CLI commands.
make docs/generate
After running the command, the documentation should be generated in AsciiDoc format.
After running the command, the dist
directory will contain the documentation conforming to the modular docs specification.
- Command Line Interface Guidelines is a great resource for writing command-line interfaces.
- Write clear and meaningful Git commit messages following the Conventional Commits specification
- Provide clear documentation comments.
- Make sure you include a clear and detailed PR description, linking to the related issue when it exists.
- Check out CodeReviewComments when writing and reviewing Go code.
This project follows Semantic Versioning. Before creating a release, identify if it will be a major, minor, or patch release. In the following example, we will create a patch release 0.20.1
.
NOTE: When creating a release it is good practice to create a pre-release first to monitor the integration tests to ensure everything works as it should.
For testing purposes we should always release a local snapshot version for testing (requires GoReleaser)
goreleaser --snapshot --rm-dist
Execute git tag v0.20.1
to create the release tag. Then execute git push origin v0.20.1
to push to the tag to your remote (GitHub).
Once pushed, a GitHub Action will create a release on GitHub and upload the binaries.
NOTE: To create a pre-release, the tag should have appropriate suffix, e.g v0.20.1-alpha1
NOTE: This step is not required for pre-releases.
git-chglog is used to generate a changelog for the current release.
Run ./scripts/generate-changelog.sh
to output the changes between the current and last stable releases. Paste the output into the description of the release on GitHub.