def remote = [:] remote.name = 'remote' remote.host = env.DEPLOY_HOST remote.user = env.DEPLOY_USER remote.identityFile = '/var/lib/jenkins/.ssh/id_rsa' remote.knownHosts = '/var/lib/jenkins/.ssh/known_hosts' pipeline { agent any stages { stage('Build') { steps { sh './jenkins/build.sh' } } stage('Deploy') { steps { sh 'echo $ODDB_CONFIG > config.py' sshCommand remote: remote, command: "cd od-database && rm -rf env fold_to_ascii search static task_tracker_drone templates ws_bucket_client" sh 'tar -czf env.tar.gz env' sshPut remote: remote, from: 'env.tar.gz', into: 'od-database' sshCommand remote: remote, command: 'tar -xzf od-database/env.tar.gz -C od-database && rm od-database/env.tar.gz' sshPut remote: remote, from: 'jenkins/deploy.sh', into: 'od-database' sshPut remote: remote, from: 'fold_to_ascii', into: 'od-database' sshPut remote: remote, from: 'search', into: 'od-database' sshPut remote: remote, from: 'static', into: 'od-database' sshPut remote: remote, from: 'task_tracker_drone', into: 'od-database' sshPut remote: remote, from: 'templates', into: 'od-database' sshPut remote: remote, from: 'ws_bucket_client', into: 'od-database' sshPut remote: remote, from: '__init__.py', into: 'od-database' sshPut remote: remote, from: 'api.py', into: 'od-database' sshPut remote: remote, from: 'app.py', into: 'od-database' sshPut remote: remote, from: 'captcha.py', into: 'od-database' sshPut remote: remote, from: 'common.py', into: 'od-database' sshPut remote: remote, from: 'database.py', into: 'od-database' sshPut remote: remote, from: 'export.py', into: 'od-database' sshPut remote: remote, from: 'init_script.sql', into: 'od-database' sshPut remote: remote, from: 'od_util.py', into: 'od-database' sshPut remote: remote, from: 'reddit_bot.py', into: 'od-database' sshPut remote: remote, from: 'tasks.py', into: 'od-database' sshPut remote: remote, from: 'template_filters.py', into: 'od-database' sshPut remote: remote, from: 'uwsgi.py', into: 'od-database' sshPut remote: remote, from: 'views.py', into: 'od-database' sshPut remote: remote, from: 'config.py', into: 'od-database' sshPut remote: remote, from: 'od-database.ini', into: 'od-database' sshPut remote: remote, from: 'jenkins/deploy.sh', into: 'od-database' sshCommand remote: remote, command: 'chmod +x od-database/deploy.sh && ./od-database/deploy.sh' } } } }