forked from ZupIT/horusec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e:feature - update e2e/analysis tests for build locally (ZupIT#761)
* In older version i found some errors: * The analysis is not effective in check tools runned, because not apply assert in all tools runned by language, then i fixed this; * Occurs when horusec not found files required in project how requirements.txt and others, not exist validation if analysis was been executed with success, then i fixed this; * In older version when run analysis always download all tools from dockerhub, and this not validate if current version is OK for create new release, then was implemented this new test. Note the struct AnalysisTestCase is shared into both tests, then was moved to centralized file. * Another error found was that the error logs presented by the tool were scattered, so we centralized the SetAnalysisError function where, in addition to adding the error in the analysis, it also performs the unified log among all the tools. * An error was found in the language detect package, if the user is using a project with git submodule it was not possible to copy the git folder as it was only a reference so we fixed these problems. * In HCL language it was necessary to change your docker file seen at issue bridgecrewio/checkov#1947 where we found a problem in checkov for alpine version * Was Updated all dockerfiles with image from python fix in version python:3.10.0-alpine3.14 * Was Update dockerfile of Ruby language for usage ruby:2.4.10-alpine base image, because brakeman tool is not suport for newest version of ruby * Was Updated DockerAPI for pass GITHUB_TOKEN env because nancy and others tools use the github api's and get error GitHub rate-limiting on unauthenticated requests Signed-off-by: wilian <[email protected]>
- Loading branch information
1 parent
4a3543a
commit a12a2ed
Showing
48 changed files
with
1,146 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2021 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
IMAGE_BASE_NAME=$1 | ||
IMAGE_TAG=$2 | ||
|
||
setDefaultImageBaseName() { | ||
if [ -z "$IMAGE_BASE_NAME" ]; then | ||
IMAGE_BASE_NAME="local" | ||
fi | ||
if [ -z "$IMAGE_TAG" ]; then | ||
IMAGE_TAG="local" | ||
fi | ||
} | ||
|
||
getDirectoryAndImagesNameByLanguageName() { | ||
# shellcheck disable=SC2044 | ||
for DOCKERFILE in $(find internal -type f -iname "Dockerfile"); do | ||
LANGUAGE=$(echo $DOCKERFILE | cut -d "/" -f4) | ||
if ! docker build -t "$IMAGE_BASE_NAME-$LANGUAGE:$IMAGE_TAG" -f "$DOCKERFILE" .; then | ||
echo "Error on build docker file in path: $DOCKERFILE" | ||
exit 1 | ||
fi | ||
done | ||
} | ||
|
||
setDefaultImageBaseName | ||
|
||
getDirectoryAndImagesNameByLanguageName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.