Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added solutions/WebDeploy_Demonstration.docx
Binary file not shown.
30 changes: 30 additions & 0 deletions solutions/jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
pipeline {
agent any

environment {
dest_ip = "54.198.18.170"
login_name = "root"
}
stages {
stage('Pre-Build') {
steps {
echo 'Pre-build step'
sh "cd /opt/working/"
sh "rm -rf webdeploy"
}
}
stage('Git Clone') {
steps {
echo 'Clone git repository'

git clone https://github.com/watchmen-test/webdeploy.git
}
}
stage('Deploy') {
steps {
echo 'Deploy to target server'
sh "scp -rp /opt/working/webdeploy/* $login_name@dest_ip:/var/www/html"

}
}
}
16 changes: 16 additions & 0 deletions solutions/webdeploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

#User defined variables
Src="/opt/working/"
Dest="/var/www/html"
Login_Name="root"
Dest_IP="54.198.18.170"

#Cloning from git repo
cd $Src
rm -rf webdeploy
git clone https://github.com/watchmen-test/webdeploy.git

#Copying files to target server
scp -rp $Src/webdeploy/* $Login_Name@$Dest_IP:$Dest

23 changes: 23 additions & 0 deletions solutions/webdeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- hosts: webservers
become: true
gather_facts: no

vars:
repo_url: https://github.com//watchmen-testebdeploy.git
destination: /var/www/html/

tasks:
- name: Install dependencies
yum: name={{ item }} state=latest update_cache=yes
with_items:
- git
- httpd

- name: Git pull and deploy
git: repo={{ repo_url }} dest={{ destination }}
notify: restart httpd

handlers:
- name: restart httpd
service: name=httpd state=restarted
6 changes: 4 additions & 2 deletions test-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
</head>

<body>
<script src="js/scripts.js"></script>
<script src="js/scripts.js">
</script>
<h1>Webdeploy Technical Screening</h1>
<img src="images/watchmen-logo-slice-600x200.jpg"/>
</body>
</html>
</html>