Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -e

# make sure script runs from project root directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd -P)"
cd "${PROJECT_ROOT}"

# default to the current user and group
: "${IMAGE_USER_ID:=$(id -u)}"
: "${IMAGE_GROUP_ID:=$(id -g)}"

docker build \
-t cwac \
--build-arg USER_ID="$IMAGE_USER_ID" \
--build-arg GROUP_ID="$IMAGE_GROUP_ID" \
.
20 changes: 20 additions & 0 deletions bin/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -e

# make sure script runs from project root directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd -P)"
cd "${PROJECT_ROOT}"

bin/build

# make sure the "results" directory exists
mkdir -p results

docker run --rm \
--mount 'type=bind,src=./config,dst=/cwac/config' \
--mount 'type=bind,src=./base_urls,dst=/cwac/base_urls' \
--mount 'type=bind,src=./results,dst=/cwac/results' \
--env CHROME_EXTRA_ARGS='--no-sandbox,--disable-dev-shm-usage' \
cwac .venv/bin/python -u cwac.py "${@}"
7 changes: 7 additions & 0 deletions setup.sh → bin/setup
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

set -e

# make sure script runs from project root directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd -P)"
cd "${PROJECT_ROOT}"

# This script (attempts) to set up CWAC automatically.
# Ensure Python 3.12+ is 'python'.

Expand Down
16 changes: 1 addition & 15 deletions tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,4 @@ cat config/config_default.json | jq '
.audit_plugins |= map_values(.enabled = true)
' > config/config_e2e.json

# make sure the "results" directory exists
mkdir -p results

docker build \
--iidfile /tmp/cwac_image_id \
-t cwac-e2e-test-script:latest \
--build-arg USER_ID=$(id -u) \
--build-arg GROUP_ID=$(id -g) \
.
docker run --rm \
--mount "type=bind,src=./config,dst=/cwac/config" \
--mount "type=bind,src=./base_urls,dst=/cwac/base_urls" \
--mount "type=bind,src=./results,dst=/cwac/results" \
-e CHROME_EXTRA_ARGS='--no-sandbox,--disable-dev-shm-usage' \
$(cat /tmp/cwac_image_id) .venv/bin/python -u cwac.py config_e2e.json
bin/run config_e2e.json
Loading