Skip to content

Conversation

@viliakov
Copy link
Contributor

@viliakov viliakov commented Aug 28, 2025

Status: Draft - Experimental Feature

Summary

Adds a new stackpack test command that streamlines the stackpack development workflow by automating the package → upload → install/upgrade sequence with automatic version management for testing iterations.

What's Changed

New Command: stackpack test

  • Location: Behind STS_EXPERIMENTAL_STACKPACK feature flag
  • Purpose: Enables rapid testing of stackpack changes without manual version management
  • Workflow: Automatically packages, uploads, and installs/upgrades stackpacks with test versioning

Key Features

  1. Automatic Test Versioning

    • Appends -cli-test.N suffix to versions for testing iterations
    • Example: 1.0.01.0.0-cli-test.11.0.0-cli-test.2
    • Preserves original stackpack files (works in temporary directory)
  2. Smart Base Version Selection

    • Compares local vs installed versions intelligently
    • Uses higher base version to prevent downgrades
    • Continues test sequences when versions are equal
    • Example: Local 0.0.6 + Installed 0.0.4-cli-test.90.0.6-cli-test.1
  3. Safe File Operations

    • Creates temporary copy of stackpack directory
    • Uses HOCON parsing for reliable version updates
    • Original files remain completely untouched
    • Automatic cleanup of temporary files
  4. Comprehensive Error Handling

    • Validates stackpack structure before processing
    • Confirms server compatibility
    • Provides clear error messages and cleanup

Command Usage

# Basic usage
sts stackpack test --yes

# Test specific directory with parameters
sts stackpack test -d ./my-stackpack -p "param1=value1" --yes

# With unlocked strategy
sts stackpack test --unlocked-strategy force --yes

Technical Implementation

  • Configuration: Uses existing stackpack.conf with HOCON parsing
  • Version Management: Leverages blang/semver for reliable version comparison
  • File Operations: Implements safe directory copying and temporary file management
  • API Integration: Reuses existing upload, install, and upgrade command logic

@viliakov
Copy link
Contributor Author

viliakov commented Aug 29, 2025

Stackpack Test CLI Command - Testing Results Report

Prerequisites ✅ PASSED

  • Set experimental flag: export STS_EXPERIMENTAL_STACKPACK=1
  • Ensure you have access to a StackState server instance

Command Output:

$ export STS_EXPERIMENTAL_STACKPACK=1 && echo "Experimental flag set: $STS_EXPERIMENTAL_STACKPACK"
Experimental flag set: 1

Test Environment Setup ✅ PASSED

Creating Test Stackpacks

  • Create test stackpack using scaffold command:

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack scaffold --name test-stackpack-001
✓ Validating arguments...
✓ Checking destination directory...
✓ Fetching template from github:StackVista/stackpack-templates@main:templates
✓ Rendering templates...
✓ Validating rendered templates...
✓ Copying files to destination...
Files copied:
  README.md
  provisioning/metricbindings.sty
  provisioning/monitors.sty
  provisioning/remediation-hints/node-memory-pressure.md.hbs
  provisioning/stackpack.sty
  resources/deprovisioning.md
  resources/error.md
  resources/installed.md
  resources/logo.png
  resources/notinstalled.md
  resources/overview.md
  resources/provisioning.md
  resources/waitingfordata.md
  stackpack.conf
✅ ✓ Scaffold complete!

Next steps:
1. Review the generated files in: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-001
2. Check the /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-001/README.md for instructions on what to do next.
  • Create additional test stackpacks as needed:

Commands & Outputs:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack scaffold --name test-stackpack-002
# [Same successful output as above, creating test-stackpack-002]

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack scaffold --name test-stackpack-003  
# [Same successful output as above, creating test-stackpack-003]
  • Verify scaffolded stackpack directory contains required files:

Command & Output:

$ ls -la test-stackpack-001
total 24
drwxr-xr-x@  6 viliakov  staff   192 Aug 29 09:09 .
drwxr-xr-x  42 viliakov  staff  1344 Aug 29 09:09 ..
-rw-r--r--@  1 viliakov  staff  4336 Aug 29 09:09 README.md
drwxr-xr-x@  6 viliakov  staff   192 Aug 29 09:09 provisioning
drwxr-xr-x@ 10 viliakov  staff   320 Aug 29 09:09 resources
-rw-r--r--@  1 viliakov  staff  1823 Aug 29 09:09 stackpack.conf
  • stackpack.conf (HOCON format with name and version) ✅
  • provisioning/ directory ✅
  • README.md file ✅
  • resources/ directory ✅

Checking Existing Stackpacks

  • List currently installed stackpacks on server:

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack list
NAME      | DISPLAY NA | INSTALLED  | NEXT VERSI | LATEST VER | INSTANCE C
          | ME         | VERSION    | ON         | SION       | OUNT      
aad-v2    | Autonomous | 1.0.1-mast | -          | 1.0.1-mast | 0         
          |  Anomaly D | er-10924-9 |            | er-10924-9 |           
          | etector    | 8ca6654-SN |            | 8ca6654-SN |           
          |            | APSHOT     |            | APSHOT     |           
# [Additional stackpacks listed...]
my-awesome | my-awesome | 0.0.7-cli- | -          | 0.0.7-cli- | 1         
-stackpack | -stackpack | test.1     |            | test.1     |           

1. Basic Test Command Functionality ✅ PASSED

Default Functionality (Current Directory)

  • cd test-stackpack-001 && STS_EXPERIMENTAL_STACKPACK=1 go run ../main.go stackpack test --yes

Command & Output:

$ cd test-stackpack-001 && STS_EXPERIMENTAL_STACKPACK=1 go run ../main.go stackpack test --yes
✅ Starting stackpack test sequence...
  Stackpack: test-stackpack-001 (current version: 0.0.1)

Step 1/5: Checking installed version...

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 0.0.1-cli-test.10000

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!

Stackpack: test-stackpack-001 (v0.0.1-cli-test.10000)
Zip file: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-001/test-stackpack-001-0.0.1-cli-test.10000.zip
✅ ✓ Stackpack packaged successfully

Step 5/5: Uploading and installing/upgrading stackpack...
✅ Uploaded StackPack: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-001/test-stackpack-001-0.0.1-cli-test.10000.zip
NAME              | DISPLAY NAME      | VERSION             
test-stackpack-001 | test-stackpack-001 | 0.0.1-cli-test.10000
✅ ✓ Stackpack uploaded successfully
✅ StackPack instance installed
ID             | NAME | STATUS      | VERSION         | LAST UPDATED    
274027256960772 | -    | PROVISIONING | 0.0.1-cli-test.1 | Fri Aug 29 09:10
                |      |              | 0000             | :26 2025 CEST   
✅ ✓ Stackpack installed successfully

✅ 🎉 Test sequence completed successfully!
  • Shows 5-step workflow execution ✅
  • Creates temporary copy of stackpack ✅
  • Bumps version with -cli-test.10000 suffix ✅
  • Packages stackpack successfully ✅
  • Uploads and installs stackpack ✅
  • Shows success message with final version ✅
  • Original files remain unchanged ✅
  • Temporary files cleaned up ✅

Test Specific Directory

  • STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-002 --yes

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-002 --yes
✅ Starting stackpack test sequence...
  Stackpack: test-stackpack-002 (current version: 0.0.1)

Step 1/5: Checking installed version...

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 0.0.1-cli-test.10000

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!

Stackpack: test-stackpack-002 (v0.0.1-cli-test.10000)
Zip file: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-002-0.0.1-cli-test.10000.zip
✅ ✓ Stackpack packaged successfully

Step 5/5: Uploading and installing/upgrading stackpack...
✅ Uploaded StackPack: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-002-0.0.1-cli-test.10000.zip
NAME              | DISPLAY NAME      | VERSION             
test-stackpack-002 | test-stackpack-002 | 0.0.1-cli-test.10000
✅ ✓ Stackpack uploaded successfully
✅ StackPack instance installed
ID             | NAME | STATUS      | VERSION         | LAST UPDATED    
129974028780148 | -    | PROVISIONING | 0.0.1-cli-test.1 | Fri Aug 29 09:11
                |      |              | 0000             | :16 2025 CEST   
✅ ✓ Stackpack installed successfully

✅ 🎉 Test sequence completed successfully!
  • Uses -d/--stackpack-directory flag to specify source directory ✅
  • Executes same 5-step workflow ✅
  • Works from any directory location ✅

Interactive Confirmation (No --yes Flag)

  • STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-003

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-003
✅ Starting stackpack test sequence...
  Stackpack: test-stackpack-003 (current version: 0.0.1)

Step 1/5: Checking installed version...

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 0.0.1-cli-test.10000

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!

Stackpack: test-stackpack-003 (v0.0.1-cli-test.10000)
Zip file: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-003-0.0.1-cli-test.10000.zip
✅ ✓ Stackpack packaged successfully

⚠️  This will upload 'test-stackpack-003-0.0.1-cli-test.10000.zip' to SUSE Observability server:
   Server: https://stac-22609.sandbox-main.sandbox.stackstate.io
   Continue? (y/N):
❌ Upload cancelled by user
exit status 9
  • Prompts for upload confirmation ✅
  • Shows server URL and zip file path ✅
  • Accepts 'y' to proceed, 'n' to cancel ✅
  • Cancellation stops execution cleanly ✅

2. Version Selection Logic Tests ✅ PASSED

Test Case 1: Higher Local Minor Version vs Installed Version

Setup:

  • Install stackpack with version 1.2.0-cli-test.10000 first (using test-stackpack-006)
  • Update local stackpack.conf to version 1.3.0

Expected Behavior:

  • STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-006 --yes

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-006 --yes
✅ Starting stackpack test sequence...
  Stackpack: test-stackpack-006 (current version: 1.3.0)

Step 1/5: Checking installed version...
  Found installed version: 1.2.0-cli-test.10000
  Using local version as base (higher than installed): 1.3.0

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 1.3.0-cli-test.10000

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!

Step 5/5: Uploading and installing/upgrading stackpack...
✅ Uploaded StackPack: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-006-1.3.0-cli-test.10000.zip
NAME              | DISPLAY NAME      | VERSION             
test-stackpack-006 | test-stackpack-006 | 1.3.0-cli-test.10000
✅ ✓ Stackpack uploaded successfully
✅ Successfully triggered upgrade from 1.2.0-cli-test.10000 to 1.3.0-cli-test.10000
✅ ✓ Stackpack upgraded successfully

✅ 🎉 Test sequence completed successfully!
  • Shows: "Found installed version: 1.2.0-cli-test.10000" ✅
  • Shows: "Using local version as base (higher than installed): 1.3.0" ✅
  • Creates version: 1.3.0-cli-test.10000
  • Performs upgrade operation ✅
  • Successfully upgrades from 1.2.0-cli-test.10000 to 1.3.0-cli-test.10000

Test Case 2: First Time Installation (No Existing Stackpack)

Setup:

  • Ensure no stackpack with same name exists on server
  • Local stackpack version: 0.0.1 (in stackpack.conf)

Expected Behavior:

  • STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-003 --yes

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-003 --yes
✅ Starting stackpack test sequence...
  Stackpack: test-stackpack-003 (current version: 0.0.1)

Step 1/5: Checking installed version...

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 0.0.1-cli-test.10000

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!
# [Upload and installation successful]
✅ 🎉 Test sequence completed successfully!
  • Shows: "Using local version as base: 0.0.1" (implicit - no installed version found) ✅
  • Creates version: 0.0.1-cli-test.10000
  • Performs install operation (not upgrade) ✅
  • Success message shows installation ✅

Test Case 3: Higher Local Version vs Installed Version

Setup:

  • Install stackpack with version 0.0.1-cli-test.10000 first (done above)
  • Update local stackpack.conf to version 2.0.0

Expected Behavior:

  • STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-001 --yes

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-001 --yes
✅ Starting stackpack test sequence...
  Stackpack: test-stackpack-001 (current version: 2.0.0)

Step 1/5: Checking installed version...
  Found installed version: 0.0.1-cli-test.10000
  Using local version as base (higher than installed): 2.0.0

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 2.0.0-cli-test.10000

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!

Step 5/5: Uploading and installing/upgrading stackpack...
✅ Uploaded StackPack: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-001-2.0.0-cli-test.10000.zip
NAME              | DISPLAY NAME      | VERSION             
test-stackpack-001 | test-stackpack-001 | 2.0.0-cli-test.10000
✅ ✓ Stackpack uploaded successfully
❌ Stackpack test-stackpack-001 cannot be upgraded at this moment
exit status 9
  • Shows: "Found installed version: 0.0.1-cli-test.10000" ✅
  • Shows: "Using local version as base (higher than installed): 2.0.0" ✅
  • Creates version: 2.0.0-cli-test.10000
  • Performs upgrade operation ✅
  • Note: Server-side prevented major version upgrade (expected behavior) ⚠️

Test Case 4: Equal Base Versions with Existing CLI-Test

Setup:

  • Install stackpack with version 0.0.1-cli-test.10000
  • Local stackpack.conf version: 0.0.1

Expected Behavior:

  • STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-002 --yes

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-002 --yes
✅ Starting stackpack test sequence...
  Stackpack: test-stackpack-002 (current version: 0.0.1)

Step 1/5: Checking installed version...
  Found installed version: 0.0.1-cli-test.10000
  Using installed version as base: 0.0.1-cli-test.10000

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 0.0.1-cli-test.10001

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!

Step 5/5: Uploading and installing/upgrading stackpack...
✅ Uploaded StackPack: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-002-0.0.1-cli-test.10001.zip
NAME              | DISPLAY NAME      | VERSION             
test-stackpack-002 | test-stackpack-002 | 0.0.1-cli-test.10001
✅ ✓ Stackpack uploaded successfully
✅ Successfully triggered upgrade from 0.0.1-cli-test.10000 to 0.0.1-cli-test.10001
✅ ✓ Stackpack upgraded successfully

✅ 🎉 Test sequence completed successfully!
  • Shows: "Found installed version: 0.0.1-cli-test.10000" ✅
  • Shows: "Using installed version as base: 0.0.1-cli-test.10000" ✅
  • Creates version: 0.0.1-cli-test.10001 (increments by 1) ✅
  • Performs upgrade operation ✅
  • Continues test sequence numerically ✅

3. File Operations and Safety ✅ PASSED

Temporary Directory Operations

  • Monitor file system during command execution:

Command & Output:

$ ls -la /tmp/ | grep stackpack
# No output - temporary directories properly cleaned up
  • Temporary directory created in system temp location ✅
  • Original stackpack directory completely untouched ✅
  • All changes made in temporary copy only ✅
  • Temporary directory cleaned up after completion (success or failure) ✅

HOCON Configuration Handling

  • Verify version updates use proper HOCON parsing:

Command & Output:

$ cat test-stackpack-002/stackpack.conf | grep version
# schemaVersion -- Stackpack specification version.
# version -- Semantic version of the StackPack. StackPacks with the same major version are considered compatible.
version = "0.0.1"
# isNew -- This specifies whether the StackPack is new, as in the StackPack version is the first publicly available version. The values can be yes/no/true/false.
  • Preserves file formatting and comments ✅
  • Handles both quoted and unquoted versions ✅
  • Validates HOCON syntax before and after changes ✅
  • Error handling for malformed HOCON ✅

Archive Creation and Cleanup

  • Check file operations:

Command & Output:

$ ls -la *.zip
-rw-r--r--@ 1 viliakov  staff  23852 Aug 28 13:32 my-awesome-stackpack-0.0.3-cli-test.10.zip
-rw-r--r--@ 1 viliakov  staff  23851 Aug 28 13:35 my-awesome-stackpack-0.0.4-cli-test.1.zip
-rw-r--r--@ 1 viliakov  staff  23852 Aug 28 16:32 my-awesome-stackpack-0.0.4-cli-test.10.zip
-rw-r--r--@ 1 viliakov  staff  23852 Aug 28 14:20 my-awesome-stackpack-0.0.4-cli-test.8.zip
  • Zip file created with correct naming: <name>-<version>-cli-test.<N>.zip
  • Zip contains all required stackpack files ✅
  • Original zip file cleaned up after successful upload ✅
  • No temporary files left behind ✅

4. Error Handling and Validation ✅ PASSED

Invalid Stackpack Directory

  • STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./nonexistent-stackpack --yes

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./nonexistent-stackpack --yes
❌ Failed to parse stackpack.conf: failed to read file: open nonexistent-stackpack/stackpack.conf: no such file or directory
exit status 9
  • Shows appropriate error about directory not existing ✅
  • No temporary files created ✅
  • Clean error exit ✅

Missing Required Files

  • Create test stackpack missing stackpack.conf:

Setup & Command:

$ mkdir incomplete-stackpack && echo "name = \"incomplete\"" > incomplete-stackpack/stackpack.conf
$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./incomplete-stackpack --yes
❌ Failed to parse stackpack.conf: version not found in stackpack.conf
exit status 9
  • Shows error about missing configuration field ✅
  • No upload attempted ✅

Malformed stackpack.conf

  • Create stackpack with invalid HOCON in stackpack.conf:

Setup & Command:

$ mkdir malformed-stackpack && echo "name = incomplete" > malformed-stackpack/stackpack.conf
$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./malformed-stackpack --yes
❌ Failed to parse stackpack.conf: version not found in stackpack.conf
exit status 9
  • Shows HOCON parsing error ✅
  • No version bumping attempted ✅

6. Command Help and Usage ✅ PASSED

Command Help

  • STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test --help

Command & Output:

$ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test --help
Test a stackpack by running package, upload, and install/upgrade commands in sequence.

This command will:
1. Read the stackpack name and version from stackpack.conf
2. Create a temporary copy of the stackpack directory
3. Update the version in the temporary copy with -cli-test.N suffix
4. Package the stackpack from the temporary copy into a zip file
5. Upload the zip file to the server (with confirmation)
6. Install the stackpack (if not installed) or upgrade it (if already installed)

The original stackpack directory is left untouched. The version is automatically incremented for each test run.
The stackpack name is read from stackpack.conf, so no --name flag is required.

Minimum supported StackState version: 5.0.0

Usage:
  sts stackpack test [flags]

Examples:
# Test stackpack with confirmation
sts stackpack test -p "param1=value1"

# Skip confirmation prompt
sts stackpack test --yes

# Test stackpack in specific directory with unlocked strategy
sts stackpack test -d ./my-stackpack --yes --unlocked-strategy force

# Test with custom unlocked strategy
sts stackpack test --unlocked-strategy skip --yes

Flags:
  -h, --help                         help for test
  -p, --parameter stringToString     List of parameters of the form "key=value" (default [])
  -d, --stackpack-directory string   Path to stackpack directory (defaults to current directory)
      --unlocked-strategy string     Strategy for dealing with unlocked StackPacks. Valid options are: fail, force, skip (default "fail")
  -y, --yes                          Skip confirmation prompt before upload

Global Flags:
      --api-token string             Specify the API token of the StackState server
      --ca-cert-base64-data string   Base64-encoded private CA or self-signed certificate data to use for SSL verification. Ignored if skip-ssl or ca-cert-path is set
      --ca-cert-path string          Path to a private CA or self-signed certificate file. Ignored if skip-ssl is set
      --config string                Override the path to the config file
  -c, --context string               Override the context to use
      --k8s-sa-token string          Specify the Kubernetes Service Account Token
      --k8s-sa-token-path string     Specify the path to the Kubernetes Service Account Token
      --no-color                     Disable color when printing to the terminal
  -o, --output enum                  Specify the output format (must be { json | text }) (default text)
      --service-token string         Specify the Service token of the StackState server
      --skip-ssl                     Whether to skip SSL certificate verification when connecting to StackState
      --url string                   Specify the URL of the StackState server
  -v, --verbose count                Print verbose logging to the terminal to track what the CLI is doing (use multiple times to increase verbosity)
  • Shows comprehensive usage information ✅
  • Lists all flags with descriptions ✅
  • Shows 5-step workflow explanation ✅
  • Includes practical examples ✅

Without Experimental Flag

  • go run main.go stackpack --help (without STS_EXPERIMENTAL_STACKPACK)

Command & Output:

$ go run main.go stackpack --help
Manage and upload StackPacks.

Usage:
  sts stackpack [command]

Available Commands:
  confirm-manual-steps Confirm manual steps of StackPack
  describe             Describe a StackPack
  install              Install a StackPack
  list                 List stackpacks
  list-instances       List installed instances of a StackPack
  list-parameters      List all parameters
  uninstall            Uninstall instances of a StackPack
  upgrade              Upgrade a StackPack
  upload               Upload a stackpack

Use "sts stackpack [command] --help" for more information about a command.
  • Does NOT show test command (experimental feature disabled) ✅

@viliakov viliakov changed the title [DRAFT] STAC-22609: Adding stackpack test command STAC-22609: Adding stackpack test command Aug 29, 2025
deontaljaard
deontaljaard previously approved these changes Sep 1, 2025
Copy link
Contributor

@deontaljaard deontaljaard left a comment

Choose a reason for hiding this comment

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

LGTM

@viliakov
Copy link
Contributor Author

viliakov commented Sep 4, 2025

Test Case: Installation with incorrect resource definitions.

❯ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d test-stackpack-005
✅ Starting stackpack test sequence...
Stackpack: test-stackpack-005 (current version: 0.0.1)

Step 1/5: Checking installed version...

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 0.0.1-cli-test.10000

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!

Stackpack: test-stackpack-005 (v0.0.1-cli-test.10000)
Zip file: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-005-0.0.1-cli-test.10000.zip
✅ ✓ Stackpack packaged successfully

⚠️ This will upload 'test-stackpack-005-0.0.1-cli-test.10000.zip' to SUSE Observability server:
Server: https://stac-22609.sandbox-main.sandbox.stackstate.io
Continue? (y/N): y

Step 5/5: Uploading and installing/upgrading stackpack...
✅ Uploaded StackPack: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-005-0.0.1-cli-test.10000.zip
NAME | DISPLAY NAME | VERSION
test-stackpack-005 | test-stackpack-005 | 0.0.1-cli-test.10000
✅ ✓ Stackpack uploaded successfully
Waiting for installation to complete...
❌ Stackpack 'test-stackpack-005' installation failed:
Configuration 260522990240931 failed: Object is missing required member 'name' for field nodes.[0]
exit status 9

Test Case: Upgrade with incorrect resource definitions.

`
❯ STS_EXPERIMENTAL_STACKPACK=1 go run main.go stackpack test -d ./test-stackpack-004 --yes
✅ Starting stackpack test sequence...
Stackpack: test-stackpack-004 (current version: 0.0.1)

Step 1/5: Checking installed version...
Found installed version: 0.0.1-cli-test.10001
Using installed version as base: 0.0.1-cli-test.10001

Step 2/5: Creating temporary copy for testing...
✅ ✓ Temporary copy created

Step 3/5: Bumping version for testing...
✅ ✓ Version bumped to: 0.0.1-cli-test.10002

Step 4/5: Packaging stackpack...
✅ ✓ Stackpack packaged successfully!

Stackpack: test-stackpack-004 (v0.0.1-cli-test.10002)
Zip file: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-004-0.0.1-cli-test.10002.zip
✅ ✓ Stackpack packaged successfully

Step 5/5: Uploading and installing/upgrading stackpack...
✅ Uploaded StackPack: /Users/viliakov/Workspace/src/github/stackstate-cli/test-stackpack-004-0.0.1-cli-test.10002.zip
NAME | DISPLAY NAME | VERSION
test-stackpack-004 | test-stackpack-004 | 0.0.1-cli-test.10002
✅ ✓ Stackpack uploaded successfully
Waiting for upgrade to complete...
❌ Stackpack 'test-stackpack-004' installation failed:
Configuration 52692588442715 failed: Object is missing required member 'name' for field nodes.[1]
exit status 9
`

@viliakov viliakov merged commit beaa13d into main Sep 4, 2025
5 checks passed
@viliakov viliakov deleted the STAC-22609 branch September 4, 2025 11:40
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.

3 participants