Uploaded image for project: 'Puppet Development Kit'
  1. Puppet Development Kit
  2. PDK-949

PDK .sync.yml allow for removing template values

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PDK 1.4.1, PDK 1.5.0
    • Fix Version/s: PDK 1.6.0
    • Component/s: None
    • Template:
    • Acceptance Criteria:
      Hide

      .sync.yml should be able to override arrays and hashes or provide knockout abilities. 

      Show
      .sync.yml should be able to override arrays and hashes or provide knockout abilities. 
    • Team:
      Puppet Developer Experience
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Hide
      This implements a new feature for PDK that allows users to remove default template configuration values by using the "knockout_prefix" of `---` in their `.sync.yml` file.

      An example of doing this would be:

      In default configs for pdk-templates, we have this defined for `.travis.yml`:

      ```
      .travis.yml:
        bundler_args: --without system_tests
      ```

      And I want to remove that value and have bundler install everything. I would put this in my `.sync.yml`.

      ```
      ---
      .travis.yml:
        bundle_args: -----without system_tests
      ```

      By prepending the `knockout_prefix` of `---` to the value you want to remove, PDK will remove that value when we render the `.travis.yml` file when PDK update or convert is run.

      ```
      /* Report generated by PDK at 2018-06-14 14:40:48 -0700 */


      --- .travis.yml 2018-06-14 10:50:49.429639601 -0700
      +++ .travis.yml.pdknew 2018-06-14 14:40:48.632016000 -0700
      @@ -11,7 +11,7 @@
         - bundle -v
       script:
         - 'bundle exec rake $CHECK'
      -bundler_args: --without system_tests
      +bundler_args:
       rvm:
         - 2.4.1
       env:
      ```
      Show
      This implements a new feature for PDK that allows users to remove default template configuration values by using the "knockout_prefix" of `---` in their `.sync.yml` file. An example of doing this would be: In default configs for pdk-templates, we have this defined for `.travis.yml`: ``` .travis.yml:   bundler_args: --without system_tests ``` And I want to remove that value and have bundler install everything. I would put this in my `.sync.yml`. ``` --- .travis.yml:   bundle_args: -----without system_tests ``` By prepending the `knockout_prefix` of `---` to the value you want to remove, PDK will remove that value when we render the `.travis.yml` file when PDK update or convert is run. ``` /* Report generated by PDK at 2018-06-14 14:40:48 -0700 */ --- .travis.yml 2018-06-14 10:50:49.429639601 -0700 +++ .travis.yml.pdknew 2018-06-14 14:40:48.632016000 -0700 @@ -11,7 +11,7 @@    - bundle -v  script:    - 'bundle exec rake $CHECK' -bundler_args: --without system_tests +bundler_args:  rvm:    - 2.4.1  env: ```
    • QA Risk Assessment:
      Needs Assessment

      Description

      Currently the config_defaults.yml and the .sync.yml options are deep_merged into a single configuration which will allow for adding values to a template. While it does allow for overriding some values, it would be nice to be able to knockout a value or a hash from the config_defaults.yml with an option in the .sync.yml.

      As a developer I would like to be able to override some values of the pdk template without having to maintain my own template.

      For example, I would like to use env: CHECK=parallel_spec instead of the env: CHECK=spec that is defined in the config_defaults.yml for the .travis.yml. If I just add {{ - env: CHECK=parallel_spec}} to my .sync.yml the resulting .travis.yml will have both the spec and parallel_spec tests.

      Another example is that I would like to override the entire appveyor.yml => martix hash to substitute my own tests.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                jarret.lavallee Jarret Lavallee
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: