Skip to content

Conversation

@benPearce1
Copy link
Contributor

@benPearce1 benPearce1 commented Apr 30, 2025

feat: runbook snapshot publish
fix: runbook snapshot list now shows which snapshot is published

replaces #343

fixes #110

runbook snapshot list

Now specifies which snapshot is the current published snapshot

ID                    NAME              PUBLISHED  ASSEMBLED
RunbookSnapshots-381  Snapshot 4E6TUYP             Wed, 30 Apr 2025 06:17:16 +0000
RunbookSnapshots-379  Snapshot K8MM6GD             Wed, 30 Apr 2025 01:20:53 +0000
RunbookSnapshots-378  Snapshot 2BRT8ZF             Wed, 30 Apr 2025 01:19:53 +0000
RunbookSnapshots-377  Snapshot 8EKKDY9             Wed, 30 Apr 2025 01:11:29 +0000
RunbookSnapshots-376  Snapshot 3JDLKHP             Wed, 30 Apr 2025 01:11:13 +0000
RunbookSnapshots-375  Snapshot BRYFKMB             Wed, 30 Apr 2025 01:10:10 +0000
RunbookSnapshots-374  Snapshot 40C9ENM             Wed, 30 Apr 2025 01:06:20 +0000
RunbookSnapshots-373  Snapshot XBNF77G             Wed, 30 Apr 2025 01:05:56 +0000
RunbookSnapshots-372  Snapshot SR0YKVH             Wed, 30 Apr 2025 01:00:07 +0000
RunbookSnapshots-371  Snapshot 0UVWXRJ             Wed, 30 Apr 2025 00:53:48 +0000
RunbookSnapshots-370  Snapshot SB5J0SH             Wed, 30 Apr 2025 00:30:10 +0000
RunbookSnapshots-369  Snapshot 6NL4C58             Wed, 30 Apr 2025 00:09:17 +0000
RunbookSnapshots-365  Snapshot 7Z0QBSZ             Tue, 29 Apr 2025 05:56:40 +0000
RunbookSnapshots-364  Snapshot HQBBGBY  Yes        Tue, 29 Apr 2025 05:44:52 +0000
RunbookSnapshots-363  Snapshot NEY7G68             Tue, 29 Apr 2025 05:44:09 +0000
RunbookSnapshots-362  Snapshot 0H8VQRR             Tue, 29 Apr 2025 05:43:06 +0000
  {
    "Id": "RunbookSnapshots-365",
    "Name": "Snapshot 7Z0QBSZ",
    "Assembled": "2025-04-29T05:56:40.729Z",
    "Published": false
  },
  {
    "Id": "RunbookSnapshots-364",
    "Name": "Snapshot HQBBGBY",
    "Assembled": "2025-04-29T05:44:52.66Z",
    "Published": true
  },
  {
    "Id": "RunbookSnapshots-363",
    "Name": "Snapshot NEY7G68",
    "Assembled": "2025-04-29T05:44:09.321Z",
    "Published": false
  },

runbook snapshot publish

octopus runbook snapshot publish -s Default -p runbooks -r "runbook 3" --snapshot "Snapshot 2BRT8ZF"

Runbook snapshot Snapshot 2BRT8ZF has been published
View this snapshot on Octopus Deploy: http://localhost:8066/app#/Spaces-1/projects/Projects-22/operations/runbooks/Runbooks-161/snapshots/RunbookSnapshots-378

Automation Command: octopus runbook snapshot publish --project 'runbooks' --runbook 'runbook 3' --snapshot 'Snapshot 2BRT8ZF' --no-prompt

octopus runbook snapshot publish -s Default -p runbooks -r "runbook 3"

prompts for snapshot, with assembled date shown
image

runbook snapshot create

octopus runbook snapshot create

prompts for space, project and runbook
Default snapshot name comes from the template

? You have not specified a Space. Please select one: Default
? Select the project containing the runbook you wish to snapshot: runbooks
? Select the runbook you wish to to snapshot: runbook 3
? Snapshot name [? for help] (Snapshot NF2M098)

Git references, and package are prompted in the same manner as releases and runbook run
Supports publishing at creation time too

? You have not specified a Space. Please select one: Default
? Select the project containing the runbook you wish to snapshot: runbooks
? Select the runbook you wish to to snapshot: runbook 3
? Snapshot name Snapshot NF2M098
PACKAGE     VERSION  STEP NAME/PACKAGE REFERENCE
TestWebApp  1.0.2    Run a Script with package ref/
? Package override string (y to accept, u to undo, ? for help): y
STEP NAME              GIT RESOURCE  GIT REF
Run a Script from git  <primary>     main
? Git resource git reference override string (y to accept, u to undo, r to reset, ? for help): y
X Sorry, your reply was invalid: "t" is not a valid answer, please try again.
? Would you like to publish this snapshot immediately? Yes

Successfully created and published runbook snapshot 'Snapshot NF2M098' (RunbookSnapshots-382) for runbook 'runbook 3'
View this snapshot on Octopus Deploy: http://localhost:8066/app#/Spaces-1/projects/Projects-22/operations/runbooks/Runbooks-161/snapshots/RunbookSnapshots-382

image

Create but with no snapshot name

octopus runbook snapshot create -s Default -p runbooks -r "runbook 3" --no-prompt

Successfully created runbook snapshot 'Snapshot N28WZ7C' (RunbookSnapshots-383) for runbook 'runbook 3'
View this snapshot on Octopus Deploy: http://localhost:8066/app#/Spaces-1/projects/Projects-22/operations/runbooks/Runbooks-161/snapshots/RunbookSnapshots-383

support for additional output formats:

octopus runbook snapshot create -s Default -p runbooks -r "runbook 3" --no-prompt --output-format json
{
  "Id": "RunbookSnapshots-401",
  "Name": "Snapshot M6CXSCV",
  "Assembled": "2025-05-01T05:56:29.424Z",
  "Published": false
}

octopus runbook snapshot create -s Default -p runbooks -r "runbook 3" --no-prompt --output-format basic
RunbookSnapshots-387

Copy link
Contributor

@hnrkndrssn hnrkndrssn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a question around possible clash in command aliases that might cause some troubles.

@benPearce1 benPearce1 requested a review from hnrkndrssn May 2, 2025 01:04
@benPearce1 benPearce1 merged commit d7b7330 into main May 2, 2025
4 checks passed
@benPearce1 benPearce1 deleted the bp/runbook-snapshot branch May 2, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add commands for Runbook operations, specifically 'create-runbook'

2 participants