1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-13 08:59:44 +01:00
This commit is contained in:
camer0n 2024-12-18 11:32:43 -08:00
parent 18a58c3ac8
commit 5156628e7e

View File

@ -11,9 +11,8 @@ jobs:
- image: docker.io/jrei/systemd-ubuntu:22.04
runs-on: ubuntu-latest
steps:
- name: Install host-level tools
- name: Replace Docker with Podman Rootless
run: |
sudo apt-get update && sudo apt-get install -y iputils-ping curl
sudo apt-get -o Dpkg::Options::="--force-overwrite" install -y podman
echo -e "export XDG_RUNTIME_DIR=/tmp/${RUNNER_TEMP}" >> $GITHUB_ENV
echo -e "export XDG_DATA_HOME=/tmp/${RUNNER_TEMP}" >> $GITHUB_ENV
@ -26,64 +25,16 @@ jobs:
run: CGO_ENABLED=0 go build -ldflags "-s -w" -o ./salt-bootstrap salt-bootstrap.go
working-directory: ./e107_tests/lib/ci/salt/
- name: Launch test container
run: |
docker run -d --rm --name target -v .:/app/ ${{ matrix.operating_system.image }} tail -f /dev/null
docker exec target apt-get update && docker exec target apt-get install -y iputils-ping curl dnsutils
sleep 5
if ! docker ps | grep -q target; then
docker logs target
exit 1
fi
- name: Debug Network Connectivity
run: |
echo "Testing DNS resolution..."
nslookup google.com || echo "DNS resolution failed"
echo "Testing HTTP connectivity..."
curl -IL https://google.com || echo "HTTP connectivity failed"
run: docker run -d -it --rm --name target -v .:/app/ ${{ matrix.operating_system.image }}
- name: Install SaltStack
run: |
echo "Validating host network connectivity..."
echo "Testing HTTP connectivity..."
curl -Is https://google.com | head -n 1 || echo "HTTP connectivity failed"
echo "Checking file permissions..."
docker exec target ls -l /app/e107_tests/lib/ci/salt/ > salt_file_permissions.log || echo "Error: Failed to list file permissions"
echo "Validating internet access inside the container..."
echo "Testing DNS resolution inside container..."
docker exec target nslookup google.com || echo "DNS resolution failed inside container"
echo "Testing HTTP connectivity inside container..."
docker exec target curl -Is https://google.com | head -n 1 || echo "HTTP connectivity failed inside container"
echo "Debugging SaltStack script path..."
docker exec target ls -l /app/e107_tests/lib/ci/salt/ || echo "SaltStack script path missing"
docker exec target cat /app/e107_tests/lib/ci/salt/salt-bootstrap || echo "SaltStack bootstrap script missing"
echo "Checking ELF binary architecture..."
docker exec target file /app/e107_tests/lib/ci/salt/salt-bootstrap
docker exec target file /app/e107_tests/lib/ci/salt/salt-bootstrap
docker exec target chmod +x /app/e107_tests/lib/ci/salt/salt-bootstrap || echo "Failed to set execute permissions for SaltStack script"
if ! docker exec target test -x /app/e107_tests/lib/ci/salt/salt-bootstrap; then
echo "SaltStack script is not executable, trying to fix permissions..."
docker exec target chmod +x /app/e107_tests/lib/ci/salt/salt-bootstrap || echo "Error: Failed to set permissions for SaltStack script"
fi
echo "Testing SaltStack bootstrap binary execution..."
docker exec target /app/e107_tests/lib/ci/salt/salt-bootstrap onedir > salt-bootstrap.log 2>&1 || echo "Error executing SaltStack bootstrap"
docker exec target /app/e107_tests/lib/ci/salt/salt-bootstrap --help || echo "Binary failed to execute"
docker exec target /app/e107_tests/lib/ci/salt/salt-bootstrap --version || echo "Failed to obtain version info"
docker exec target /app/e107_tests/lib/ci/salt/salt-bootstrap --help || echo "Binary execution failed"
echo "Fetching container logs after script execution..."
docker exec target /app/e107_tests/lib/ci/salt/salt-bootstrap onedir || echo "Error: SaltStack bootstrap script failed"
echo "Fetching container logs after script execution..."
docker logs target > salt_container_logs_after.log
run: docker exec target /app/e107_tests/lib/ci/salt/salt-bootstrap onedir
- name: Apply Salt state
run: |
echo "Debugging file structure and permissions inside container..."
docker exec target ls -l /app/e107_tests/lib/ci/salt/ > debug_permissions.log
ln -v -s master minion
rm -fv pillars/config.sls
touch pillars/config.sls
rm -fv pillars/config-sample.sls
touch pillars/config-sample.sls
echo "Ensuring pillar files have correct permissions..."
docker exec target chmod 644 /app/e107_tests/lib/ci/salt/pillars/* || echo "Error: Could not set permissions for pillar files"
ln -v -s -f ../../config.acceptance.ci.yml pillars/config-local.sls
docker exec -w /app/e107_tests/lib/ci/salt/ target /bin/sh -c "
salt-call -c ./ --id=e107-dev --local state.apply e107-dev ||