From b48df1ecd58bd296191eec1a50eac45da56b1dd8 Mon Sep 17 00:00:00 2001 From: Deon Taljaard Date: Tue, 13 Jan 2026 16:55:07 +0100 Subject: [PATCH] STAC-23880: change stackpack package extension from .zip to .sts --- cmd/stackpack/stackpack_package.go | 30 +++++++++--------- cmd/stackpack/stackpack_package_test.go | 12 +++---- cmd/stackpack/stackpack_test_cmd.go | 10 +++--- .../test-stackpack-1.0.0-cli-test.10000.zip | Bin 757 -> 0 bytes 4 files changed, 26 insertions(+), 26 deletions(-) delete mode 100644 cmd/stackpack/test-stackpack-1.0.0-cli-test.10000.zip diff --git a/cmd/stackpack/stackpack_package.go b/cmd/stackpack/stackpack_package.go index 1f8ccf4..da3d40c 100644 --- a/cmd/stackpack/stackpack_package.go +++ b/cmd/stackpack/stackpack_package.go @@ -76,16 +76,16 @@ func StackpackPackageCommand(cli *di.Deps) *cobra.Command { args := &PackageArgs{} cmd := &cobra.Command{ Use: "package", - Short: "Package a stackpack into a zip file", - Long: `Package a stackpack into a zip file. + Short: "Package a stackpack into an .sts file", + Long: `Package a stackpack into an .sts file. -Creates a zip file containing all required stackpack files and directories: +Creates an .sts file containing all required stackpack files and directories: - provisioning/ (directory) - README.md (file) - resources/ (directory) - stackpack.yaml (file) -The zip file is named -.zip where the name and +The .sts file is named -.sts where the name and version are extracted from stackpack.yaml and created in the current directory.`, Example: `# Package stackpack in current directory sts stackpack package @@ -94,16 +94,16 @@ sts stackpack package sts stackpack package -d ./my-stackpack # Package with custom archive filename -sts stackpack package -f my-custom-archive.zip +sts stackpack package -f my-custom-archive.sts -# Force overwrite existing zip file +# Force overwrite existing .sts file sts stackpack package --force`, RunE: cli.CmdRunE(RunStackpackPackageCommand(args)), } cmd.Flags().StringVarP(&args.StackpackDir, "stackpack-directory", "d", "", "Path to stackpack directory (defaults to current directory)") - cmd.Flags().StringVarP(&args.ArchiveFile, "archive-file", "f", "", "Path to the zip file to create (defaults to -.zip in current directory)") - cmd.Flags().BoolVar(&args.Force, "force", false, "Overwrite existing zip file without prompting") + cmd.Flags().StringVarP(&args.ArchiveFile, "archive-file", "f", "", "Path to the .sts file to create (defaults to -.sts in current directory)") + cmd.Flags().BoolVar(&args.Force, "force", false, "Overwrite existing .sts file without prompting") return cmd } @@ -140,7 +140,7 @@ func RunStackpackPackageCommand(args *PackageArgs) func(cli *di.Deps, cmd *cobra if err != nil { return common.NewRuntimeError(fmt.Errorf("failed to get current working directory: %w", err)) } - zipFileName := fmt.Sprintf("%s-%s.zip", stackpackInfo.Name, stackpackInfo.Version) + zipFileName := fmt.Sprintf("%s-%s.sts", stackpackInfo.Name, stackpackInfo.Version) args.ArchiveFile = filepath.Join(currentDir, zipFileName) } else { // Convert to absolute path @@ -156,9 +156,9 @@ func RunStackpackPackageCommand(args *PackageArgs) func(cli *di.Deps, cmd *cobra return common.NewCLIArgParseError(err) } - // Check if zip file exists and handle force flag + // Check if .sts file exists and handle force flag if _, err := os.Stat(args.ArchiveFile); err == nil && !args.Force { - return common.NewRuntimeError(fmt.Errorf("zip file already exists: %s (use --force to overwrite)", args.ArchiveFile)) + return common.NewRuntimeError(fmt.Errorf(".sts file already exists: %s (use --force to overwrite)", args.ArchiveFile)) } // Create output directory if it doesn't exist @@ -167,9 +167,9 @@ func RunStackpackPackageCommand(args *PackageArgs) func(cli *di.Deps, cmd *cobra return common.NewRuntimeError(fmt.Errorf("failed to create output directory: %w", err)) } - // Create zip file + // Create .sts file if err := createStackpackZip(args.StackpackDir, args.ArchiveFile); err != nil { - return common.NewRuntimeError(fmt.Errorf("failed to create zip file: %w", err)) + return common.NewRuntimeError(fmt.Errorf("failed to create .sts file: %w", err)) } if cli.IsJson() { @@ -184,7 +184,7 @@ func RunStackpackPackageCommand(args *PackageArgs) func(cli *di.Deps, cmd *cobra cli.Printer.Successf("Stackpack packaged successfully!") cli.Printer.PrintLn("") cli.Printer.PrintLn(fmt.Sprintf("Stackpack: %s (v%s)", stackpackInfo.Name, stackpackInfo.Version)) - cli.Printer.PrintLn(fmt.Sprintf("Zip file: %s", args.ArchiveFile)) + cli.Printer.PrintLn(fmt.Sprintf(".sts file: %s", args.ArchiveFile)) } return nil @@ -207,7 +207,7 @@ func validateStackpackDirectory(dir string) error { func createStackpackZip(sourceDir, zipPath string) error { zipFile, err := os.Create(zipPath) if err != nil { - return fmt.Errorf("failed to create zip file: %w", err) + return fmt.Errorf("failed to create .sts file: %w", err) } defer zipFile.Close() diff --git a/cmd/stackpack/stackpack_package_test.go b/cmd/stackpack/stackpack_package_test.go index bc1995d..a5f2e07 100644 --- a/cmd/stackpack/stackpack_package_test.go +++ b/cmd/stackpack/stackpack_package_test.go @@ -72,7 +72,7 @@ func TestStackpackPackageCommand_DefaultBehavior(t *testing.T) { require.NoError(t, err) // Verify zip file was created in current directory - expectedZipPath := filepath.Join(tempDir, "test-stackpack-1.0.0.zip") + expectedZipPath := filepath.Join(tempDir, "test-stackpack-1.0.0.sts") _, err = os.Stat(expectedZipPath) assert.NoError(t, err, "Zip file should be created") @@ -97,7 +97,7 @@ func TestStackpackPackageCommand_CustomArchiveFile(t *testing.T) { require.NoError(t, os.MkdirAll(stackpackDir, 0755)) createTestStackpack(t, stackpackDir, "my-stackpack", "2.1.0") - customZipPath := filepath.Join(tempDir, "custom-name.zip") + customZipPath := filepath.Join(tempDir, "custom-name.sts") cli, cmd := setupStackPackPackageCmd(t) _, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, "-d", stackpackDir, "-f", customZipPath) @@ -122,7 +122,7 @@ func TestStackpackPackageCommand_ForceFlag(t *testing.T) { require.NoError(t, os.MkdirAll(stackpackDir, 0755)) createTestStackpack(t, stackpackDir, "test-stackpack", "1.0.0") - zipPath := filepath.Join(tempDir, "test-stackpack-1.0.0.zip") + zipPath := filepath.Join(tempDir, "test-stackpack-1.0.0.sts") // Create existing zip file require.NoError(t, os.WriteFile(zipPath, []byte("existing content"), 0644)) @@ -132,7 +132,7 @@ func TestStackpackPackageCommand_ForceFlag(t *testing.T) { // Test without force flag - should fail _, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, "-d", stackpackDir, "-f", zipPath) require.Error(t, err) - assert.Contains(t, err.Error(), "zip file already exists") + assert.Contains(t, err.Error(), ".sts file already exists") assert.Contains(t, err.Error(), "--force") // Test with force flag - should succeed @@ -178,7 +178,7 @@ func TestStackpackPackageCommand_JSONOutput(t *testing.T) { assert.Equal(t, true, jsonOutput["success"]) assert.Equal(t, "json-test", jsonOutput["stackpack_name"]) assert.Equal(t, "3.0.0", jsonOutput["stackpack_version"]) - assert.Contains(t, jsonOutput["zip_file"], "json-test-3.0.0.zip") + assert.Contains(t, jsonOutput["zip_file"], "json-test-3.0.0.sts") assert.Contains(t, jsonOutput["source_dir"], stackpackDir) // Verify no text output for JSON mode @@ -329,7 +329,7 @@ func TestStackpackPackageCommand_CreateOutputDirectory(t *testing.T) { // Create nested output directory path that doesn't exist outputDir := filepath.Join(tempDir, "output", "nested", "path") - zipPath := filepath.Join(outputDir, "custom.zip") + zipPath := filepath.Join(outputDir, "custom.sts") cli, cmd := setupStackPackPackageCmd(t) diff --git a/cmd/stackpack/stackpack_test_cmd.go b/cmd/stackpack/stackpack_test_cmd.go index 8ade153..6aa391d 100644 --- a/cmd/stackpack/stackpack_test_cmd.go +++ b/cmd/stackpack/stackpack_test_cmd.go @@ -43,8 +43,8 @@ This command will: 1. Read the stackpack name and version from ` + stackpackConfigFile + ` 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) +4. Package the stackpack from the temporary copy into an .sts file +5. Upload the .sts 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. @@ -183,7 +183,7 @@ func RunStackpackTestCommand(args *TestArgs) di.CmdWithApiFn { // Set archive file in current directory currentDir, _ := os.Getwd() - packageArgs.ArchiveFile = filepath.Join(currentDir, fmt.Sprintf("%s-%s.zip", originalInfo.Name, newVersion)) + packageArgs.ArchiveFile = filepath.Join(currentDir, fmt.Sprintf("%s-%s.sts", originalInfo.Name, newVersion)) if err := runPackageStep(cli, packageArgs); err != nil { return err @@ -241,9 +241,9 @@ func RunStackpackTestCommand(args *TestArgs) di.CmdWithApiFn { cli.Printer.PrintLn("") cli.Printer.Success("🎉 Test sequence completed successfully!") - // Clean up zip file + // Clean up .sts file if err := os.Remove(packageArgs.ArchiveFile); err != nil { - cli.Printer.PrintLn(fmt.Sprintf("Note: Could not clean up zip file %s: %v", packageArgs.ArchiveFile, err)) + cli.Printer.PrintLn(fmt.Sprintf("Note: Could not clean up .sts file %s: %v", packageArgs.ArchiveFile, err)) } return nil diff --git a/cmd/stackpack/test-stackpack-1.0.0-cli-test.10000.zip b/cmd/stackpack/test-stackpack-1.0.0-cli-test.10000.zip deleted file mode 100644 index 4dfd1ba816839bfa24863b2cc7ab85104aff001c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 757 zcmWIWW@Zs#-~d8&APN*HD9SI(EY8f&%gjsHFG(#f(JL;g)biBT3)Ij!rGHxI+?n&I z&v>)5Ffjc8AK=Z-@t!xQQXHsH5QqbCn#>854RUpK@paY9O$iFq0GfAESI^VuoSuiz zxo3~KPM**S10oNW(;5d-zc4VuOy9GmW0^WouQp!OLGCU}EzU13N=_}-&o4_YD$7hQ z2igR7_X&M(U9HnTx(GMFytXS=7^sIAuc>@M+2WGK_<)~ig+%}MFsyXvq3Piwh- zYeAay)4rMSWw>vn44;-z@K^`>~$d>r*m)`LfhDfd^Sf4tv=& ztUI*Q+h^M1wIPdsD@uK+7u>r#VVS4V{b$854^(Nc4%MkWykL_8zM6DYh;0oGVYHv%~_KoN=nQ9vdFsJAm4-#v8g3 h$Q}bl3j*)~y^0!10p6@^AbA!b{0XF=0aY+C005v+#Pa|E