Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: João Reigota <[email protected]>
  • Loading branch information
cx-joao-reigota committed Jan 18, 2022
1 parent 5959204 commit 6a85d2f
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 438 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: golangci/[email protected]
with:
version: v1.37
args: -c .golangci.yml --timeout 5m
args: -c .golangci.yml --timeout 10m
skip-go-installation: true
go-generate:
name: go-generate
Expand Down
17 changes: 7 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,13 @@ HEALTHCHECK CMD wget -q --method=HEAD localhost/system-status.txt
FROM alpine:3.14.3

# Install Terraform and Terraform plugins
RUN wget https://releases.hashicorp.com/terraform/1.1.3/terraform_1.1.3_linux_amd64.zip
RUN unzip terraform_1.1.3_linux_amd64.zip && rm terraform_1.1.3_linux_amd64.zip
RUN mv terraform /usr/bin/terraform

RUN wget https://releases.hashicorp.com/terraform-provider-aws/3.72.0/terraform-provider-aws_3.72.0_linux_amd64.zip
RUN unzip terraform-provider-aws_3.72.0_linux_amd64.zip && rm terraform-provider-aws_3.72.0_linux_amd64.zip
RUN mkdir ~/.terraform.d && mkdir ~/.terraform.d/plugins && mkdir ~/.terraform.d/plugins/linux_amd64 && mv terraform-provider-aws_v3.72.0_x5 ~/.terraform.d/plugins/linux_amd64

# Install Git
RUN apk add --no-cache \
RUN wget https://releases.hashicorp.com/terraform/1.1.3/terraform_1.1.3_linux_amd64.zip \
&& unzip terraform_1.1.3_linux_amd64.zip && rm terraform_1.1.3_linux_amd64.zip \
&& mv terraform /usr/bin/terraform \
&& wget https://releases.hashicorp.com/terraform-provider-aws/3.72.0/terraform-provider-aws_3.72.0_linux_amd64.zip \
&& unzip terraform-provider-aws_3.72.0_linux_amd64.zip && rm terraform-provider-aws_3.72.0_linux_amd64.zip \
&& mkdir ~/.terraform.d && mkdir ~/.terraform.d/plugins && mkdir ~/.terraform.d/plugins/linux_amd64 && mv terraform-provider-aws_v3.72.0_x5 ~/.terraform.d/plugins/linux_amd64 \
&& apk add --no-cache \
git=2.32.0-r0

# Copy built binary to the runtime container
Expand Down
8 changes: 5 additions & 3 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Integrate KICS with:
- [TeamCity](integrations_teamcity.md)
- [Travis](integrations_travisci.md)
- [Pre-commit hooks](integrations_pre_commit.md)
- [Terraform Cloud](integration_tfcloud)
- [Terraformer](integrations_terraformer.md)
- More soon...

The pipelines examples can be found in our [GitHub Repository](https://github.com/Checkmarx/kics/tree/master/examples)
Expand All @@ -26,9 +28,9 @@ KICS is natively embedded in [MegaLinter](https://megalinter.github.io/), a 100%

- 48 languages
- 22 formats
- 20 tooling formats
- excessive copy-pastes and spelling mistakes
- 20 tooling formats
- excessive copy-pastes and spelling mistakes

It also generates various reports, and can apply formatting and auto-fixes, to ensure all your projects sources are clean, whatever IDE/toolbox are used by their developers.

To install MegaLinter in your repository, just run the following command
Expand Down
377 changes: 4 additions & 373 deletions go.mod

Large diffs are not rendered by default.

96 changes: 80 additions & 16 deletions go.sum

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions pkg/scan/path_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func resolvePath(flagContent, flagName string) (string, error) {
// and which files should be ignored, it then updates the types and exclude flags variables
// with the results found
func analyzePaths(paths, types, exclude []string) (model.AnalyzedPaths, error) {
exc := make([]string, 0)
var err error
var pathsFlag model.AnalyzedPaths
excluded := make([]string, 0)
Expand All @@ -146,9 +145,11 @@ func analyzePaths(paths, types, exclude []string) (model.AnalyzedPaths, error) {
return model.AnalyzedPaths{}, err
}
logLoadingQueriesType(pathsFlag.Types)
} else {
pathsFlag.Types = append(pathsFlag.Types, types...)
}
excluded = append(excluded, exclude...)
excluded = append(excluded, exc...)
excluded = append(excluded, pathsFlag.Exc...)
pathsFlag.Exc = excluded
return pathsFlag, nil
}
Expand All @@ -175,7 +176,7 @@ func extractPathType(paths []string) (regular, terraformer []string) {

func deleteExtractionFolder(extractionMap map[string]model.ExtractedPathObject) {
for extractionFile := range extractionMap {
err := os.Remove(extractionFile)
err := os.RemoveAll(extractionFile)
if err != nil {
log.Err(err).Msg("Failed to delete KICS extraction folder")
}
Expand Down
32 changes: 0 additions & 32 deletions pkg/terraformer/terraformer_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package terraformer

import (
"os"
"path/filepath"
"reflect"
"testing"

"github.com/Checkmarx/kics/pkg/terraformer/aws"
importer "github.com/GoogleCloudPlatform/terraformer/cmd"
"github.com/GoogleCloudPlatform/terraformer/terraformutils"
"github.com/stretchr/testify/require"
)

func TestPath_createTfOptions(t *testing.T) {
Expand Down Expand Up @@ -121,33 +119,3 @@ func TestImport(t *testing.T) {
})
}
}

func Test_cleanUnwantedFiles(t *testing.T) {
type args struct {
destination string
}
tests := []struct {
name string
args args
}{
{
name: "test cleanUnwantedFiles",
args: args{
destination: "destination",
},
},
}
for _, tt := range tests {
err := os.Mkdir(tt.args.destination, 0777)
require.NoError(t, err)
_, errOut := os.Create(filepath.Join(tt.args.destination, "outputs.tf"))
require.NoError(t, errOut)
defer func() {
err := os.RemoveAll(tt.args.destination)
require.NoError(t, err)
}()
t.Run(tt.name, func(t *testing.T) {
cleanUnwantedFiles(tt.args.destination)
})
}
}

0 comments on commit 6a85d2f

Please sign in to comment.