OCA Bin
The OCA Bin is a command-line utility designed as the primary interface to the OCA Ecosystem. It offers a range of commands to manage both OCAFiles and OCA Bundles, streamlining the workflow for OCA-based projects. Internally, OCA Bin replicates functionality similar to an OCA Repo, resembling the experience of working with a Git repository. Its command set supports local OCAFile development and testing, enabling fast iteration and reducing the feedback loop for developers.
Installation
The OCA Bin is distributed as a standalone executable. You can download the latest version from the OCA Bin GitHub Releases page.
Workflows
OCAFile development
When working with an OCAFile, a typical workflow involves making changes, validating the OCAFile's correctness, and repeating as necessary. Once finalized, the OCAFile can be built and published to the OCA Repo. The commands validate
, build
, and publish
are integrated directly into OCA Bin to streamline this process.
Continuous Integration/Continuous Deployment (CI/CD) pipeline
The OCAFiles organization section covers various options for storing OCAFiles. To ensure accuracy and enable additional automated processes when a (sub)set of OCAFiles changes, OCA Bin integrates seamlessly with CI/CD pipelines.
The following pipeline setup can be implemented to maintain OCAFile accuracy:
- When a subset of OCAFiles changes (e.g., within a Git commit), the pipeline runs
oca build -d <directory> --diff
with OCA Bin to validate and build the modified OCAFiles. The--diff
flag ensures that only the changed OCAFiles have been processed since the last build. - If the previous step succeeds and the changes are validated, the pipeline can mark them as ready for the next stage, such as merging the pull request in GitHub or adding a
+1
score in Gerrit. - Finally, the pipeline can publish the OCAFiles to the OCA Repo using
oca publish -d <directory>
.
Concepts
Local state
OCA Bin keeps config and its local state within ~/.oca
directory.
Cache
When the -d <directory>
option is used, OCA Bin creates a cache directory, .oca-bin
, relative to the specified <directory>
. This directory stores intermediate files generated by the build
command, enhancing the efficiency of both the build
and publish
commands by preventing redundant reprocessing of OCAFiles.
OCAFile and OCA Bundle
An OCAFile is the entry point for modeling within the OCA Ecosystem. Using its Domain-Specific Language (DSL) enables the creation of complex data models. On the other hand, the OCA Bundle is the end product of the OCAFile, providing integrity to the OCA Ecosystem. This integrity property ensures that any OCA Bundle remains untampered and safeguarded through hashes generated by one-way hash functions. These hashes are embedded directly into the Bundles.
OCAFiles organization
When managing an extensive collection of OCAFiles, it's often beneficial to use a Version Control System (VCS), such as Git, to track changes and maintain organized control. OCA Bin operates under the assumption that a complete data model can be structured with OCAFiles and, therefore, includes a -d
flag across multiple commands to specify the directory containing these files. This approach facilitates efficient management of all files in the specified directory, mainly for validation, building, and publishing tasks.