Skip to content

Commit

Permalink
add ui code
Browse files Browse the repository at this point in the history
Signed-off-by: nitishfy <[email protected]>
  • Loading branch information
nitishfy committed Dec 19, 2024
1 parent 6985ec0 commit 08de1ba
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
3 changes: 1 addition & 2 deletions internal/directives/file_deleter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func (f *fileDeleter) runPromotionStep(
}

symlink, err := f.isSymlink(absPath)

/* TODO
if err != nil {
Expand All @@ -73,7 +72,7 @@ func (f *fileDeleter) runPromotionStep(
if symlink {
err = os.Remove(absPath)
if err != nil {
return PromotionStepResult{}, err
return PromotionStepResult{Status: kargoapi.PromotionPhaseErrored}, err
}
} else {
pathToDelete, err := securejoin.SecureJoin(stepCtx.WorkDir, cfg.Path)
Expand Down
5 changes: 4 additions & 1 deletion internal/directives/file_deleter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func Test_fileDeleter_runPromotionStep(t *testing.T) {
return tmpDir
},
cfg: DeleteConfig{
Path: "foo",
Path: "foo/",
},
assertions: func(t *testing.T, workDir string, result PromotionStepResult, err error) {
assert.NoError(t, err)
Expand All @@ -129,6 +129,9 @@ func Test_fileDeleter_runPromotionStep(t *testing.T) {
_, statErr := os.Stat(filepath.Join(workDir, "foo", "file.txt"))
assert.Error(t, statErr)
assert.True(t, os.IsNotExist(statErr))

_, statErr = os.Stat(filepath.Join(workDir, "bar", "file.txt"))
assert.NoError(t, statErr)
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/directives/schemas/delete-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"additionalProperties": false,
"required": ["path"],
"properties": {
"Path": {
"path": {
"type": "string",
"description": "Path is the path to the file or directory to delete.",
"minLength": 1
Expand Down
2 changes: 1 addition & 1 deletion internal/directives/zz_config_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
faCodeBranch,
faCodePullRequest,
faCopy,
faDelete,
faDraftingCompass,
faEdit,
faExchangeAlt,
Expand All @@ -29,6 +30,7 @@ import { JSONSchema7 } from 'json-schema';
// IMPORTANT(Marvin9): this must be replaced with proper discovery mechanism
import argocdUpdateConfig from '@ui/gen/directives/argocd-update-config.json';
import copyConfig from '@ui/gen/directives/copy-config.json';
import deleteConfig from '@ui/gen/directives/delete-config.json';
import gitOverwriteConfig from '@ui/gen/directives/git-clear-config.json';
import gitCloneConfig from '@ui/gen/directives/git-clone-config.json';
import gitCommitConfig from '@ui/gen/directives/git-commit-config.json';
Expand Down Expand Up @@ -61,6 +63,11 @@ export const useDiscoverPromotionDirectivesRegistries = (): PromotionDirectivesR
unstable_icons: [faCopy],
config: copyConfig as JSONSchema7
},
{
identifier: 'delete',
unstable_icons: [faDelete],
config: deleteConfig as JSONSchema7
},
{
identifier: 'git-clone',
unstable_icons: [faCodeBranch, faClone],
Expand Down
2 changes: 1 addition & 1 deletion ui/src/gen/directives/delete-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "object",
"additionalProperties": false,
"properties": {
"Path": {
"path": {
"type": "string",
"description": "Path is the path to the file or directory to delete.",
"minLength": 1
Expand Down

0 comments on commit 08de1ba

Please sign in to comment.