From eb1f971d52b5b8f35540de3abfc0c9a60f3f33cf Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Thu, 5 Dec 2019 01:54:05 +0800 Subject: [PATCH] Not to exclude hidden file when creating archive (#1458) Some of configs are hidden files like .babelrc, we should not ignore them. --- pkg/utils/utils.go | 14 +--- test/test_utils.sh | 1 - .../test_specs/test_ignore_hidden_file.sh | 65 ------------------- 3 files changed, 3 insertions(+), 77 deletions(-) delete mode 100755 test/tests/test_specs/test_ignore_hidden_file.sh diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 4e281822..d1f918ef 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -37,7 +37,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" fv1 "github.com/fission/fission/pkg/apis/fission.io/v1" - "github.com/fission/fission/pkg/fission-cli/console" ) func UrlForFunction(name, namespace string) string { @@ -103,7 +102,7 @@ func GetTempDir() (string, error) { return dir, err } -// FindAllGlobs ignores all hidden files and returns a list of globs of input list. +// FindAllGlobs returns a list of globs of input list. func FindAllGlobs(paths ...string) ([]string, error) { files := make([]string, 0) for _, p := range paths { @@ -116,15 +115,8 @@ func FindAllGlobs(paths ...string) ([]string, error) { if err != nil { return nil, errors.Errorf("invalid glob %v: %v", path, err) } - for _, f := range globs { - // ignore hidden file. - if strings.HasPrefix(filepath.Base(f), ".") { - console.Verbose(2, "Ignore hidden file '%v'", f) - continue - } - files = append(files, f) - // xxx handle excludeGlobs here - } + files = append(files, globs...) + // xxx handle excludeGlobs here } return files, nil } diff --git a/test/test_utils.sh b/test/test_utils.sh index 65a15448..9b6fe178 100755 --- a/test/test_utils.sh +++ b/test/test_utils.sh @@ -532,7 +532,6 @@ run_all_tests() { $ROOT/test/tests/test_router_cache_invalidation.sh \ $ROOT/test/tests/test_specs/test_spec.sh \ $ROOT/test/tests/test_specs/test_spec_multifile.sh \ - $ROOT/test/tests/test_specs/test_ignore_hidden_file.sh \ $ROOT/test/tests/test_specs/test_spec_merge/test_spec_merge.sh \ $ROOT/test/tests/test_specs/test_spec_archive/test_spec_archive.sh \ $ROOT/test/tests/test_environments/test_tensorflow_serving_env.sh \ diff --git a/test/tests/test_specs/test_ignore_hidden_file.sh b/test/tests/test_specs/test_ignore_hidden_file.sh deleted file mode 100755 index b88ee7ae..00000000 --- a/test/tests/test_specs/test_ignore_hidden_file.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -set -euo pipefail -source $(dirname $0)/../../utils.sh -ROOT=` realpath $(dirname $0)/../../../` -TEST_ID=$(generate_test_id) - -cleanup() { - log "Cleaning up..." - fission spec destroy || true - rm -rf document specs - rm -rf ${TEST_ID} - popd -} - -if [ -z "${TEST_NOCLEANUP:-}" ]; then - trap cleanup EXIT -else - log "TEST_NOCLEANUP is set; not cleaning up test artifacts afterwards." -fi - -tmp_dir="/tmp/test-$TEST_ID" -mkdir -p $tmp_dir - -pushd $tmp_dir - -mkdir -p document -cp $ROOT/examples/nodejs/hello.js document/h1.js -cp $ROOT/examples/nodejs/hello.js document/h2.js - -log "Create hidden file" -touch document/.im_invisible - -log "Create specs" -fission spec init -fission pkg list - -#fission env create --name nodejs --image fission/node-env --period 5 --version 2 --spec -fission pkg create --name nodejs --env nodejs --deploy "document/*" --spec - -log "Apply specs" -fission --verbosity 2 spec apply - -mkdir ${TEST_ID} -fission pkg getdeploy --name nodejs > ${TEST_ID}/a.zip -unzip ${TEST_ID}/a.zip -d ${TEST_ID}/ - -log "Check whether hidden file exists" -if [ -f ${TEST_ID}/.im_invisible ]; -then - log "Found hidden file" - ls -al ${TEST_ID} - exit 1 -fi - -log "Check file amount" -fileamount=$(ls -al ${TEST_ID} | grep -v total | wc -l) -if [ ! ${fileamount} -eq 5 ]; -then - log "File amount incorrect, expect 5" - ls -al ${TEST_ID} - exit 1 -fi - -log "Test PASSED"