Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/can 16 add fix for missing template #44

Merged
merged 7 commits into from
Nov 20, 2024

Conversation

m-o-leary
Copy link
Collaborator

Pull Request Checklist

  • Read the contributing guidelines
  • Tests pass
    • Tests pass locally on part of the code I have changed
  • Raised the PR against the develop branch
    • There is no develop branch

Background

  • This change is needed to decouple this repository with other internal SDK generation processes. When using this repository to generate an SDK for an internal/new project, the code breaks if there is not a template file for the new library. However, this repository is a public repository and therefore we may not be able to have templates included here initially. This change will add some logic to allow the process continue gracefully when a template does not exist

How were the changes implemented

  • Added if/else blocks to both generate-local and generate-cicd to check if a description template exists, if it does, normal service is resumed. If it does not then ./generate/templates/description.mustache created with the following content:
    [INTERNAL] FINBOURNE Technology {{APPLICATION_NAME}} SDK
    
  • Added a log message when no template is found:
    [INFO] No description template found for {{APPLICATION_NAME}} - if this is an external facing SDK - add ./generate/templates/description.{{APPLICATION_NAME}}.mustache to this project ASAP
    
    Example:
    [INFO] No description template found for my_new_lib - if this is an external facing SDK - add ./generate/templates/description.my_new_lib.mustache to this project ASAP
    

How Has This Been Tested?

  • Set APPLICATION_NAME environment variable to my_new_lib and ran generate-cicd and generate-local before and after making this change. Errors before, no error after.

How this can be tested

  1. Checkout branch
  2. Set the APPLICATION_NAME environment variable to my_new_lib (export APPLICATION_NAME=my_new_lib) - this will ensure that there is no generate/templates/description.my_new_lib.mustache found to test the new logic.
  3. Run just generate-local and observe the warning message in the logs:
    ...
    [INFO] No description template found for my_new_lib - if this is an external facing SDK - add ./generate/templates/description.my_new_lib.mustache to this project ASAP
    ...
  4. Confirm generate/.output/README.md file should contain a description that reads "[INTERNAL] FINBOURNE Technology my_new_lib SDK" at the top
  5. Create the template file: echo "My new Lib - FINBOURNE TECHNOLOGY" > generate/templates/description.my_new_lib.mustache
  6. Run just generate-local and observe no warning message in the logs.
  7. Confirm the generate/.output/README.md file contains the text "My new Lib - FINBOURNE TECHNOLOGY"

@cg-finbourne cg-finbourne merged commit d912f7f into main Nov 20, 2024
1 check passed
@m-o-leary m-o-leary mentioned this pull request Nov 20, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants