mirror of
https://github.com/BastilleBSD/templates.git
synced 2025-12-10 17:00:30 +01:00
Testnginx (#10)
* nginx test 1 * nginx test 2 * nginx test 3 * nginx test 4 * nginx test 5 * nginx test 6 * nginx test 7 * nginx test 8 * nginx test 9 * nginx test 10 * nginx test 11 * nginx test 12 * nginx test 13 * nginx test 14 * nginx test 15 * nginx test 16 * nginx test 17 * nginx test 18 * nginx test 19 * nginx test 20 * nginx test 21 * nginx test 22 * nginx test 23 * nginx test 24 * nginx test 25 * nginx test 26 * nginx test 27 * nginx test 28 * rdr fixes * start of haproxy test 1 * test 29 * test 30 * test 31 * nginx status * added service check * added service check 2 * added service check 3 * added service check 4 * added service check 5 * completed nginx check --------- Co-authored-by: Barry McCormick <bmccormick@debianbeast.maildragon.com>
This commit is contained in:
21
.cirrus.yml
21
.cirrus.yml
@@ -10,32 +10,35 @@ task:
|
|||||||
show_build_trigger: echo $BRANCH
|
show_build_trigger: echo $BRANCH
|
||||||
script:
|
script:
|
||||||
- echo "branch is $BRANCH"
|
- echo "branch is $BRANCH"
|
||||||
- pkg install -y git
|
- pkg install -y git curl
|
||||||
|
- echo 'pf_enable="YES"' >> /etc/rc.conf
|
||||||
- git clone https://github.com/BastilleBSD/bastille.git
|
- git clone https://github.com/BastilleBSD/bastille.git
|
||||||
- cd bastille
|
- cd bastille
|
||||||
- make install
|
- make install
|
||||||
- cd /usr/local/etc/bastille
|
- cd /usr/local/etc/bastille
|
||||||
- cp bastille.conf.sample bastille.conf
|
- cp bastille.conf.sample bastille.conf
|
||||||
- bastille setup
|
- bastille setup
|
||||||
- bastille bootstrap 13.2-RELEASE
|
- service pf start
|
||||||
- bastille create testrun 13.2-RELEASE 10.0.0.1
|
- service pf status
|
||||||
- bastille list
|
|
||||||
- git clone https://github.com/BastilleBSD/templates.git
|
- git clone https://github.com/BastilleBSD/templates.git
|
||||||
|
- bastille bootstrap 13.2-RELEASE
|
||||||
|
- bastille create testrun 13.2-RELEASE 10.17.89.66
|
||||||
|
- bastille list
|
||||||
- cd templates
|
- cd templates
|
||||||
- echo " branch is $BRANCH "
|
- echo " branch is $BRANCH "
|
||||||
- git checkout $BRANCH
|
- git checkout $BRANCH
|
||||||
- git diff --dirstat origin/cicd..cicd ./*
|
- git branch
|
||||||
- git diff --dirstat main..$BRANCH ./* >> diff.txt
|
- echo "GHSHA is $GHSHA"
|
||||||
|
- git diff --dirstat $BRANCH..main ./*
|
||||||
|
- git diff --dirstat $BRANCH..main ./* > diff.txt
|
||||||
- echo "*** diff.txt ***"
|
- echo "*** diff.txt ***"
|
||||||
- cat diff.txt
|
- cat diff.txt
|
||||||
- # Use sed to remove characters before the match pattern
|
- # Use sed to remove characters before the match pattern
|
||||||
- match_pattern=" "
|
- sed 's/.* //' diff.txt > changed.txt
|
||||||
- sed "s/*$match_pattern/$match_pattern/" "diff.txt" >> changed.txt
|
|
||||||
- echo "*** changed.txt ***"
|
- echo "*** changed.txt ***"
|
||||||
- cat changed.txt
|
- cat changed.txt
|
||||||
- read -r CHDIR <"changed.txt"
|
- read -r CHDIR <"changed.txt"
|
||||||
- echo $CHDIR
|
- echo $CHDIR
|
||||||
- bastille template testrun $CHDIR
|
|
||||||
- cd $CHDIR
|
- cd $CHDIR
|
||||||
- pwd
|
- pwd
|
||||||
- chmod +x ./test.sh
|
- chmod +x ./test.sh
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
misc/temp/
|
|
||||||
23
test.sh
23
test.sh
@@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
git rev-parse --abbrev-ref HEAD > branch.txt
|
|
||||||
read -r BRANCH <"branch.txt"
|
|
||||||
echo $BRANCH
|
|
||||||
rm branch.txt
|
|
||||||
|
|
||||||
git diff --dirstat main $BRANCH ./* > diff.txt
|
|
||||||
echo "*** diff.txt ***"
|
|
||||||
cat diff.txt
|
|
||||||
|
|
||||||
# Use sed to remove characters before the match pattern
|
|
||||||
match_pattern=' '
|
|
||||||
sed "s/.*$match_pattern/$match_pattern/" "diff.txt" > changed.txt
|
|
||||||
|
|
||||||
echo "*** changed.txt ***"
|
|
||||||
cat changed.txt
|
|
||||||
|
|
||||||
read -r CHDIR <"changed.txt"
|
|
||||||
echo $CHDIR
|
|
||||||
|
|
||||||
cd $CHDIR
|
|
||||||
pwd
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# .cirrus.yml:
|
|
||||||
compute_engine_instance:
|
|
||||||
# Image list available via
|
|
||||||
# gcloud compute images list --project freebsd-org-cloud-dev --no-standard-images
|
|
||||||
platform: freebsd
|
|
||||||
image_project: freebsd-org-cloud-dev
|
|
||||||
image: freebsd-13-2-release-amd64
|
|
||||||
cpu: 1
|
|
||||||
memory: 2G
|
|
||||||
disk: 10
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
task:
|
|
||||||
webserver_tests:
|
|
||||||
description: Test the web server
|
|
||||||
freebsd:
|
|
||||||
- pkg install -y curl wget # Install required tools (for FreeBSD)
|
|
||||||
script:
|
|
||||||
- curl -Is http://localhost:8080/ | grep "HTTP/1.1 200 OK" # Example test with curl
|
|
||||||
- wget --spider http://localhost:8080/ # Example test with wget
|
|
||||||
@@ -1,11 +1,28 @@
|
|||||||
#!/bin/sh
|
echo "starting test script"
|
||||||
|
cd ../../
|
||||||
|
pwd
|
||||||
|
bastille template testrun www/nginx
|
||||||
|
echo "template applied"
|
||||||
|
bastille cmd testrun service nginx status
|
||||||
|
bastille rdr testrun tcp 80 80
|
||||||
|
bastille rdr testrun list
|
||||||
|
ifconfig
|
||||||
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80)
|
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80)
|
||||||
|
echo "tested response"
|
||||||
|
echo "response is:" $response
|
||||||
|
|
||||||
|
service_name="nginx"
|
||||||
|
jail_name="testrun"
|
||||||
|
|
||||||
|
service_status=$(jexec testrun service $service_name status)
|
||||||
|
|
||||||
|
# Check the service status and provide appropriate output
|
||||||
|
if echo "$service_status" | grep -q "is running"; then
|
||||||
|
echo "$service_name is running in jail $jail_name."
|
||||||
|
else
|
||||||
|
echo "$service_name is not running in jail $jail_name."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check if the response code is 200 (OK)
|
|
||||||
- if [ "$response" -eq 200 ]; then
|
|
||||||
echo "Web server is responding with HTTP 200 OK.";
|
|
||||||
else
|
|
||||||
echo "Web server is not responding with HTTP 200 OK. Response code: $response";
|
|
||||||
exit 1; # Exit with an error status
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user