github.com/openshift-online/ocm-sdk-go@v0.1.473/CONTRIBUTING.md (about)

     1  # Contributing to the OCM SDK
     2  
     3  ### Validating model updates
     4  
     5  The easiest way to validate changes to the ocm-api-model is to generate the sdk based on the updated model.
     6  Ensure ocm-sdk-go is cloned locally alongside your cloned ocm-api-model directory where changes are made.
     7  
     8  In ocm-sdk-go, run the following to generate the sdk using the local ocm-api-model. Replace
     9  `/path/to/ocm-api-model` with the path to your cloned ocm-api-model repository where changes have been made.
    10  Replace `HEAD` with the commit SHA in ocm-api-model to build against if necessary.
    11  
    12  ```shell
    13  make clean
    14  make model_version=HEAD model_url=/path/to/ocm-api-model generate
    15  ```
    16  
    17  Review the output for errors. If none, the changes are at least syntactically proper.
    18  
    19  ### Style notes
    20  
    21  Comments can be added to types with the `//` notation. Comments should be added to each type's attribute where
    22  possible.
    23  
    24  Hard tabs are required rather than spaces.
    25  
    26  ## Releasing a new OCM API Model version
    27  
    28  To use any updates to the [ocm-api-model](https://github.com/openshift-online/ocm-api-model), the version
    29  must be incremented for consumption in ocm-sdk-go generation. The version is defined by the latest git tag.
    30  
    31  Once all changes to the OCM API Model have been defined and reviewed the client types for the model need to be generated via `make update` target
    32  in the `ocm-api-model` project.
    33  
    34  Once all changes to the OCM API Model have been committed to the main branch you will need to update these changes in the SDK.
    35  
    36  ## Updating the OCM SDK
    37  
    38  The OCM SDK can be generated simply by running the following after all changes have been made:
    39  
    40  ```shell
    41  ./hack/update-model.sh
    42  make update
    43  ```
    44  
    45  The `./hack/update-model.sh` script will ensure the `ocm-api-model` modules are all up to date with the latest version across the OCM-SDK project.
    46  To verify that they are all in-sync one can use the `./hack/verify-model-version.sh` script.
    47  
    48  One can add an optional commit SHA or version to the `./update-model.sh <vX.Y.Z>` script to update the go modules to a specific version.
    49  
    50  Whenever an update is made, ensure that the corresponding example in [examples](examples) is also updated where
    51  necessary. It is *highly recommended* that new endpoints have a new example created.
    52  
    53  ## Releasing a new OCM SDK Version
    54  
    55  Releasing a new version requires submitting an MR for review/merge with an update to the `Version` constant in
    56  [version.go](version.go). Additionally, update the [CHANGES.md](CHANGES.md) file to include the new version and
    57  describe all changes included.
    58  
    59  Below is an example CHANGES.md update:
    60  
    61  ```
    62  == 0.1.39 Oct 7 2019
    63  
    64  - Update to model 0.0.9:
    65    - Add `type` attribute to the `ResourceQuota` type.
    66    - Add `config_managed` attribute to the `RoleBinding` type.
    67  ```
    68  
    69  Submit an MR for review/merge with the CHANGES.md and version.go update.
    70  
    71  Finally, create and submit a new tag with the new version following the below example:
    72  
    73  ```shell
    74  git checkout main
    75  git pull
    76  git tag -a -m 'Release 0.1.39' v0.1.39
    77  git push origin v0.1.39
    78  ```
    79  
    80  Note that a repository administrator may need to push the tag to the repository due to access restrictions.