algo/tests/legacy-lxd/cloud-init.sh
Dan Guido cddb5df395
Add comprehensive pre-commit hooks for code quality (#14831)
* Add comprehensive pre-commit hooks for code quality

- Set up pre-commit framework with hooks for Python, YAML, Ansible, and shell
- Configure ruff for Python linting and formatting
- Add yamllint for YAML validation
- Include ansible-lint and syntax checks
- Add shellcheck for shell scripts
- Create development documentation
- Auto-fix trailing whitespace and file endings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant DEVELOPMENT.md and update CONTRIBUTING.md

- Removed docs/DEVELOPMENT.md as it was redundant with existing documentation
- Added pre-commit hooks setup instruction to CONTRIBUTING.md for contributors
- Consolidated development guidance into a single location

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-15 10:03:46 -04:00

46 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# Use environment variables or defaults
REPO=${REPOSITORY:-trailofbits/algo}
BRANCH_NAME=${BRANCH:-master}
cat << EOF
#cloud-config
# Disable automatic package updates to avoid APT lock conflicts
package_update: false
package_upgrade: false
runcmd:
- |
#!/bin/bash
set -ex
# Wait for any running apt processes to finish
while fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 || fuser /var/lib/apt/lists/lock >/dev/null 2>&1; do
echo "Waiting for apt locks to be released..."
sleep 5
done
# Fix DNS resolution
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 1.1.1.1" >> /etc/resolv.conf
echo "127.0.0.1 algo" >> /etc/hosts
# Update packages manually after ensuring no locks
apt-get update || true
apt-get upgrade -y || true
export METHOD=local
export ONDEMAND_CELLULAR=true
export ONDEMAND_WIFI=true
export ONDEMAND_WIFI_EXCLUDE=test1,test2
export STORE_PKI=true
export DNS_ADBLOCKING=true
export SSH_TUNNELING=true
export ENDPOINT=10.0.8.100
export USERS=desktop,user1,user2
export EXTRA_VARS='install_headers=false tests=true local_service_ip=172.16.0.1'
export ANSIBLE_EXTRA_ARGS=''
export REPO_SLUG=${REPO}
export REPO_BRANCH=${BRANCH_NAME}
curl -s https://raw.githubusercontent.com/${REPO}/${BRANCH_NAME}/install.sh | sudo -E bash -x
EOF