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

ogma-cli: Allow customizing the cFS application template #157

Closed
ivanperez-keera opened this issue Nov 12, 2024 · 6 comments
Closed

ogma-cli: Allow customizing the cFS application template #157

ivanperez-keera opened this issue Nov 12, 2024 · 6 comments
Assignees
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Feature Admin only: Change request pertaining to new features requested
Milestone

Comments

@ivanperez-keera
Copy link
Member

ivanperez-keera commented Nov 12, 2024

Description

The cFS application generation backend has a fixed template that it uses to generate the cFS application. That template does not fit all use cases, so we are finding users heavily modifying the output (which is hard to keep up with when there are changes), and or not using ogma altogether for that reason.

Allowing users to pick their own cFS template would make Ogma more versatile.

Type

  • Feature: Enable customizing output produced.

Additional context

None.

Requester

  • Ivan Perez.

Method to check presence of bug

Not applicable (not a bug).

Expected result

Ogma allows users to pick the custom cFS application template they want to use instead of relying on the one provided by default.

Desired result

Ogma allows users to pick the custom cFS application template they want to use instead of relying on the one provided by default.

Proposed solution

Modify ogma-core to use variable expansion based on mustache to create the output files.

Modify ogma-core's template to use the variables used by the cFS application generation module.

Modify ogma-core to give users the ability to pick a template directory via an optional input argument.

Modify ogma-cli to give users the ability to pick a template directory via an optional input argument (exposing the corresponding argument from ogma-core).

Modify README to demonstrate new capability.

Further notes

None.

@ivanperez-keera ivanperez-keera added CR:Status:Initiated Admin only: Change request that has been initiated CR:Type:Feature Admin only: Change request pertaining to new features requested labels Nov 12, 2024
@ivanperez-keera
Copy link
Member Author

Change Manager: Confirmed that the issue exists.

@ivanperez-keera ivanperez-keera added CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager and removed CR:Status:Initiated Admin only: Change request that has been initiated labels Nov 12, 2024
@ivanperez-keera
Copy link
Member Author

Technical Lead: Confirmed that the issue should be addressed.

@ivanperez-keera ivanperez-keera added CR:Status:Accepted Admin only: Change request accepted by technical lead and removed CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager labels Nov 12, 2024
@ivanperez-keera
Copy link
Member Author

Technical Lead: Issue scheduled for fixing in Ogma 1.5.

Fix assigned to: @ivanperez-keera .

@ivanperez-keera ivanperez-keera added CR:Status:Scheduled Admin only: Change requested scheduled and removed CR:Status:Accepted Admin only: Change request accepted by technical lead labels Nov 12, 2024
@ivanperez-keera ivanperez-keera added this to the 1.5.0 milestone Nov 12, 2024
@ivanperez-keera ivanperez-keera self-assigned this Nov 12, 2024
@ivanperez-keera ivanperez-keera added CR:Status:Implementation Admin only: Change request that is currently being implemented and removed CR:Status:Scheduled Admin only: Change requested scheduled labels Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…ion. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

This commit modifies the ogma-core cfs command to use mustache to
generate the cFS monitoring application template using variable
expansion.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…n. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced the ability to use mustache to expand
variables in a template. This commit modifies the cfs command to accept
an additional argument that points to a user-provided directory with a
custom template.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…irectory to cFS app command. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced into ogma-core the ability to use a custom
provided template and expand variables using mustache.

This commit exposes that new parameter to the user in the CLI.

[ci skip]
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…ation. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

Prior commits have expanded the command to allow for customization of
the template using a user-provided directory and expanding variables
in the template using mustache.

This commit documents the new feature in the README.

[ci skip]
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…ion. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

This commit modifies the ogma-core cfs command to use mustache to
generate the cFS monitoring application template using variable
expansion.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…n. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced the ability to use mustache to expand
variables in a template. This commit modifies the cfs command to accept
an additional argument that points to a user-provided directory with a
custom template.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…irectory to cFS app command. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced into ogma-core the ability to use a custom
provided template and expand variables using mustache.

This commit exposes that new parameter to the user in the CLI.

[ci skip]
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…ation. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

Prior commits have expanded the command to allow for customization of
the template using a user-provided directory and expanding variables
in the template using mustache.

This commit documents the new feature in the README.

[ci skip]
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…ion. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

This commit modifies the ogma-core cfs command to use mustache to
generate the cFS monitoring application template using variable
expansion.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…n. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced the ability to use mustache to expand
variables in a template. This commit modifies the cfs command to accept
an additional argument that points to a user-provided directory with a
custom template.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…irectory to cFS app command. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced into ogma-core the ability to use a custom
provided template and expand variables using mustache.

This commit exposes that new parameter to the user in the CLI.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
…ation. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

Prior commits have expanded the command to allow for customization of
the template using a user-provided directory and expanding variables
in the template using mustache.

This commit documents the new feature in the README.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 12, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 13, 2024
…ion. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

This commit modifies the ogma-core cfs command to use mustache to
generate the cFS monitoring application template using variable
expansion.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 13, 2024
…n. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced the ability to use mustache to expand
variables in a template. This commit modifies the cfs command to accept
an additional argument that points to a user-provided directory with a
custom template.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 13, 2024
…irectory to cFS app command. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced into ogma-core the ability to use a custom
provided template and expand variables using mustache.

This commit exposes that new parameter to the user in the CLI.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 13, 2024
…ation. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

Prior commits have expanded the command to allow for customization of
the template using a user-provided directory and expanding variables
in the template using mustache.

This commit documents the new feature in the README.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 13, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 13, 2024
@ivanperez-keera
Copy link
Member Author

Implementor: Solution implemented, review requested.

@ivanperez-keera ivanperez-keera added CR:Status:Verification Admin only: Change request that is currently being verified and removed CR:Status:Implementation Admin only: Change request that is currently being implemented labels Nov 14, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 14, 2024
…ion. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

This commit modifies the ogma-core cfs command to use mustache to
generate the cFS monitoring application template using variable
expansion.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 14, 2024
…n. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced the ability to use mustache to expand
variables in a template. This commit modifies the cfs command to accept
an additional argument that points to a user-provided directory with a
custom template.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 14, 2024
…irectory to cFS app command. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced into ogma-core the ability to use a custom
provided template and expand variables using mustache.

This commit exposes that new parameter to the user in the CLI.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 14, 2024
…ation. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

Prior commits have expanded the command to allow for customization of
the template using a user-provided directory and expanding variables
in the template using mustache.

This commit documents the new feature in the README.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 14, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 14, 2024
@ivanperez-keera
Copy link
Member Author

ivanperez-keera commented Nov 14, 2024

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
    • The solution proposed produces the expected result. Details:
      The following dockerfile generates the cFS application using the default template and using a copy and the default template and checks that both are the same. It then adds a file to the copy of the template and checks that the file is copied to the target directory when the custom template is used, after which it prints the message "Success".
      FROM ubuntu:trusty
      
      ENV DEBIAN_FRONTEND=noninteractive
      
      RUN apt-get update
      
      RUN apt-get install --yes software-properties-common
      RUN add-apt-repository ppa:hvr/ghc
      RUN apt-get update
      
      RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4
      RUN apt-get install --yes libz-dev
      
      ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH
      
      RUN cabal update
      RUN cabal v1-sandbox init
      RUN cabal v1-install alex happy
      RUN apt-get install --yes git
      
      CMD git clone $REPO && \
          cd $NAME && \
          git checkout $COMMIT && \
          cd .. && \
          cabal v1-install $NAME/$PAT**/ --constraint="aeson>=2.0.3.0"                              && \
          cp -r $NAME/ogma-core/templates/copilot-cfs custom-template-cfs                           && \
          find custom-template-cfs -iname '.gitignore' -delete                                      && \
          ./.cabal-sandbox/bin/ogma cfs --variable-file $NAME/ogma-cli/examples/cfs-variables --variable-db $NAME/ogma-cli/examples/cfs-variable-db --app-target-dir original                                   && \
          ./.cabal-sandbox/bin/ogma cfs --variable-file $NAME/ogma-cli/examples/cfs-variables --variable-db $NAME/ogma-cli/examples/cfs-variable-db --app-target-dir new --app-template-dir custom-template-cfs && \
          diff -rq original new                                                                     && \
          rm -rf new                                                                                && \
          echo "Success" >> custom-template-cfs/test                                                && \
          ./.cabal-sandbox/bin/ogma cfs --variable-file $NAME/ogma-cli/examples/cfs-variables --variable-db $NAME/ogma-cli/examples/cfs-variable-db --app-target-dir new --app-template-dir custom-template-cfs && \
          cat new/test
      Command (substitute variables based on new path after merge):
      $ docker run -e "REPO=https://github.com/ivanperez-keera/ogma" -e "NAME=ogma" -e "PAT=ogma"  -e "COMMIT=a1a96818e5a60420c233a3a00d4117e95dfbb1b0" -it ogma-verify-157
      
  • Implementation is documented. Details:
    The new code has comments.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No updates needed.
  • Required version bumps are evaluated. Details:
    No bump needed. New feature is backwards compatible.

@ivanperez-keera
Copy link
Member Author

Change Manager: Implementation ready to be merged.

@ivanperez-keera ivanperez-keera added CR:Status:Closed Admin only: Change request that has been completed and removed CR:Status:Verification Admin only: Change request that is currently being verified labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Feature Admin only: Change request pertaining to new features requested
Projects
None yet
Development

No branches or pull requests

1 participant