Uname:Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 13.126.101.145  /  Your IP : 216.73.216.131
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/rentals_updated/wp-content/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/rentals_updated/wp-content/jenkinesfile-old
PROJECT_PATH = '/var/www/html/wp-content'
BUNDLE_NAME = "changed_files.tar.gz"

node() {
    stage('Cloning Git') {
        dir('package') {
            checkout scm
            sh "ls -la"  // Debug: List contents to verify checkout
            echo "SUCCESS :: Git project cloning done."
        }
    }

    stage('Identify Changes') {
        dir('package') {
            sh "pwd"  // Debug: Print current working directory
            sh "git status"  // Debug: Check Git status
            
            def commitCount = sh(script: "git rev-list --count HEAD", returnStdout: true).trim()
            
            if (commitCount.toInteger() > 1) {
                def changedFiles = sh(script: "git diff --name-only HEAD HEAD~1", returnStdout: true).trim()
                if (changedFiles) {
                    writeFile file: "changed_files.txt", text: changedFiles
                } else {
                    echo "NOTICE :: No file changes detected."
                    writeFile file: "changed_files.txt", text: ""
                }
            } else {
                echo "NOTICE :: Not enough commits for diff. Assuming initial setup."
                def allFiles = sh(script: "find . -type f -not -path '/.git/' -print", returnStdout: true).trim()
                writeFile file: "changed_files.txt", text: allFiles
            }
            sh "cat changed_files.txt"  // Debug: Print the list of files
        }
    }

    stage('Package Build') {
        dir('package') {
            sh "tar -zcvf ${BUNDLE_NAME} -T changed_files.txt"
            echo "SUCCESS :: Created archive ${BUNDLE_NAME}"
        }
    }

    stage('Artifacts Creation') {
        dir('package') {
            fingerprint BUNDLE_NAME
            archiveArtifacts artifacts: BUNDLE_NAME, onlyIfSuccessful: true
            echo "SUCCESS :: Artifacts of changed files created."
        }
    }

    stage('Stash changes') {
        dir('package') {
            stash allowEmpty: true, includes: BUNDLE_NAME, name: 'buildArtifacts'
        }
    }

    stage('CleanWorkspace') {
        cleanWs()
    }
}

node('EC2_GMMCO_DEV') { 
    stage('Deploying In Appliction ')
            {
            echo 'START :: Unstashing ....'
            unstash 'buildArtifacts'
            echo 'SUCCESS :: Artifacts of changed files copied to server.'

            echo 'SUCCESS :: Copy Start'
            sh """
                mkdir -p ${PROJECT_PATH}
                cp ${BUNDLE_NAME} ${PROJECT_PATH}
                cd ${PROJECT_PATH}
                tar -xvf ${BUNDLE_NAME}
            """
            echo 'SUCCESS :: Copy of changed files completed.'

            echo 'SUCCESS :: Removing Bundle'
            sh "rm -f ${PROJECT_PATH}/${BUNDLE_NAME}"
            echo 'SUCCESS :: Bundle file removed.'

            sh "sudo chmod -R 777 ${PROJECT_PATH}"  // Adjust permissions for extracted files
            sh "sudo chown ubuntu:ubuntu -R ${PROJECT_PATH}"

            echo 'SUCCESS :: Package install done.'
        }
}

Youez - 2016 - github.com/yon3zu
LinuXploit