Skip to content

Commit f2047f7

Browse files
committed
Improve push command
1 parent c056c15 commit f2047f7

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [v1.0.54] - 2025-09-17
8+
9+
### Fixed
10+
- `push` command now correctly validates content of a `--workspace-state` (`-w`) flag
11+
12+
### Changed
13+
- `push` command now works with current directory, instead of always forcing root git directory
14+
715
## [v1.0.53] - 2025-08-25
816

917
### Fixed

src/archiveClient/handler_archiveGitFiles.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func (h *Handler) ArchiveGitFiles(ctx context.Context, uxBlocks uxBlock.UxBlocks
3838

3939
// Start the appropriate archiving process based on config
4040
if h.config.DeployGitFolder {
41-
return h.createArchiveWithGitFolder(ctx, rootDir, gzipWriter)
41+
return h.createArchiveWithGitFolder(ctx, rootDir, workingDir, gzipWriter)
4242
}
43-
return h.createSimpleArchive(ctx, rootDir, gzipWriter)
43+
return h.createSimpleArchive(ctx, workingDir, gzipWriter)
4444
}
4545

4646
func (h *Handler) getRootDir(ctx context.Context, workingDir string) (string, error) {
@@ -143,13 +143,13 @@ func (h *Handler) createSimpleArchive(ctx context.Context, workingDir string, wr
143143
}
144144

145145
// createArchiveWithGitFolder creates an archive including the .git directory
146-
func (h *Handler) createArchiveWithGitFolder(ctx context.Context, workingDir string, writer io.Writer) error {
146+
func (h *Handler) createArchiveWithGitFolder(ctx context.Context, rootDir, workingDir string, writer io.Writer) error {
147147
// Create a tar writer for our archive
148148
tarWriter := tar.NewWriter(writer)
149149
defer tarWriter.Close()
150150

151151
// First, add the .git directory to the tar
152-
if err := h.addGitDirectory(workingDir, tarWriter); err != nil {
152+
if err := h.addGitDirectory(rootDir, tarWriter); err != nil {
153153
return err
154154
}
155155

src/cmd/servicePush.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ func servicePushCmd() *cmdBuilder.Cmd {
6464
if cmdData.Params.IsSet("no-git") && (cmdData.Params.IsSet("deploy-git-folder") || cmdData.Params.IsSet("workspace-state")) {
6565
uxBlocks.PrintWarning(styles.WarningLine("--no-git and --deploy-git-folder/--workspace-state are mutually exclusive, ignoring --deploy-git-folder/--workspace-state"))
6666
}
67+
if cmdData.Params.IsSet("workspace-state") && !gn.IsOneOf(cmdData.Params.GetString("workspace-state"), archiveClient.WorkspaceAll, archiveClient.WorkspaceClean, archiveClient.WorkspaceStaged) {
68+
return errors.New("Invalid value for --workspace-state, please use one of: " + archiveClient.WorkspaceAll + ", " + archiveClient.WorkspaceClean + ", " + archiveClient.WorkspaceStaged)
69+
}
6770

6871
configContent, err := yamlReader.ReadZeropsYamlContent(
6972
uxBlocks,

0 commit comments

Comments
 (0)