FabioFratini 10 miesięcy temu
rodzic
commit
b5659b95a7
1 zmienionych plików z 13 dodań i 17 usunięć
  1. 13 17
      Jenkinsfile

+ 13 - 17
Jenkinsfile

@@ -34,9 +34,17 @@ pipeline {
 
     stages {
         stage('Setup') {
+
+            stage('Verify Host') {
+                steps {
+                    sh 'hostname'
+                    sh 'hostname -I'
+                    sh 'whoami'
+                }
+            }
             steps {
                 // Check versions if available
-                sh 'php --version || echo "PHP not available"'
+                sh '/usr/bin/php --version || echo "PHP not available"'
                 sh 'composer --version || echo "Composer not available"'
                 sh 'node --version || echo "Node not available"'
                 sh 'npm --version || echo "NPM not available"'
@@ -57,18 +65,9 @@ pipeline {
 
         stage('Setup Environment') {
             steps {
-                sh 'cp .env.example .env || echo "No .env.example file found"'
-                sh 'php artisan key:generate || echo "Skipping key generation"'
-                sh 'php artisan config:clear || echo "Skipping config clear"'
-                sh 'php artisan cache:clear || echo "Skipping cache clear"'
-            }
-        }
-
-        stage('Run Tests') {
-            steps {
-                sh 'php artisan config:cache || echo "Skipping config cache"'
-                sh 'php artisan test --testsuite=Feature --testsuite=Unit || echo "Skipping tests"'
-                sh 'php artisan config:clear || echo "Skipping config clear"'
+                sh '/usr/bin/php artisan key:generate || echo "Skipping key generation"'
+                sh '/usr/bin/php artisan config:clear || echo "Skipping config clear"'
+                sh '/usr/bin/php artisan cache:clear || echo "Skipping cache clear"'
             }
         }
 
@@ -87,15 +86,12 @@ pipeline {
             }
             steps {
                 sshagent(['ssh-key-10.2.0.10']) {
-                    // Ensure the remote directory exists
                     sh "ssh -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'mkdir -p ${REMOTE_DIR}'"
 
-                    // Use rsync to transfer files
                     sh """
                         rsync -avz --exclude '.git' --exclude 'node_modules' --exclude 'vendor' -e 'ssh -o StrictHostKeyChecking=no' ./ ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR}/
                     """
 
-                    // Run setup commands on remote server
                     sh """
                         ssh -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'cd ${REMOTE_DIR} && \
                         composer install --no-interaction --no-dev --prefer-dist && \
@@ -124,7 +120,7 @@ pipeline {
 
     post {
         always {
-            node(any) {
+            node('any') {
                 cleanWs()
             }
         }