Skip to content

feat: add 'template update' command to edit an existing template (repo/playbook/inventory/env) #116

Description

@Moep90

Summary

Add a semctl template update (or edit) command to mutate an existing template's fields — repository, playbook, inventory, environment, name, arguments, etc. — without recreating it.

Motivation

semctl template currently exposes only clone, delete, get, list, tasks. There is no way to change an existing template's configuration from the CLI. Today the only options are the Semaphore web UI or a raw PUT /api/project/{id}/templates/{tid} curl call.

Real case that triggered this: a template ("003 [RASPI] Install Tailscale") was pointed at the wrong repository, so every run failed with the playbook ... could not be found. The fix is a one-field change (repository_id), but there is no semctl command for it — had to fall back to the REST API.

Proposed behavior

semctl template update <id|name> \
  --repository <id|name> \
  --playbook <path> \
  --inventory <id|name> \
  --environment <id|name> \
  --name <string> \
  --arguments <json>
  • Only the flags passed are changed; everything else preserved (read-modify-write against the existing template so unset fields are not wiped).
  • Accept either numeric IDs or resolvable names for repository/inventory/environment (consistent with other subcommands).
  • Honor --json / -o output like get.
  • Underlying call is PUT /api/project/{project}/templates/{id} with the full template body.

Notes

Prior template bugs (#43 partial-field get, #65/#66 clone) show the template body round-trip already needs care — please confirm a partial update does not blank vaults, view_id, environment_ids, or survey vars. A read-modify-write (GET then PUT) is the safe implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions