Skip to content

Commit

Permalink
v2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rl-devops committed Nov 11, 2024
1 parent 705ae9f commit 67bc53c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,5 @@ eicarcom2.zip
2
.envfile
reports/
venv/
vtmp/
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1
FROM rockylinux:9-minimal

# LABEL info from: https://github.com/opencontainers/image-spec/blob/main/annotations.md
Expand All @@ -6,7 +7,11 @@ LABEL org.opencontainers.image.authors=secure.software@reversinglabs.com
LABEL org.opencontainers.image.url=https://www.secure.software/
LABEL org.opencontainers.image.vendor=ReversingLabs

RUN microdnf install -y --nodocs python3-pip && pip3 install requests && microdnf clean all
RUN microdnf install -y --nodocs python3-pip && \
pip3 install requests && \
pip3 uninstall setuptools -y && \
microdnf remove pip -y && \
microdnf clean all

COPY scripts/* /opt/rl-scanner-cloud/

Expand Down
67 changes: 54 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
SHELL := /bin/bash

ifdef DOCKER_TAG
BUILD_VERSION := $(DOCKER_TAG)
else
BUILD_VERSION=latest
endif

# -----------------------------------------------------
# venv stuff to pin a specific python version
# note: pylama breaks on 3.12 if you dont install setuptools
# rockylinux-9 has python 3.9.xx
MIN_PYTHON_VERSION := python3.9
export MIN_PYTHON_VERSION

VENV := ./vtmp/
export VENV

PIP_INSTALL := pip3 -q \
--require-virtualenv \
--disable-pip-version-check \
--no-color install

COMMON_VENV := rm -rf $(VENV); \
$(MIN_PYTHON_VERSION) -m venv $(VENV); \
source ./$(VENV)/bin/activate;

# -----------------------------------------------------
IMAGE_BASE := reversinglabs/rl-scanner-cloud
IMAGE_NAME := $(IMAGE_BASE):$(BUILD_VERSION)

Expand Down Expand Up @@ -46,48 +68,67 @@ TEST_PARAMS_SCAN:= \
--purl $(RL_PACKAGE_URL2) \
--timeout 20 --replace --force

all: prep build test
MYPY_INSTALL := \
types-requests

prep: clean format pycheck mypy
# ======================================
# Rules
# ======================================

all: prep build test $(DIST)

# ==========================
# Code format and verify
# ==========================
prep: clean black pylama mypy

clean:
rm -rf reports tmp input output
rm -rf reports tmp input output $(VENV)
-docker rmi $(IMAGE_NAME)
rm -f $(ARTIFACT_ERR)
rm -rf .mypy_cache */.mypy_cache
mkdir -m 777 -p input output
docker image ls

format: $(SCRIPTS)
black:
$(COMMON_VENV) \
$(PIP_INSTALL) black; \
black \
--line-length $(LINE_LENGTH) \
$(SCRIPTS)

pycheck: $(SCRIPTS)
pylama:
$(COMMON_VENV) \
$(PIP_INSTALL) setuptools pylama; \
pylama \
--max-line-length $(LINE_LENGTH) \
--linters $(PL_LINTERS) \
--ignore $(PL_IGNORE) \
--linters "${PL_LINTERS}" \
--ignore "${PL_IGNORE}" \
$(SCRIPTS)

mypy: $(SCRIPTS)
mypy:
$(COMMON_VENV) \
$(PIP_INSTALL) mypy $(MYPY_INSTALL); \
mypy \
--strict \
--no-incremental \
$(SCRIPTS)

# =============================
# build of reversinglabs/rl-scanner-cloud
# =============================
build:
mkdir -p tmp
docker build -t $(IMAGE_NAME) -f Dockerfile .
docker image ls $(IMAGE_NAME) | tee ./tmp/image_ls.txt
docker image inspect $(IMAGE_NAME) --format '{{ .Config.Labels }}'
docker image inspect $(IMAGE_NAME) --format '{{ .RepoTags }}'

test: testFail test_err_all test_ok_all

test_err_all: test_err test_err_with_report

test_ok_all: test_ok test_ok_with_report
# ==========================
# Testing
# ==========================

test: testFail test_err test_err_with_report test_ok test_ok_with_report

./input/$(ARTIFACT_ERR):
mkdir -m 777 -p input output
Expand Down

0 comments on commit 67bc53c

Please sign in to comment.