auth0 / wt-cli

Webtask CLI - all you need is code
https://webtask.io
MIT License
322 stars 72 forks source link

Updating an Existing CRON Schedule Removes Secrets #155

Closed NotMyself closed 7 years ago

NotMyself commented 7 years ago

A customer reported issue: https://auth0.zendesk.com/agent/tickets/27553

Steps to Reproduce

Via CLI

  1. wt cron schedule "1 * * * *" foo.js --secret FOO=BAR
  2. wt inspect foo --decrypt
    • Note: secrets are stored
  3. wt update foo foo.js
  4. wt inspect foo --decrypt
    • Note: secrets are maintained
  5. wt cron schedule "* * * * *" foo.js
  6. wt inspect foo --decrypt

Result

The schedule has changed but the secrets have been removed.

Expected Result

Secrets should be maintained for CRON schedule updates.

Comments

There appears to be no way to simply update the CRON schedule via the CLI. The CRON command appears to be destructive for an existing webtask. It will clear secret, meta ect values if not supplied every time.

The editor appears to hide this from you by always supplying these values. The CLI does not which is confusing for users.

tjanczuk commented 7 years ago

I think the problem is in the perception around wt cron schedule command. This command is not an update, it is a complete re-create of the CRON job. This means secrets must be re-specified.

The wt update only updates code as far as I know.

NotMyself commented 7 years ago

Agreed, I think this is an indication we need a wt cron update command.

tjanczuk commented 7 years ago

A cheap improvement could be to introduce wt cron create and deprecate wt cron schedule

NotMyself commented 7 years ago

It seems weird that there is no easy way to update a cron schedule. It is pretty easy to typo 1 * * * * when what you really mean is * * * * * and there is no simple way to fix it without destroying your webtask.

ggoodman commented 7 years ago

What about wt cron update [--schedule new_schedule] [--state new_state] sub-command?

NotMyself commented 7 years ago

I think the pair of wt cron create & wt cron update are clear in their intention and might reduce confusion.

ggoodman commented 7 years ago

If we take the approach proposed by @tjanczuk here: https://github.com/auth0/wt-cli/issues/155#issuecomment-331230067, I would also change wt cron create's signature to have the schedule as an option instead of a positional argument.

NotMyself commented 7 years ago

Verified fixed in 7.0.1