add branch validation to queue
This commit is contained in:
@@ -3,6 +3,7 @@ SECRET_KEY=change_this_secret_key_in_production
|
||||
FLASK_ENV=production
|
||||
|
||||
# SSH Configuration for Git operations
|
||||
SSH_PASSWORD=your_ssh_password_here
|
||||
SSH_HOST=asfserver
|
||||
SSH_PASSWORD=ASF
|
||||
SSH_HOST=asf-server.duckdns.org
|
||||
SSH_USER=asf
|
||||
SSH_PORT=49152
|
||||
@@ -24,17 +24,23 @@ def debug_ssh_test():
|
||||
ssh_password = os.environ.get('SSH_PASSWORD', 'default_password')
|
||||
ssh_host = os.environ.get('SSH_HOST', 'remote_host')
|
||||
ssh_user = os.environ.get('SSH_USER', 'asf')
|
||||
ssh_port = os.environ.get('SSH_PORT', '22')
|
||||
|
||||
# SSH options for better connectivity
|
||||
ssh_options = f"-p {ssh_port} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
|
||||
# Test basic SSH connectivity
|
||||
test_cmd = f"sshpass -p '{ssh_password}' ssh -o StrictHostKeyChecking=no {ssh_user}@{ssh_host} 'echo SSH_CONNECTION_SUCCESS'"
|
||||
test_cmd = f"sshpass -p '{ssh_password}' ssh {ssh_options} {ssh_user}@{ssh_host} 'echo SSH_CONNECTION_SUCCESS'"
|
||||
result = subprocess.run(test_cmd, shell=True, capture_output=True, text=True, timeout=30)
|
||||
|
||||
return jsonify({
|
||||
'ssh_config': {
|
||||
'user': ssh_user,
|
||||
'host': ssh_host,
|
||||
'port': ssh_port,
|
||||
'password_set': bool(ssh_password and ssh_password != 'default_password')
|
||||
},
|
||||
'command_executed': test_cmd.replace(ssh_password, '***'),
|
||||
'test_result': {
|
||||
'returncode': result.returncode,
|
||||
'stdout': result.stdout,
|
||||
@@ -67,12 +73,16 @@ def submit_step1():
|
||||
ssh_password = os.environ.get('SSH_PASSWORD', 'default_password')
|
||||
ssh_host = os.environ.get('SSH_HOST', 'remote_host')
|
||||
ssh_user = os.environ.get('SSH_USER', 'asf')
|
||||
ssh_port = os.environ.get('SSH_PORT', '22')
|
||||
|
||||
print(f"[DEBUG] Starting branch validation for: {branch_name}")
|
||||
print(f"[DEBUG] SSH Config - User: {ssh_user}, Host: {ssh_host}")
|
||||
print(f"[DEBUG] SSH Config - User: {ssh_user}, Host: {ssh_host}, Port: {ssh_port}")
|
||||
|
||||
# SSH options for better connectivity
|
||||
ssh_options = f"-p {ssh_port} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
|
||||
# First, clone the repository
|
||||
clone_cmd = f"sshpass -p '{ssh_password}' ssh -o StrictHostKeyChecking=no {ssh_user}@{ssh_host} './TPF/gitea_repo_controller.sh clone'"
|
||||
clone_cmd = f"sshpass -p '{ssh_password}' ssh {ssh_options} {ssh_user}@{ssh_host} './TPF/gitea_repo_controller.sh clone'"
|
||||
print(f"[DEBUG] Executing clone command: {clone_cmd.replace(ssh_password, '***')}")
|
||||
|
||||
clone_result = subprocess.run(clone_cmd, shell=True, capture_output=True, text=True, timeout=60)
|
||||
@@ -82,7 +92,7 @@ def submit_step1():
|
||||
print(f"[DEBUG] Clone stderr: {clone_result.stderr}")
|
||||
|
||||
# Then, checkout the branch
|
||||
checkout_cmd = f"sshpass -p '{ssh_password}' ssh -o StrictHostKeyChecking=no {ssh_user}@{ssh_host} './TPF/gitea_repo_controller.sh checkout {branch_name}'"
|
||||
checkout_cmd = f"sshpass -p '{ssh_password}' ssh {ssh_options} {ssh_user}@{ssh_host} './TPF/gitea_repo_controller.sh checkout {branch_name}'"
|
||||
print(f"[DEBUG] Executing checkout command: {checkout_cmd.replace(ssh_password, '***')}")
|
||||
|
||||
checkout_result = subprocess.run(checkout_cmd, shell=True, capture_output=True, text=True, timeout=60)
|
||||
|
||||
@@ -24,6 +24,8 @@ services:
|
||||
SSH_PASSWORD: ASF
|
||||
SSH_HOST: asf-server.duckdns.org
|
||||
SSH_USER: asf
|
||||
SSH_PORT: 49152
|
||||
SSH_USER: asf
|
||||
volumes:
|
||||
- ./app:/app/app
|
||||
- ./wsgi.py:/app/wsgi.py
|
||||
|
||||
Reference in New Issue
Block a user