Skip to content

Commit

Permalink
fix(core): Corrected bug that does not accepts folders name with dots
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Avelar <[email protected]>
  • Loading branch information
felipe-avelar committed Jun 29, 2021
1 parent 27ac5c3 commit 9ceac33
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/go-ci-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Run docker image and generate results.json
run: |
docker run -v ${PWD}/assets/queries:/path \
kics:${{ github.sha }} scan --silent --ignore-on-exit "results" --log-level DEBUG --log-file --log-path "/path/info.log" -p "/path" -o "/path/results.json"
kics:${{ github.sha }} scan --silent --ignore-on-exit "results" --log-level DEBUG --log-file --log-path "/path/info.log" -p "/path" -o "/path/results"
- name: Archive test logs
uses: actions/upload-artifact@v2
if: always()
Expand All @@ -59,32 +59,32 @@ jobs:
path: assets/queries/info.log
- name: Display results
run: |
cat ${PWD}/assets/queries/results.json
cat ${PWD}/assets/queries/results/results.json
- name: Archive test results
uses: actions/upload-artifact@v2
with:
name: integration-results-${{ github.event.pull_request.head.sha }}
path: assets/queries/results.json
path: assets/queries/results/results.json
- name: Assert results.json
run: |
set -eo pipefail
COUNT=$(jq '.queries_total' ${PWD}/assets/queries/results.json)
COUNT=$(jq '.queries_total' ${PWD}/assets/queries/results/results.json)
echo "Assert queries_total > 0 in results.json :: ${COUNT}"
echo $COUNT | xargs -i{} test {} -gt 0
COUNT=$(jq '.total_counter' ${PWD}/assets/queries/results.json)
COUNT=$(jq '.total_counter' ${PWD}/assets/queries/results/results.json)
echo "Assert total_counter > 0 in results.json :: ${COUNT}"
echo $COUNT | xargs -i{} test {} -gt 0
COUNT=$(jq '.files_scanned' ${PWD}/assets/queries/results.json)
COUNT=$(jq '.files_scanned' ${PWD}/assets/queries/results/results.json)
echo "Assert files_scanned > 0 in results.json :: ${COUNT}"
echo $COUNT | xargs -i{} test {} -gt 0
COUNT=$(jq '.queries_failed_to_execute' ${PWD}/assets/queries/results.json)
COUNT=$(jq '.queries_failed_to_execute' ${PWD}/assets/queries/results/results.json)
echo "Assert queries_failed_to_execute == 0 in results.json :: ${COUNT}"
echo $COUNT | xargs -i{} test {} -eq 0
COUNT=$(jq '.files_failed_to_scan' ${PWD}/assets/queries/results.json)
COUNT=$(jq '.files_failed_to_scan' ${PWD}/assets/queries/results/results.json)
echo "Assert files_failed_to_scan == 0 in results.json :: ${COUNT}"
echo $COUNT | xargs -i{} test {} -eq 0
2 changes: 1 addition & 1 deletion internal/console/kics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestConsole_Execute(t *testing.T) { //nolint
t.Errorf("failed to get current dir, %v", err)
}
if tt.remove != "" {
err = os.Remove(filepath.Join(currentWorkDir, tt.remove))
err = os.RemoveAll(filepath.Join(currentWorkDir, tt.remove))
if err != nil {
t.Errorf("failed to remove file: %v, %v", tt.remove, err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/console/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func run(cmd *cobra.Command) error {
}
outputName = filepath.Base(outputName)
if filepath.Ext(outputPath) != "" {
outputPath = filepath.Dir(outputPath)
outputPath = filepath.Join(outputPath, string(os.PathSeparator))
}
if err := os.MkdirAll(outputPath, os.ModePerm); err != nil {
return err
Expand Down

0 comments on commit 9ceac33

Please sign in to comment.