Compare commits
	
		
			1 Commits
		
	
	
		
			testing
			...
			dockerbox_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 533dd40722 | 
							
								
								
									
										28
									
								
								.github/workflows/vagrant.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/vagrant.yml
									
									
									
									
										vendored
									
									
								
							| @@ -8,17 +8,11 @@ on: | ||||
|  | ||||
| jobs: | ||||
|   homelab-ci: | ||||
|     runs-on: macos-13 | ||||
|     runs-on: macos-latest | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|  | ||||
|       - name: Setup tmate session | ||||
|         uses: mxschmitt/action-tmate@v3 | ||||
|         with: | ||||
|           detached: true | ||||
|           limit-access-to-actor: true | ||||
|  | ||||
|       - name: Cache Vagrant boxes | ||||
|         uses: actions/cache@v3 | ||||
|         with: | ||||
| @@ -27,23 +21,19 @@ jobs: | ||||
|           restore-keys: | | ||||
|             ${{ runner.os }}-vagrant- | ||||
|  | ||||
|       - name: Install Tools | ||||
|         run: brew install nmap tree | ||||
|  | ||||
|       - name: Install VirtualBox | ||||
|         run: brew install --cask virtualbox | ||||
|  | ||||
|       - name: Install Vagrant | ||||
|         run: brew install --cask vagrant | ||||
|  | ||||
|       - name: Install Ansible | ||||
|         run: brew install ansible | ||||
|         run: brew install ansible@7 | ||||
|  | ||||
|       - name: Software Versions | ||||
|         run: | | ||||
|           printf "VirtualBox "; vboxmanage --version | ||||
|           printf "VirtualBox " | ||||
|           vboxmanage --version | ||||
|           vagrant --version | ||||
|           export PATH="/usr/local/opt/ansible@7/bin:$PATH" | ||||
|           ansible --version | ||||
|  | ||||
|       - name: Vagrant Up with Dockerbox Playbook | ||||
|         run: ./scripts/github-vagrant.sh | ||||
|         run: | | ||||
|           export PATH="/usr/local/opt/ansible@7/bin:$PATH" | ||||
|           PLAYBOOK=dockerbox vagrant up | ||||
|           vagrant ssh -c "docker ps" | ||||
|   | ||||
							
								
								
									
										3
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
								
							| @@ -36,7 +36,6 @@ Vagrant.configure("2") do |config| | ||||
|   config.vm.provider :virtualbox do |vbox| | ||||
|     vbox.cpus   = VAGRANT_CPUS | ||||
|     vbox.memory = VAGRANT_MEM | ||||
|     vbox.gui    = true | ||||
|   end | ||||
|  | ||||
|   # Provision with Ansible | ||||
| @@ -44,6 +43,6 @@ Vagrant.configure("2") do |config| | ||||
|     ENV['ANSIBLE_ROLES_PATH'] = File.dirname(__FILE__) + "/roles" | ||||
|     ansible.compatibility_mode = "2.0" | ||||
|     ansible.playbook = "dev/" + PLAYBOOK + ".yml" | ||||
|     ansible.raw_arguments = ["--diff", "-vvvv"] | ||||
|     ansible.raw_arguments = ["--diff"] | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -33,7 +33,7 @@ docker_compose_deploy: | ||||
|   # Nextcloud | ||||
|   - name: nextcloud | ||||
|     url: https://github.com/krislamo/nextcloud | ||||
|     version: fe6d349749f178e91ae7ff726d557f48ebf84356 | ||||
|     version: 0abc5cc6ba64ed94b7ddc6fd934f0fd62b8a6d11 | ||||
|     env: | ||||
|       DATA: ./data | ||||
|  | ||||
|   | ||||
| @@ -1,45 +0,0 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # Defaults | ||||
| TIMEOUT=600 | ||||
| ELAPSED=0 | ||||
| INITIAL_SLEEP=60 | ||||
| SLEEP_DURATION=30 | ||||
| SSH_AVAILABLE=0 | ||||
| DEBUG_ID="[homelab-ci]" | ||||
|  | ||||
| # Run Vagrant Up in the background | ||||
| PLAYBOOK=dockerbox vagrant up & | ||||
| VAGRANT_UP_PID=$! | ||||
|  | ||||
| # Initial delay | ||||
| echo "$DEBUG_ID Waiting for VM to start..." | ||||
| sleep $INITIAL_SLEEP | ||||
|  | ||||
| # Loop until timeout or breaks | ||||
| while [[ $ELAPSED -lt $TIMEOUT ]]; do | ||||
| 	VAGRANT_SSH_CONFIG=$(mktemp) | ||||
| 	vagrant ssh-config > "$VAGRANT_SSH_CONFIG" | ||||
| 	echo "$DEBUG_ID SSH config at $VAGRANT_SSH_CONFIG" | ||||
| 	cat "$VAGRANT_SSH_CONFIG" | ||||
| 	echo "$DEBUG_ID Vagrant status" | ||||
| 	vagrant status | ||||
|  | ||||
| 	# SSH attempt | ||||
| 	set -x | ||||
| 	ssh -vvv -F "$VAGRANT_SSH_CONFIG" default 'cat /etc/os-release' && set +x; break \ | ||||
| 	|| echo "$DEBUG_ID SSH connection failed, retrying in $SLEEP_DURATION seconds..." | ||||
| 	set +x | ||||
|  | ||||
| 	# Sleep and start again | ||||
| 	sleep $SLEEP_DURATION | ||||
| 	((ELAPSED+=SLEEP_DURATION)) | ||||
| done | ||||
|  | ||||
| # Success? | ||||
| if [[ $SSH_AVAILABLE -ne 1 ]]; then | ||||
| 	echo "$DEBUG_ID Timeout reached without successful SSH connection." | ||||
| fi | ||||
|  | ||||
| # Ensure the Vagrant up process completes | ||||
| wait $VAGRANT_UP_PID | ||||
		Reference in New Issue
	
	Block a user