Please see our Community Repository and our Contribution Guidelines. They provide information regarding the process of contributing to Conjur Open Source projects, including issue reporting, pull request workflow and community guidelines.
Contributing to this repository requires installation of some developer tools.
- git to manage source code
- Docker to manage dependencies and runtime environments
- Docker Compose to orchestrate Docker environments
- Access to DockerHub
The spec is compatible with CyberArk Secrets Manager, Self-Hosted and SaaS versions as well as Conjur OSS.
OpenAPI Specification v3.1.0 OpenAPI Generator v7.14.0
There are two main aspects to this project, the spec itself and the generated clients. Contained in the
bin directory there are many scripts for running various tests and checks against both the spec itself
and the generated clients. The most important scripts are integration_tests and generate_client.
The generate_client script will use the OpenApi Generator
to output a client to the out directory. You can specify the generated client's language with the -l
option, e.g. ./bin/generate_client -l go. This is a good tool if you need to generate a client for a currently
unreleased version, or need to do some manual testing on the latest version of a client.
The integration_tests script will automatically generate a client then run integration tests against
that client if they are available. Integration tests can be found in the test directory, you can
specify the language of the client to test with a long flag: --python, --csharp. Both scripts also have other
options which can be viewed by running them with the -h flag.
There is also an included api_test script which will run contract tests against an instance of
Conjur OSS. It is a great tool for finding return codes which are missing from the spec, and for finding
changes in Conjur OSS which may not yet have been reflected in the spec.
For a full list of all scripts and their purpose see the utility script reference
Setup the development environment using the start_conjur script. The script starts a Swagger Editor
container, used to the edit the OpenAPI spec, and stands up a new instance of Conjur OSS to test the
spec against.
$ ./bin/start_conjurTo use the OpenAPI spec against a pre-existing Secrets Manager server, start the Swagger Editor editor with
the start_spec_ui script.
$ ./bin/start_spec_uiIn each case, a browser window will be opened to the container running Swagger Editor.
Import the openapi.yml into the UI to view/edit.
The environment can be stopped and removed using the stop script.
$ ./bin/stop- Start Swagger Editor
- Import the specification YAML into the editor
File>Import file
- Edit the document as necessary
- Download the new specification YAML from the editor
File>Save as YAML
- Overwrite
openapi.ymlwith the downloaded YAML file
Modifications to the spec should go with updated integration tests, which can
be found in test/python/. The tests are based on a generated client, so to
see the impact of your spec changes you can generate a Python client using
./bin/generate_client -l python and view the generated client in out/python/.
To ensure your changes work as expected, you can run the automated tests.
bin/test_api_contract [-e <endpoint>]
- Uses Schemathesis to generate test cases for API endpoints, which test the conformance between Conjur Open Source and the OpenAPI specification.
- Runs containerized contract testing on all endpoints specified in
openapi.yml - Specifying an endpoint with the
-e|--endpointflag runs contract tests on that endpoint alone.
bin/test_integration
- Used to run the suite of integration tests against Conjur Open Source or Secrets Manager, Self-Hosted.
- Stands up a new Conjur environment, generates a client library, and runs the integration test suite.
- User must specify a client language to test with
-l:$ ./bin/test_integration -l python
- Run a subset of a clients tests by including an argument with the full package
path of the tests to run:
$ ./bin/test_integration -l python --test test_authn_api.TestAuthnApi.test_authenticate_200
- Tests can be run against Secrets Manager, Self-Hosted.
- This requires access to the CyberArk Docker registry in order to pull Secrets Manager, Self-Hosted images
$ ./bin/test_integration --enterprise -l python
./bin/lint_tests
- Lints the Python integration tests using Pylint.
./bin/lint_spec
- Uses spectral to lint the OpenAPI YAML.
- Will find broken references, malformed objects, and any other errors in the spec itself.
bin/transform [--enterprise/--oss]
- Generates a usable version of the specification for either Conjur (--oss) or Secrets Manager, Self-Hosted (--enterprise)
- Generates the Conjur version of the spec by default
bin/generate_client -l <language> [-o <output-directory>]
- Generates a client library for the desired
<language>. - Running the script with no argument will generate a Python client by default.
- Outputs to the
outdirectory by default.
bin/generate_kong_config
- Generates a declarative configuration used by Kong Gateway.
bin/start_spec_ui
- Used to start a Swagger Editor container independent of a Conjur instance.
- Runs the
bin/bundle_specscript before starting and points the UI at the bundled spec. - Editor available at http://localhost:9090 once the container is up.
bin/dev
- Used to set up a new development environment.
- Calls both
start_editorandstart_conjurto bring up both Conjur and Editor containers.
bin/start_conjur
- Used to start a new local Conjur instance based on the project's
docker compose. - Both the http & https ports are exposed so requests can be made to Conjur from outside the docker network.
bin/start_enterprise
- Used to start a new local Secrets Manager, Self-Hosted instance based on
conjur-intro
bin/stop
- Used to deconstruct the development environment.
- Stops and removes the
docker composeenvironment and Swagger Editor.
bin/bundle_spec
- Bundles all the sharded spec files into one file named
spec.ymlin the root project directory. - It should be noted that this bundled spec file loses some of the names/reference info when bundled and shouldn't be used directly to generate a client.
bin/parse_changelog
- Parses the changelog and makes sure it is up to date with keep a changelog standards.
bin/release
- Gathers artifacts to be attached to releases of the specification.
- Outputs archives to
release_artifactsin both zip and tarball format.
The Secrets Manager, Self-Hosted only endpoints included in the specification all use a specific annotation to indicate that they are "enterprise only". When the Open Source version of the spec is generated all of these objects will be removed.
someObject:
x-conjur-settings:
enterprise-only: trueThis marks someObject as an Secrets Manager, Self-Hosted only feature.
Note that because all paths have to be defined in the openapi.yml#/paths object it is
acceptable to just put the annotation on the openapi.yml#/paths/somePath object and leave it
off the referenced path definition. In this case when the Open Source version of the spec is generated
the path definition will have had its reference removed thereby not technically being
included in the spec.
Many of the scripts included in the bin directory have an optional --enterprise flag which
tells the script to use the Secrets Manager, Self-Hosted version of the spec. To generate the Secrets Manager, Self-Hosted version
of a client you would run ./bin/generate_client -l python --enterprise.
You can access a compatible version of the the Secrets Manager command line
interface by starting the cli docker compose container:
$ ./bin/cliA new release must be created whenever a new version of Conjur is released that has updates to the REST API.
- Review the NOTICES.txt file and ensure it reflects the current set of dependencies in the Gemfile
- If a new dependency has been added, a dependency has been dropped, or a version has changed since the last tag - make sure the NOTICES file is up-to-date with the new versions
- Examine the changelog and decide on the version bump rank (major, minor, patch).
- Change the title of Unreleased section of the changelog to the target
version.
- Be sure to add the date (ISO 8601 format) to the section header.
- Add a new, empty Unreleased section to the changelog.
- Remember to update the references at the bottom of the document.
- Change
spec/openapi.ymlfile's version object to reflect the change. - Commit these changes (including the changes to NOTICES.txt, if there are any).
Bump version to x.y.zis an acceptable commit message. - Push your changes to a branch, and get the PR reviewed and merged.
-
Tag the version on the master branch using eg.
git tag -s vx.y.z -m vx.y.z. Note this requires you to be able to sign releases. Consult the github documentation on signing commits on how to set this up. -
Push the tag:
git push vx.y.z(orgit push origin vx.y.zif you are working from your local machine).
- Create a new release from the tag in the GitHub UI
- Add the CHANGELOG for the current version to the GitHub release description
We currently do not have official spec releases for Secrets Manager, Self-Hosted. Versions of the spec can be
generated using ./bin/transform --enterprise which outputs a usable version of the spec to out/enterprise/spec.