mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-07 08:44:50 +00:00
* feat(hydrator): add sourceHydrator types Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> fix(codegen): use kube_codegen.sh deepcopy and client gen correctly Signed-off-by: Michael Crenshaw <[email protected]> deepcopy gen Signed-off-by: Michael Crenshaw <[email protected]> * feat(hydrator): add commit-server component Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> go mod tidy Signed-off-by: Michael Crenshaw <[email protected]> one test file for both implementations Signed-off-by: Michael Crenshaw <[email protected]> simplify Signed-off-by: Michael Crenshaw <[email protected]> fix test for linux Signed-off-by: Michael Crenshaw <[email protected]> fix git client mock Signed-off-by: Michael Crenshaw <[email protected]> fix git client mock Signed-off-by: Michael Crenshaw <[email protected]> address comments Signed-off-by: Michael Crenshaw <[email protected]> unit tests Signed-off-by: Michael Crenshaw <[email protected]> lint Signed-off-by: Michael Crenshaw <[email protected]> fix image, fix health checks, fix merge issue Signed-off-by: Michael Crenshaw <[email protected]> fix lint issues Signed-off-by: Michael Crenshaw <[email protected]> remove code that doesn't work for GHE Signed-off-by: Michael Crenshaw <[email protected]> changes from comments Signed-off-by: Michael Crenshaw <[email protected]> * feat(hydrator): enable controller Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> feat(hydrator): enable controller Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> allow opt-in Signed-off-by: Michael Crenshaw <[email protected]> separation between app controller and hydrator Signed-off-by: Michael Crenshaw <[email protected]> simplify diff Signed-off-by: Michael Crenshaw <[email protected]> todos Signed-off-by: Michael Crenshaw <[email protected]> simplify Signed-off-by: Michael Crenshaw <[email protected]> add dry sha to logs Signed-off-by: Michael Crenshaw <[email protected]> add app name to logs Signed-off-by: Michael Crenshaw <[email protected]> more logging, no caching Signed-off-by: Michael Crenshaw <[email protected]> fix cluster install Signed-off-by: Michael Crenshaw <[email protected]> don't interrupt an ongoing hydrate operation Signed-off-by: Michael Crenshaw <[email protected]> revert hydrate loop fix Signed-off-by: Michael Crenshaw <[email protected]> handle project-scoped repo creds Signed-off-by: Michael Crenshaw <[email protected]> codegen Signed-off-by: Michael Crenshaw <[email protected]> improve docs Signed-off-by: Michael Crenshaw <[email protected]> fixes from comments Signed-off-by: Michael Crenshaw <[email protected]> * set hydrator enabled key when using hydrator manifests Signed-off-by: Michael Crenshaw <[email protected]> fix manifests Signed-off-by: Michael Crenshaw <[email protected]> improve docs Signed-off-by: Michael Crenshaw <[email protected]> * feat(hydrator): enable controller Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> feat(hydrator): enable controller Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> allow opt-in Signed-off-by: Michael Crenshaw <[email protected]> separation between app controller and hydrator Signed-off-by: Michael Crenshaw <[email protected]> simplify diff Signed-off-by: Michael Crenshaw <[email protected]> todos Signed-off-by: Michael Crenshaw <[email protected]> simplify Signed-off-by: Michael Crenshaw <[email protected]> add dry sha to logs Signed-off-by: Michael Crenshaw <[email protected]> add app name to logs Signed-off-by: Michael Crenshaw <[email protected]> more logging, no caching Signed-off-by: Michael Crenshaw <[email protected]> fix cluster install Signed-off-by: Michael Crenshaw <[email protected]> don't interrupt an ongoing hydrate operation Signed-off-by: Michael Crenshaw <[email protected]> revert hydrate loop fix Signed-off-by: Michael Crenshaw <[email protected]> handle project-scoped repo creds Signed-off-by: Michael Crenshaw <[email protected]> codegen Signed-off-by: Michael Crenshaw <[email protected]> improve docs Signed-off-by: Michael Crenshaw <[email protected]> fixes from comments Signed-off-by: Michael Crenshaw <[email protected]> * feat(hydrator): add sourceHydrator types Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> fix(codegen): use kube_codegen.sh deepcopy and client gen correctly Signed-off-by: Michael Crenshaw <[email protected]> deepcopy gen Signed-off-by: Michael Crenshaw <[email protected]> * feat(hydrator): enable controller Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> feat(hydrator): enable controller Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> allow opt-in Signed-off-by: Michael Crenshaw <[email protected]> separation between app controller and hydrator Signed-off-by: Michael Crenshaw <[email protected]> simplify diff Signed-off-by: Michael Crenshaw <[email protected]> todos Signed-off-by: Michael Crenshaw <[email protected]> simplify Signed-off-by: Michael Crenshaw <[email protected]> add dry sha to logs Signed-off-by: Michael Crenshaw <[email protected]> add app name to logs Signed-off-by: Michael Crenshaw <[email protected]> more logging, no caching Signed-off-by: Michael Crenshaw <[email protected]> fix cluster install Signed-off-by: Michael Crenshaw <[email protected]> don't interrupt an ongoing hydrate operation Signed-off-by: Michael Crenshaw <[email protected]> revert hydrate loop fix Signed-off-by: Michael Crenshaw <[email protected]> handle project-scoped repo creds Signed-off-by: Michael Crenshaw <[email protected]> codegen Signed-off-by: Michael Crenshaw <[email protected]> * feat(hydrator): write credentials handling + UI Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> feat(hydrator): enable controller Co-authored-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Omer Azmon <[email protected]> Co-authored-by: daengdaengLee <[email protected]> Co-authored-by: Juwon Hwang (Kevin) <[email protected]> Co-authored-by: thisishwan2 <[email protected]> Co-authored-by: mirageoasis <[email protected]> Co-authored-by: Robin Lieb <[email protected]> Co-authored-by: miiiinju1 <[email protected]> Signed-off-by: Michael Crenshaw <[email protected]> allow opt-in Signed-off-by: Michael Crenshaw <[email protected]> separation between app controller and hydrator Signed-off-by: Michael Crenshaw <[email protected]> simplify diff Signed-off-by: Michael Crenshaw <[email protected]> todos Signed-off-by: Michael Crenshaw <[email protected]> simplify Signed-off-by: Michael Crenshaw <[email protected]> add dry sha to logs Signed-off-by: Michael Crenshaw <[email protected]> add app name to logs Signed-off-by: Michael Crenshaw <[email protected]> more logging, no caching Signed-off-by: Michael Crenshaw <[email protected]> fix cluster install Signed-off-by: Michael Crenshaw <[email protected]> don't interrupt an ongoing hydrate operation Signed-off-by: Michael Crenshaw <[email protected]> revert hydrate loop fix Signed-off-by: Michael Crenshaw <[email protected]> feat(hydrator): write credentials handling + UI Signed-off-by: Michael Crenshaw <[email protected]> WIP: add new APIs for write creds Signed-off-by: Michael Crenshaw <[email protected]> write api and template api Signed-off-by: Michael Crenshaw <[email protected]> fix time function Signed-off-by: Michael Crenshaw <[email protected]> fix lint issues Signed-off-by: Michael Crenshaw <[email protected]> don't enrich with read creds Signed-off-by: Michael Crenshaw <[email protected]> revert tls change Signed-off-by: Michael Crenshaw <[email protected]> don't disable buttons in UI Signed-off-by: Michael Crenshaw <[email protected]> ask repo server for specific revision Signed-off-by: Michael Crenshaw <[email protected]> fixes Signed-off-by: Michael Crenshaw <[email protected]> lint ui Signed-off-by: Michael Crenshaw <[email protected]> remove unnecessary change Signed-off-by: Michael Crenshaw <[email protected]> fix test and lint Signed-off-by: Michael Crenshaw <[email protected]> lint Signed-off-by: Michael Crenshaw <[email protected]> enable hydrator for e2e tests Signed-off-by: Michael Crenshaw <[email protected]> * free disk space for e2e tests Signed-off-by: Michael Crenshaw <[email protected]> don't free disk space Signed-off-by: Michael Crenshaw <[email protected]> * free disk space for e2e tests Signed-off-by: Michael Crenshaw <[email protected]> * remove comment that breaks auth Signed-off-by: Michael Crenshaw <[email protected]> * try removing extra function Signed-off-by: Michael Crenshaw <[email protected]> * cleanup from comments Signed-off-by: Michael Crenshaw <[email protected]> * fix test Signed-off-by: Michael Crenshaw <[email protected]> --------- Signed-off-by: Michael Crenshaw <[email protected]>
68 lines
1.6 KiB
Go
68 lines
1.6 KiB
Go
package files
|
|
|
|
import (
|
|
"os"
|
|
"path"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestSecureMkdirAllDefault(t *testing.T) {
|
|
root := t.TempDir()
|
|
|
|
unsafePath := "test/dir"
|
|
fullPath, err := SecureMkdirAll(root, unsafePath, os.ModePerm)
|
|
require.NoError(t, err)
|
|
|
|
expectedPath := path.Join(root, unsafePath)
|
|
assert.Equal(t, expectedPath, fullPath)
|
|
}
|
|
|
|
func TestSecureMkdirAllWithExistingDir(t *testing.T) {
|
|
root := t.TempDir()
|
|
unsafePath := "existing/dir"
|
|
|
|
fullPath, err := SecureMkdirAll(root, unsafePath, os.ModePerm)
|
|
require.NoError(t, err)
|
|
|
|
newPath, err := SecureMkdirAll(root, unsafePath, os.ModePerm)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, fullPath, newPath)
|
|
}
|
|
|
|
func TestSecureMkdirAllWithFile(t *testing.T) {
|
|
root := t.TempDir()
|
|
unsafePath := "file.txt"
|
|
|
|
filePath := filepath.Join(root, unsafePath)
|
|
err := os.WriteFile(filePath, []byte("test"), os.ModePerm)
|
|
require.NoError(t, err)
|
|
|
|
// Should fail because there is a file at the path
|
|
_, err = SecureMkdirAll(root, unsafePath, os.ModePerm)
|
|
require.Error(t, err)
|
|
}
|
|
|
|
func TestSecureMkdirAllDotDotPath(t *testing.T) {
|
|
root := t.TempDir()
|
|
unsafePath := "../outside"
|
|
|
|
fullPath, err := SecureMkdirAll(root, unsafePath, os.ModePerm)
|
|
require.NoError(t, err)
|
|
|
|
expectedPath := filepath.Join(root, "outside")
|
|
assert.Equal(t, expectedPath, fullPath)
|
|
|
|
info, err := os.Stat(fullPath)
|
|
require.NoError(t, err)
|
|
assert.True(t, info.IsDir())
|
|
|
|
relPath, err := filepath.Rel(root, fullPath)
|
|
require.NoError(t, err)
|
|
assert.False(t, strings.HasPrefix(relPath, ".."))
|
|
}
|