Skip to content

Commit

Permalink
Adding pipeline files
Browse files Browse the repository at this point in the history
  • Loading branch information
gdesmar committed Nov 4, 2021
1 parent f47ee64 commit a93e06d
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 2 deletions.
5 changes: 3 additions & 2 deletions elf/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def add_sections(self):
res = ResultSection("Sections")
for section in self.elf.sections:
sub_res = ResultSection(f"Section - {section['name']}")
sub_res.add_tag("file.elf.sections.name", section["name"])
if section["name"] != "":
sub_res.add_tag("file.elf.sections.name", section["name"])
sub_res.add_line(f"Type: {section['type']}")
sub_res.add_line(f"Entropy: {section['entropy']}")
if section["entropy"] > 7.5:
Expand All @@ -75,7 +76,7 @@ def add_segments(self):
for segment in self.elf.segments:
sub_res = ResultSection(f"Segment - {segment['type']}")
sub_res.add_line(f"Type: {segment['type']}")
sub_res.add_tag("file.elf.segment.type", segment["type"])
sub_res.add_tag("file.elf.segments.type", segment["type"])
sub_res.add_line(f"Flags: {segment['flags']}")
sub_res.add_line(f"Physical Size: {segment['physical_size']}")
sub_res.add_line(f"Virtual Size: {segment['virtual_size']}")
Expand Down
35 changes: 35 additions & 0 deletions pipelines/azure-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: build

trigger:
tags:
include: ["v*"]
pr: none

pool:
vmImage: "ubuntu-20.04"

stages:
- stage: deploy
jobs:
- job: deploy
displayName: Deploy containers to dockerhub
variables:
- group: deployment-information
steps:
- task: Docker@2
displayName: Login to docker hub
inputs:
command: login
containerRegistry: dockerhub
- script: |
export TAG=${BUILD_SOURCEBRANCH#"refs/tags/v"}
if [[ "$TAG" == *stable* ]]; then export BUILD_TYPE=stable; else export BUILD_TYPE=latest; fi
docker build --build-arg version=$TAG --build-arg branch=$BUILD_TYPE -t cccs/${BUILD_REPOSITORY_NAME##*/}:$TAG -t cccs/${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE -f ./Dockerfile .
displayName: Build containers
- script: |
[ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit
[ -f "$(pwd)/tests/requirements.txt" ] && docker run -v $(pwd)/tests/:/opt/al_service/tests/ cccs/${BUILD_REPOSITORY_NAME##*/}:latest bash -c 'pip install -U -r tests/requirements.txt; pytest -p no:cacheprovider' && exit
docker run -v $(pwd)/tests/:/opt/al_service/tests/ cccs/${BUILD_REPOSITORY_NAME##*/}:latest bash -c 'pytest -p no:cacheprovider'
displayName: Test containers
- script: docker push cccs/${BUILD_REPOSITORY_NAME##*/} --all-tags
displayName: Deploy to Docker Hub
48 changes: 48 additions & 0 deletions pipelines/azure-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: tests

trigger: ["*"]
pr: ["*"]

pool:
vmImage: "ubuntu-20.04"

jobs:
- job: run_test
strategy:
matrix:
python3_7:
python.version: "3.7"
Python3_8:
python.version: "3.8"
Python3_9:
python.version: "3.9"

timeoutInMinutes: 10

steps:
- task: UsePythonVersion@0
displayName: Set python version
inputs:
versionSpec: "$(python.version)"
- script: |
[ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit
sudo apt-get update
sudo apt-get install -y libfuzzy-dev libfuzzy2
if [ -f $(pwd)/pkglist.txt ]; then
sudo apt-get install -y < $(pwd)/pkglist.txt
fi
sudo rm -rf /var/lib/apt/lists/*
sudo env "PATH=$PATH" python -m pip install -U --no-cache-dir assemblyline assemblyline_v4_service
[ -f $(pwd)/requirements.txt ] && sudo env "PATH=$PATH" python -m pip install -U --no-cache-dir -r $(pwd)/requirements.txt
[ -f $(pwd)/tests/requirements.txt ] && sudo env "PATH=$PATH" python -m pip install -U --no-cache-dir -r $(pwd)/tests/requirements.txt
sudo rm -rf /tmp/* /var/lib/apt/lists/* ~/.cache/pip
displayName: Setup environment
- script: |
[ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit
export REPO_NAME=${BUILD_REPOSITORY_NAME##*/}
python -m pytest -p no:cacheprovider --durations=10 -rsx -vv --cov-report=xml --cov=${REPO_NAME/assemblyline-service-/}
displayName: Test
- script: |
[ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit
python -m codecov
displayName: Upload Coverage

0 comments on commit a93e06d

Please sign in to comment.