[PDK-771] pdk update CLI Created: 2018/01/09  Updated: 2018/02/28  Resolved: 2018/02/09

Status: Closed
Project: Puppet Development Kit
Component/s: None
Affects Version/s: None
Fix Version/s: PDK 1.4.1

Type: New Feature Priority: Normal
Reporter: Tim Sharpe Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: resolved-issue-added
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: PDK update
Release Notes: New Feature
Release Notes Summary: This is a new feature that provides the 'pdk update' command. This feature is meant for PDK compatible modules to keep their modules up to date with the module template that was used to generate or convert their module.
QA Risk Assessment: Needs Assessment


For the most part, this can be a copy of the convert CLI, with "convert" changed to "update" in the output.

Mock up of help:

$ pdk update --help
    update - Update a module that has been created by or converted for use by the PDK.
    pdk update [options]
       --force                     Update the module automatically, with no
       --noop                      Do not update the module, just output
                                   what would be done.
    -d --debug                     Enable debug output.
    -f --format=<value>            Specify desired output format. Valid
                                   formats are 'junit', 'text'. You may also
                                   specify a file to which the formatted
                                   output is sent, for example:
                                   '--format=junit:report.xml'. This option
                                   may be specified multiple times if each
                                   option specifies a distinct target file.
    -h --help                      Show help for this command.
       --version                   Show version of pdk.

Very similar to the convert help but with the --template-url and --skip-intervew options removed. pdk update should only update the module to a newer version of the template used to create or convert it. Changing templates should be done with pdk convert.

A basic mock up of what it might look like to use:

$ cd my-module
$ pdk update
pdk (INFO): Updating my-module using the default template, from 1.3.1 to 1.4.0.
------------Files to be added-----------
----------Files to be modified----------
You can find a report of the differences in update_report.txt.
Do you want to continue and make these changes to your module? (Y/n)

Again, very similar to the convert output with only a few changes:

  • Displaying the template information (path/URL, old version, new version). I've opted to niceify the output in the above example where we're using the default template and moving between tagged versions. The alternative output where the module is using a custom template would be something like "Updating my-module using the template at https://github.com/my/custom-template, from master@123abcde to master@4567defa"
  • Writing the report of detailed changes to update_report.txt instead of convert_report.txt
  • Not displaying the warning about this being a destructive action. This is an opinion based change as moving between template versions should never be destructive.

cc Rick Monro

Comment by Rick Monro [ 2018/01/10 ]

The only suggestion I have is on the line:
pdk (INFO): Updating my-module using the default template, from 1.3.1 to 1.4.0.

Wondering if this should be:
pdk (INFO): Inspecting my-module using the default template, from 1.3.1 to 1.4.0.
...such that the user doesn't feel like changes are being applied automatically..?

Comment by Bryan Jen [ 2018/01/10 ]

Currently in pdk convert, the template is cloned, fetch, and reset head to the desired ref, this will always show up in the metadata.json with a branch of master. This behavior will need to be modified to save the template-ref and written into the metadata.json for future updates.

Generated at Thu Oct 17 15:33:55 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.