- Create specialized toolbox container for auditing Docker images and related files - Include essential QA tools: Hadolint, Dive, ShellCheck, Trivy, Dockle, Docker client, Node.js - Implement comprehensive build, run, release, and test scripts - Add detailed documentation with usage examples - Ensure all tools work correctly within the container - Rename directory from toolbox-QADocker to toolbox-qadocker for consistency - Update QWEN.md with comprehensive QA workflow using toolbox-qadocker - Add mandatory pre-build audit process using QA tools - Add validation process for testing from inside container environment - Add comprehensive testing to verify all tools are working - Optimize Dockerfile for best practices and security - Ensure container runs as non-root user for security - Add release script for versioned releases to registry - Add test script to verify all tools are working correctly
52 lines
1.2 KiB
Bash
Executable File
52 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Test script for toolbox-qadocker
|
|
set -e
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Print colored output
|
|
print_status() {
|
|
echo -e "${GREEN}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
}
|
|
|
|
print_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1"
|
|
}
|
|
|
|
print_status "Testing all installed QA tools in toolbox-QADocker:"
|
|
|
|
print_status "1. Testing Hadolint (Dockerfile linter)..."
|
|
echo "FROM ubuntu:24.04
|
|
RUN apt-get update
|
|
RUN apt-get install -y curl" > /tmp/test.Dockerfile
|
|
hadolint /tmp/test.Dockerfile || echo "Hadolint found issues (expected in test file)"
|
|
|
|
print_status "2. Testing ShellCheck (shell script linter)..."
|
|
echo '#!/bin/bash
|
|
var=hello
|
|
echo $var' > /tmp/test.sh
|
|
chmod +x /tmp/test.sh
|
|
shellcheck /tmp/test.sh || echo "ShellCheck found issues (expected in test file)"
|
|
|
|
print_status "3. Testing Trivy (vulnerability scanner)..."
|
|
trivy --version
|
|
|
|
print_status "4. Testing Dockle (container linter)..."
|
|
dockle --version
|
|
|
|
print_status "5. Testing Docker client..."
|
|
docker --version
|
|
|
|
print_status "6. Testing Node.js..."
|
|
node --version
|
|
|
|
print_status "All tools are properly installed and functional!" |