Skip to content

Commit b48df1e

Browse files
committed
STAC-23880: change stackpack package extension from .zip to .sts
1 parent e10c4ff commit b48df1e

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

cmd/stackpack/stackpack_package.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@ func StackpackPackageCommand(cli *di.Deps) *cobra.Command {
7676
args := &PackageArgs{}
7777
cmd := &cobra.Command{
7878
Use: "package",
79-
Short: "Package a stackpack into a zip file",
80-
Long: `Package a stackpack into a zip file.
79+
Short: "Package a stackpack into an .sts file",
80+
Long: `Package a stackpack into an .sts file.
8181
82-
Creates a zip file containing all required stackpack files and directories:
82+
Creates an .sts file containing all required stackpack files and directories:
8383
- provisioning/ (directory)
8484
- README.md (file)
8585
- resources/ (directory)
8686
- stackpack.yaml (file)
8787
88-
The zip file is named <stackpack_name>-<version>.zip where the name and
88+
The .sts file is named <stackpack_name>-<version>.sts where the name and
8989
version are extracted from stackpack.yaml and created in the current directory.`,
9090
Example: `# Package stackpack in current directory
9191
sts stackpack package
@@ -94,16 +94,16 @@ sts stackpack package
9494
sts stackpack package -d ./my-stackpack
9595
9696
# Package with custom archive filename
97-
sts stackpack package -f my-custom-archive.zip
97+
sts stackpack package -f my-custom-archive.sts
9898
99-
# Force overwrite existing zip file
99+
# Force overwrite existing .sts file
100100
sts stackpack package --force`,
101101
RunE: cli.CmdRunE(RunStackpackPackageCommand(args)),
102102
}
103103

104104
cmd.Flags().StringVarP(&args.StackpackDir, "stackpack-directory", "d", "", "Path to stackpack directory (defaults to current directory)")
105-
cmd.Flags().StringVarP(&args.ArchiveFile, "archive-file", "f", "", "Path to the zip file to create (defaults to <stackpack_name>-<version>.zip in current directory)")
106-
cmd.Flags().BoolVar(&args.Force, "force", false, "Overwrite existing zip file without prompting")
105+
cmd.Flags().StringVarP(&args.ArchiveFile, "archive-file", "f", "", "Path to the .sts file to create (defaults to <stackpack_name>-<version>.sts in current directory)")
106+
cmd.Flags().BoolVar(&args.Force, "force", false, "Overwrite existing .sts file without prompting")
107107

108108
return cmd
109109
}
@@ -140,7 +140,7 @@ func RunStackpackPackageCommand(args *PackageArgs) func(cli *di.Deps, cmd *cobra
140140
if err != nil {
141141
return common.NewRuntimeError(fmt.Errorf("failed to get current working directory: %w", err))
142142
}
143-
zipFileName := fmt.Sprintf("%s-%s.zip", stackpackInfo.Name, stackpackInfo.Version)
143+
zipFileName := fmt.Sprintf("%s-%s.sts", stackpackInfo.Name, stackpackInfo.Version)
144144
args.ArchiveFile = filepath.Join(currentDir, zipFileName)
145145
} else {
146146
// Convert to absolute path
@@ -156,9 +156,9 @@ func RunStackpackPackageCommand(args *PackageArgs) func(cli *di.Deps, cmd *cobra
156156
return common.NewCLIArgParseError(err)
157157
}
158158

159-
// Check if zip file exists and handle force flag
159+
// Check if .sts file exists and handle force flag
160160
if _, err := os.Stat(args.ArchiveFile); err == nil && !args.Force {
161-
return common.NewRuntimeError(fmt.Errorf("zip file already exists: %s (use --force to overwrite)", args.ArchiveFile))
161+
return common.NewRuntimeError(fmt.Errorf(".sts file already exists: %s (use --force to overwrite)", args.ArchiveFile))
162162
}
163163

164164
// Create output directory if it doesn't exist
@@ -167,9 +167,9 @@ func RunStackpackPackageCommand(args *PackageArgs) func(cli *di.Deps, cmd *cobra
167167
return common.NewRuntimeError(fmt.Errorf("failed to create output directory: %w", err))
168168
}
169169

170-
// Create zip file
170+
// Create .sts file
171171
if err := createStackpackZip(args.StackpackDir, args.ArchiveFile); err != nil {
172-
return common.NewRuntimeError(fmt.Errorf("failed to create zip file: %w", err))
172+
return common.NewRuntimeError(fmt.Errorf("failed to create .sts file: %w", err))
173173
}
174174

175175
if cli.IsJson() {
@@ -184,7 +184,7 @@ func RunStackpackPackageCommand(args *PackageArgs) func(cli *di.Deps, cmd *cobra
184184
cli.Printer.Successf("Stackpack packaged successfully!")
185185
cli.Printer.PrintLn("")
186186
cli.Printer.PrintLn(fmt.Sprintf("Stackpack: %s (v%s)", stackpackInfo.Name, stackpackInfo.Version))
187-
cli.Printer.PrintLn(fmt.Sprintf("Zip file: %s", args.ArchiveFile))
187+
cli.Printer.PrintLn(fmt.Sprintf(".sts file: %s", args.ArchiveFile))
188188
}
189189

190190
return nil
@@ -207,7 +207,7 @@ func validateStackpackDirectory(dir string) error {
207207
func createStackpackZip(sourceDir, zipPath string) error {
208208
zipFile, err := os.Create(zipPath)
209209
if err != nil {
210-
return fmt.Errorf("failed to create zip file: %w", err)
210+
return fmt.Errorf("failed to create .sts file: %w", err)
211211
}
212212
defer zipFile.Close()
213213

cmd/stackpack/stackpack_package_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func TestStackpackPackageCommand_DefaultBehavior(t *testing.T) {
7272
require.NoError(t, err)
7373

7474
// Verify zip file was created in current directory
75-
expectedZipPath := filepath.Join(tempDir, "test-stackpack-1.0.0.zip")
75+
expectedZipPath := filepath.Join(tempDir, "test-stackpack-1.0.0.sts")
7676
_, err = os.Stat(expectedZipPath)
7777
assert.NoError(t, err, "Zip file should be created")
7878

@@ -97,7 +97,7 @@ func TestStackpackPackageCommand_CustomArchiveFile(t *testing.T) {
9797
require.NoError(t, os.MkdirAll(stackpackDir, 0755))
9898
createTestStackpack(t, stackpackDir, "my-stackpack", "2.1.0")
9999

100-
customZipPath := filepath.Join(tempDir, "custom-name.zip")
100+
customZipPath := filepath.Join(tempDir, "custom-name.sts")
101101
cli, cmd := setupStackPackPackageCmd(t)
102102

103103
_, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, "-d", stackpackDir, "-f", customZipPath)
@@ -122,7 +122,7 @@ func TestStackpackPackageCommand_ForceFlag(t *testing.T) {
122122
require.NoError(t, os.MkdirAll(stackpackDir, 0755))
123123
createTestStackpack(t, stackpackDir, "test-stackpack", "1.0.0")
124124

125-
zipPath := filepath.Join(tempDir, "test-stackpack-1.0.0.zip")
125+
zipPath := filepath.Join(tempDir, "test-stackpack-1.0.0.sts")
126126

127127
// Create existing zip file
128128
require.NoError(t, os.WriteFile(zipPath, []byte("existing content"), 0644))
@@ -132,7 +132,7 @@ func TestStackpackPackageCommand_ForceFlag(t *testing.T) {
132132
// Test without force flag - should fail
133133
_, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, "-d", stackpackDir, "-f", zipPath)
134134
require.Error(t, err)
135-
assert.Contains(t, err.Error(), "zip file already exists")
135+
assert.Contains(t, err.Error(), ".sts file already exists")
136136
assert.Contains(t, err.Error(), "--force")
137137

138138
// Test with force flag - should succeed
@@ -178,7 +178,7 @@ func TestStackpackPackageCommand_JSONOutput(t *testing.T) {
178178
assert.Equal(t, true, jsonOutput["success"])
179179
assert.Equal(t, "json-test", jsonOutput["stackpack_name"])
180180
assert.Equal(t, "3.0.0", jsonOutput["stackpack_version"])
181-
assert.Contains(t, jsonOutput["zip_file"], "json-test-3.0.0.zip")
181+
assert.Contains(t, jsonOutput["zip_file"], "json-test-3.0.0.sts")
182182
assert.Contains(t, jsonOutput["source_dir"], stackpackDir)
183183

184184
// Verify no text output for JSON mode
@@ -329,7 +329,7 @@ func TestStackpackPackageCommand_CreateOutputDirectory(t *testing.T) {
329329

330330
// Create nested output directory path that doesn't exist
331331
outputDir := filepath.Join(tempDir, "output", "nested", "path")
332-
zipPath := filepath.Join(outputDir, "custom.zip")
332+
zipPath := filepath.Join(outputDir, "custom.sts")
333333

334334
cli, cmd := setupStackPackPackageCmd(t)
335335

cmd/stackpack/stackpack_test_cmd.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ This command will:
4343
1. Read the stackpack name and version from ` + stackpackConfigFile + `
4444
2. Create a temporary copy of the stackpack directory
4545
3. Update the version in the temporary copy with -cli-test.N suffix
46-
4. Package the stackpack from the temporary copy into a zip file
47-
5. Upload the zip file to the server (with confirmation)
46+
4. Package the stackpack from the temporary copy into an .sts file
47+
5. Upload the .sts file to the server (with confirmation)
4848
6. Install the stackpack (if not installed) or upgrade it (if already installed)
4949
5050
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 {
183183

184184
// Set archive file in current directory
185185
currentDir, _ := os.Getwd()
186-
packageArgs.ArchiveFile = filepath.Join(currentDir, fmt.Sprintf("%s-%s.zip", originalInfo.Name, newVersion))
186+
packageArgs.ArchiveFile = filepath.Join(currentDir, fmt.Sprintf("%s-%s.sts", originalInfo.Name, newVersion))
187187

188188
if err := runPackageStep(cli, packageArgs); err != nil {
189189
return err
@@ -241,9 +241,9 @@ func RunStackpackTestCommand(args *TestArgs) di.CmdWithApiFn {
241241
cli.Printer.PrintLn("")
242242
cli.Printer.Success("🎉 Test sequence completed successfully!")
243243

244-
// Clean up zip file
244+
// Clean up .sts file
245245
if err := os.Remove(packageArgs.ArchiveFile); err != nil {
246-
cli.Printer.PrintLn(fmt.Sprintf("Note: Could not clean up zip file %s: %v", packageArgs.ArchiveFile, err))
246+
cli.Printer.PrintLn(fmt.Sprintf("Note: Could not clean up .sts file %s: %v", packageArgs.ArchiveFile, err))
247247
}
248248

249249
return nil
-757 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)