├── .gitignore
├── BackupCriticalData
└── config.xml
├── BackupReminder
└── config.xml
├── BashCodeQualityCheck
└── config.xml
├── BuildAllCode
└── config.xml
├── BuildAllDockerImages
└── config.xml
├── CheckAllServicesOnServers
└── config.xml
├── CollectFiles
└── config.xml
├── CommonServerCheck
└── config.xml
├── CompareMachinesAuditReport
└── config.xml
├── DBSummaryReport
└── config.xml
├── DeploySystem
└── config.xml
├── DiagnosticJenkinsJobSlow
└── config.xml
├── DigitalOceanDeployCookbooks
└── config.xml
├── DigtalOceanSlackReport
└── config.xml
├── DockerDeploySandboxActiveSprint
└── config.xml
├── DockerDeploySandboxPreviousActiveSprint
└── config.xml
├── DockerDeploySandboxUpgradeLegacyEnv
└── config.xml
├── GitPullCode
└── config.xml
├── ListHTTPTraffic
└── config.xml
├── LongRunAllInOne
└── config.xml
├── LongRunCluster
└── config.xml
├── MonitorGitFileChanges
└── config.xml
├── MonitorITResource
└── config.xml
├── MonitorNewActiveSprint
└── config.xml
├── MonitorProcess
└── config.xml
├── MonitorServerFileChangesAudit
└── config.xml
├── NetworkLatencyReport
└── config.xml
├── NetworkTCPScanAuditReport
└── config.xml
├── OSPackageActionAuditReport
└── config.xml
├── PackageListReport
└── config.xml
├── PipelineActiveSprint
└── config.xml
├── PipelineAddNodes
└── config.xml
├── PipelineMaster
└── config.xml
├── PipelineMonitor
└── config.xml
├── PipelineRemoveNodes
└── config.xml
├── PythonCodeQualityCheck
└── config.xml
├── README.md
├── ReplicateGitRepoCode
└── config.xml
├── RubyCodeQualityCheck
└── config.xml
├── RunCommandOnServers
└── config.xml
├── RunRemoteCommand
└── config.xml
├── SSHLoginAuditReport
└── config.xml
├── SonarCodeQualityCheck
└── config.xml
├── SyncHTTPRepoServer
└── config.xml
├── VerifyGUILogin
└── config.xml
└── images_screenshot
├── BashCodeQualityCheck.png
├── DockerDeploySandboxActiveSprint.png
├── DockerDeploySandboxPreviousActiveSprint.png
├── DockerDeploySandboxUpgradeLegacyEnv.png
├── MonitorGitFileChanges.png
├── MonitorITResource.png
├── MonitorNewActiveSprint.png
├── MonitorServerFileChangesAudit.png
├── NetworkTCPScanAuditReport.png
├── OSPackageActionAuditReport.png
├── RubyCodeQualityCheck.png
└── RunCommandOnServers.png
/.gitignore:
--------------------------------------------------------------------------------
1 | builds
2 | nextBuildNumber
3 | timestamps
4 | timestamps.SHA-1
5 | changelog.xml
6 | log
7 | build.xml
8 | lastStable
9 | lastSuccessful
--------------------------------------------------------------------------------
/BackupCriticalData/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 | false
17 |
18 |
19 |
20 |
21 | server_list
22 |
23 | ######## Column Explained: ssh server ip, ssh port, ssh username
24 | 172.17.0.3:22:root
25 |
26 |
27 |
28 | file_list
29 |
30 | # Jenkins backup
31 | eval: find /var/lib/jenkins/jobs -name config.xml
32 | # Confluence backup
33 | eval: find /var/atlassian/application-data/confluence/backups/ -name *.zip -printf '%T@ %p\n' | sort -n | tail -n 1 | awk -F' ' '{print $2}'
34 | # JIRA backup
35 | eval: find /var/atlassian/application-data/jira/export/ -name *.zip -printf '%T@ %p\n' | sort -n | tail -n 1 | awk -F' ' '{print $2}'
36 |
37 | # apache
38 | /etc/apache2/sites-enabled
39 | /etc/httpd/conf.d
40 |
41 | # autostart and config files
42 | /etc/rc.local
43 | /var/lib/jenkins/.ssh/
44 | /root/.ssh/
45 | /etc/hosts
46 |
47 | # ssh
48 | /root/.ssh/authorized_keys
49 | /home/centos/authorized_keys
50 | /home/ubuntu/authorized_keys
51 |
52 | # general
53 | /opt/devops/
54 |
55 |
56 |
57 | env_parameters
58 |
59 | export SERVER_REMOTE_COPY="backup.dennyzhang.com:root:/data/backup/denny_demo"
60 |
61 |
62 |
63 |
64 |
65 | true
66 | false
67 | false
68 | false
69 |
70 | false
71 |
72 |
73 | #!/bin/bash -e
74 | function download_script() {
75 | local download_file=${1?}
76 | . /etc/profile
77 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
78 | working_dir="/var/lib/jenkins/code/devops_public"
79 | bash_script="${working_dir}/${download_file}"
80 | dir_name=$(dirname "$bash_script")
81 |
82 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
83 | if [ ! -f "$bash_script" ]; then
84 | mkdir -p "$dir_name"
85 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
86 | chmod 755 "$bash_script"
87 | fi
88 | }
89 | ################################################################################
90 | download_file="jenkins/collect_files.sh"
91 | download_script "$download_file"
92 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/BackupReminder/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 | false
17 |
18 |
19 |
20 |
21 | hook_url
22 |
23 | https://hooks.slack.com/services/T2ZQ9TN5D/fake/fake5y46wc1SmXZRDaSmjJGP8
24 |
25 |
26 | text_msg
27 |
28 | @Denny Perform monthly backup
29 |
30 | - Create tag for critical git repos
31 |
32 |
33 |
34 |
35 |
36 | true
37 | false
38 | false
39 | false
40 | false
41 |
42 |
43 | #!/bin/bash -e
44 | curl $hook_url \
45 | -X POST \
46 | -d "payload={\"text\":\"$text_msg\"}"
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/BashCodeQualityCheck/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/BashCodeQualityCheck/config.xml
5 |
6 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/BashCodeQualityCheck.png
7 |
8 | Read more: https://www.dennyzhang.com/shellcheck/
9 | false
10 |
11 |
12 |
13 | -1
14 | 50
15 | -1
16 | -1
17 |
18 |
19 |
20 |
21 |
22 | git_list
23 |
24 | https://github.com/DennyZhang/chef_community_cookbooks.git,master
25 | https://github.com/DennyZhang/devops_public.git,master
26 |
27 |
28 |
29 | env_parameters
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | true
38 | false
39 | false
40 | false
41 | false
42 |
43 |
44 | #!/bin/bash -e
45 | function download_script() {
46 | local download_file=${1?}
47 | . /etc/profile
48 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
49 | working_dir="/var/lib/jenkins/code/devops_public"
50 | bash_script="${working_dir}/${download_file}"
51 | dir_name=$(dirname "$bash_script")
52 |
53 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
54 | if [ ! -f "$bash_script" ]; then
55 | mkdir -p "$dir_name"
56 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
57 | chmod 755 "$bash_script"
58 | fi
59 | }
60 | ################################################################################
61 | download_file="code_style/shellcheck_style_check.sh"
62 | download_script "$download_file"
63 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/BuildAllCode/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Code build
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | repo_dir
19 |
20 | /var/www/repo/codebuild
21 |
22 |
23 | git_repo_url
24 | Repo url for source code.
25 | https://github.com/DennyZhang/chef_community_cookbooks.git
26 |
27 |
28 | branch_name
29 | Which branch to build.
30 | master
31 |
32 |
33 | build_command
34 | Bash url to build code or build script.
35 |
36 | make
37 |
38 |
39 | files_to_copy
40 |
41 |
42 |
43 |
44 | env_parameters
45 |
46 | export CLEAN_START=false
47 | export FORCE_BUILD=true
48 | export SKIP_COPY=false
49 |
50 |
51 |
52 |
53 |
54 |
55 | true
56 | false
57 | false
58 | false
59 | false
60 |
61 |
62 | #!/bin/bash -e
63 | function download_script() {
64 | local download_file=${1?}
65 | . /etc/profile
66 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
67 | working_dir="/var/lib/jenkins/code/devops_public"
68 | bash_script="${working_dir}/${download_file}"
69 | dir_name=$(dirname "$bash_script")
70 |
71 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
72 | if [ ! -f "$bash_script" ]; then
73 | mkdir -p "$dir_name"
74 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
75 | chmod 755 "$bash_script"
76 | fi
77 | }
78 | ################################################################################
79 | download_file="jenkins/jenkins_code_build.sh"
80 | download_script "$download_file"
81 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | http://jenkins.dennyzhang.com:18080/
90 |
91 | false
92 | false
93 | false
94 | false
95 | true
96 | true
97 | true
98 | false
99 | false
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/BuildAllDockerImages/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Use docker-in-docker to test docker image build.
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 | false
17 |
18 |
19 |
20 |
21 | git_repo_url
22 |
23 | https://github.com/DennyZhang/devops_docker_image.git
24 |
25 |
26 | build_command
27 |
28 | python /devops_docker_image/build_image.py
29 |
30 |
31 | copy_resource_command
32 |
33 |
34 |
35 |
36 | destroy_existing_env
37 | When enabled, existing env will be destroyed first before test
38 | true
39 |
40 |
41 | destroy_after_test
42 | Whether to destroy the test env, after docker images build.
43 | true
44 |
45 |
46 | DOCKER_LIST
47 |
48 | /devops_docker_image/java/java_v1_0.dockerfile
49 | /devops_docker_image/jenkins/jenkins_v1.dockerfile
50 | /devops_docker_image/shadowsock/ss_v1.dockerfile
51 |
52 |
53 |
54 |
55 |
56 |
57 | true
58 | false
59 | false
60 | false
61 |
62 |
63 | false
64 |
65 |
66 | #!/bin/bash -ex
67 | ssh_connect="ssh -p 2702 root@172.17.0.1"
68 |
69 | # load_image_command="docker load -i /root/docker_in_docker/ubuntu_14.04.tar.gz"
70 |
71 | # Use Jenkins job name as part of docker container.
72 | docker_container_name="docker-images-${JOB_NAME}"
73 |
74 | if $destroy_existing_env; then
75 | $ssh_connect "docker stop $docker_container_name; docker rm $docker_container_name; true"
76 | $ssh_connect "docker run -t -d --privileged -h mytest --name $docker_container_name -v /root/docker_in_docker:/root/docker_in_docker denny/docker:v1.0 /usr/bin/dockerd"
77 | $ssh_connect "docker exec -t $docker_container_name git clone $git_repo_url"
78 | fi
79 |
80 | # start container for test
81 | $ssh_connect "docker start $docker_container_name"
82 |
83 | if [ -n "$load_image_command" ]; then
84 | echo "Load golden docker images"
85 | $ssh_connect "$load_image_command"
86 | fi
87 |
88 | if [ -n "$copy_resource_command" ]; then
89 | echo "Copy resources"
90 | $ssh_connect "docker exec -t $docker_container_name $copy_resource_command"
91 | fi
92 |
93 | # pass env
94 | $ssh_connect "echo \"$DOCKER_LIST\" > /tmp/docker_env.sh"
95 | $ssh_connect "docker cp /tmp/docker_env.sh $docker_container_name:/tmp/docker_env.sh"
96 |
97 | echo "Build docker images"
98 | $ssh_connect "docker exec -t $docker_container_name $build_command"
99 |
100 |
101 | # Stop container to save resource
102 | $ssh_connect "docker stop $docker_container_name"
103 |
104 | if $destroy_after_test; then
105 | echo "Destroy $docker_container_name container"
106 | $ssh_connect "docker rm $docker_container_name"
107 | fi
108 |
109 |
110 |
111 |
112 |
113 |
114 | http://injenkins.fluigdata.com:48080/
115 |
116 | false
117 | false
118 | false
119 | false
120 | false
121 | true
122 | true
123 | false
124 | false
125 | NONE
126 | false
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/CheckAllServicesOnServers/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Check All Services in all servers
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | server_list
19 |
20 | 172.17.0.3
21 |
22 |
23 |
24 | command_list
25 |
26 | cat /etc/hosts
27 | service jenkins status
28 | service apache2 status
29 |
30 |
31 | env_parameters
32 | export SSH_USERNAME="root"
33 | export ssh_key_file="/var/lib/jenkins/.ssh/id_rsa"
34 |
35 |
36 |
37 |
38 |
39 |
40 | true
41 | false
42 | false
43 | false
44 |
45 | false
46 |
47 |
48 | #!/bin/bash -e
49 | function download_script() {
50 | local download_file=${1?}
51 | . /etc/profile
52 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
53 | working_dir="/var/lib/jenkins/code/devops_public"
54 | bash_script="${working_dir}/${download_file}"
55 | dir_name=$(dirname "$bash_script")
56 |
57 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
58 | if [ ! -f "$bash_script" ]; then
59 | mkdir -p "$dir_name"
60 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
61 | chmod 755 "$bash_script"
62 | fi
63 | }
64 | ################################################################################
65 | download_file="jenkins/run_command_on_servers.sh"
66 | download_script "$download_file"
67 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | http://jenkins.dennyzhang.com:18080/
76 |
77 | false
78 | false
79 | false
80 | false
81 | true
82 | true
83 | true
84 | false
85 | false
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/CollectFiles/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | server_list
19 |
20 | 172.17.0.3:22:root
21 |
22 |
23 | file_list
24 |
25 | /etc/hosts
26 | /opt/couchbase/etc/couchbase/static_config
27 | /etc/elasticsearch/elasticsearch.yml
28 | /root/.ssh/authorized_keys
29 |
30 |
31 | env_parameters
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | true
40 | false
41 | false
42 | false
43 |
44 | false
45 |
46 |
47 | #!/bin/bash -e
48 | function download_script() {
49 | local download_file=${1?}
50 | . /etc/profile
51 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
52 | working_dir="/var/lib/jenkins/code/devops_public"
53 | bash_script="${working_dir}/${download_file}"
54 | dir_name=$(dirname "$bash_script")
55 |
56 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
57 | if [ ! -f "$bash_script" ]; then
58 | mkdir -p "$dir_name"
59 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
60 | chmod 755 "$bash_script"
61 | fi
62 | }
63 | ################################################################################
64 | download_file="jenkins/collect_files.sh"
65 | download_script "$download_file"
66 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | http://jenkins.dennyzhang.com:18080/
75 |
76 | false
77 | false
78 | false
79 | false
80 | true
81 | true
82 | true
83 | false
84 | false
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/CommonServerCheck/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | test_spec
19 |
20 | # Check tcp ports in jerkins container
21 | ["18080",
22 | # "28000",
23 | # "9000"
24 | ].each do |port|
25 | describe port(port) do
26 | it { should be_listening }
27 | end
28 | end
29 |
30 | # ping check
31 | ["www.github.com"].each do |item|
32 | describe command("ping -c3 #{item}") do
33 | its(:exit_status) { should eq 0 }
34 | end
35 | end
36 |
37 | # # Check anonymous http links
38 | # %w(
39 | # http://www.bing.com
40 | # ).each do |url|
41 | # describe command('curl -I -k ' + url + ' 2>/dev/null | grep HTTP') do
42 | # its(:stdout) { should match /HTTP\/1.1 200 OK/ }
43 | # end
44 | # end
45 |
46 | # # Check at least 2 GB free memory
47 | # describe command("[ `free -ml | grep 'buffers/cache' | awk -F' ' '{print $4}'` -gt 2048 ]") do
48 | # its(:exit_status) { should eq 0 }
49 | # end
50 |
51 | # # Make sure used disk of rootfs is less than 75%
52 | # describe command("[ $(df -h / | tail -n1 | awk -F' ' '{print $5}' | awk -F'%' '{print $1}') -lt 75 ]") do
53 | # its(:exit_status) { should eq 0 }
54 | # end
55 |
56 | # # check cpu loadavg in latest one min
57 | # ["172.17.0.1:22:10"].each do |item|
58 | # (ip, port, cpu_load) = item.split(':')
59 | # command_str = "[ `ssh -o stricthostkeychecking=no -p %s root@%s cat /proc/loadavg | awk '{print int($1+0.99)}'` -lt %s ]" \
60 | # % [port, ip, cpu_load]
61 | # describe command(command_str) do
62 | # its(:exit_status) { should eq 0 }
63 | # end
64 | # end
65 |
66 | # # check docker container number
67 | # ["172.17.0.1:22:11"].each do |item|
68 | # (ip, port, container_count) = item.split(':')
69 | # command_str = "[ `ssh -o stricthostkeychecking=no -p %s root@%s docker ps | sed 1d | wc -l` -lt %s ]" \
70 | # % [port, ip, container_count]
71 | # describe command(command_str) do
72 | # its(:exit_status) { should eq 0 }
73 | # end
74 | # end
75 |
76 |
77 |
78 |
79 |
80 | true
81 | false
82 | false
83 | false
84 | false
85 |
86 |
87 | #!/bin/bash -e
88 | function download_script() {
89 | local download_file=${1?}
90 | . /etc/profile
91 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
92 | working_dir="/var/lib/jenkins/code/devops_public"
93 | bash_script="${working_dir}/${download_file}"
94 | dir_name=$(dirname "$bash_script")
95 |
96 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
97 | if [ ! -f "$bash_script" ]; then
98 | mkdir -p "$dir_name"
99 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
100 | chmod 755 "$bash_script"
101 | fi
102 | }
103 | ################################################################################
104 | download_file="monitor/serverspec_check.sh"
105 | download_script "$download_file"
106 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/CompareMachinesAuditReport/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Compare difference of Two Machines
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | ssh_server1
19 | server_ip, ssh_port, ssh_username
20 | 172.17.0.1:22:root
21 |
22 |
23 | ssh_server2
24 | server_ip, ssh_port, ssh_username
25 | 172.17.0.2:22:root
26 |
27 |
28 | env_parameters
29 |
30 | export CHECK_SCENARIO="all"
31 |
32 |
33 |
34 |
35 |
36 | true
37 | false
38 | false
39 | false
40 |
41 | false
42 |
43 |
44 | #!/bin/bash -e
45 | function download_script() {
46 | local download_file=${1?}
47 | . /etc/profile
48 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
49 | working_dir="/var/lib/jenkins/code/devops_public"
50 | bash_script="${working_dir}/${download_file}"
51 | dir_name=$(dirname "$bash_script")
52 |
53 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
54 | if [ ! -f "$bash_script" ]; then
55 | mkdir -p "$dir_name"
56 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
57 | chmod 755 "$bash_script"
58 | fi
59 | }
60 | ################################################################################
61 | download_file="report/compare_machine_report.sh"
62 | download_script "$download_file"
63 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/DBSummaryReport/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | List recent actions of packages installation or removal for a given server
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | env_parameters
19 |
20 | export STDOUT_SHOW_DATA_OUT="true"
21 | export CFG_DIR="/opt/devops/dump_db_summary/cfg_dir"
22 | export DATA_OUT_DIR="/opt/devops/dump_db_summary/data_out"
23 | export REFRESH_BASH="false"
24 |
25 |
26 |
27 |
28 |
29 |
30 | true
31 | false
32 | false
33 | false
34 |
35 | false
36 |
37 |
38 | #!/bin/bash -e
39 | function download_script() {
40 | local download_file=${1?}
41 | . /etc/profile
42 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
43 | working_dir="/var/lib/jenkins/code/devops_public"
44 | bash_script="${working_dir}/${download_file}"
45 | dir_name=$(dirname "$bash_script")
46 |
47 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
48 | if [ ! -f "$bash_script" ]; then
49 | mkdir -p "$dir_name"
50 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
51 | chmod 755 "$bash_script"
52 | fi
53 | }
54 | ################################################################################
55 | download_file="report/db_summary_report.sh"
56 | download_script "$download_file"
57 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/DeploySystem/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Deploy cluster env by ssh + chef.
5 |
6 | false
7 |
8 |
9 |
10 | -1
11 | 50
12 | -1
13 | -1
14 |
15 |
16 |
17 |
18 |
19 | server_list
20 |
21 | # node1: couchbase
22 | 172.17.0.2:22
23 | # node2: elasticsearch
24 | 172.17.0.3:22
25 | # node3: app
26 | 172.17.0.4:22
27 | # node4: couchbase
28 | 172.17.0.5:22
29 | # node5: elasticsearch
30 | 172.17.0.6:22
31 | # node6: app
32 | 172.17.0.7:22
33 |
34 |
35 |
36 | deploy_run_list
37 |
38 | "recipe[apt::default]"
39 |
40 |
41 | init_run_list
42 |
43 |
44 |
45 |
46 | chef_json
47 |
48 | {
49 | "common_basic":
50 | {
51 | # service hosts: deploy service to which host
52 | "couchbase_hosts":["172.17.0.1", "172.17.0.2"],
53 | "elasticsearch_hosts":["172.17.0.3", "171.17.0.4"],
54 | "xxx_hosts":["172.17.0.5", "172.17.0.6"],
55 | "haproxy_hosts":["172.17.0.1","172.17.0.2"],
56 | "nagios_server":"172.17.0.1",
57 |
58 | # specify branch name
59 | "app_branch_name":"master",
60 | "devops_branch_name":"master",
61 |
62 | "package_url":"http://172.17.0.1:18000",
63 |
64 | # tcp ports
65 | "haproxy_port":"80",
66 | "haproxy_ssl_port":"443",
67 | "app_http_port":"80",
68 | "app_https_port":"443"
69 | },
70 | "couchbase_xxx":
71 | {"memory_quota_mb":"16384"},
72 | "elasticsearch_xxx":
73 | {"allocated_memory_mb":"16384",
74 | "audit_allocated_memory_mb":"1024",
75 | "enable_audit_elasticsearch":"false",
76 | "elasticsearch_clustername":"my-es-cluster",
77 | "elasticsearch_audit_clustername":"my-es-audit-cluster"
78 | },
79 | "app_xxx":
80 | {"maxSimultaneousThreads":"8",
81 | "maxTotalThreads":"64",
82 | "cb_bucket_retries":"10",
83 | "cb_bucket_retryinterval":"10000",
84 | "cb_bucket_timeout":"100000",
85 | "cb_replicas_count":"2",
86 | "elasticsearch_replicas_count":"2",
87 | "elasticsearch_shards_count":"5",
88 | "elasticsearch_audit_replicas_count":"2",
89 | "elasticsearch_audit_shards_count":"5",
90 | "enable_slack_sync":"false",
91 | "session_bucket_quota_in_mb":"1024",
92 | "staging_bucket_quota_in_mb":"2048",
93 | "master_bucket_quota_in_mb":"10240",
94 | "mgmt_timeout":"900000",
95 | "max_timeout":"960000",
96 | "xxx_java_opts":"-Xms10240m -Xmx10240m",
97 | "mincomputationpoolsize":"16",
98 | "whether_flushdatabaseonconnect":"$whether_flushdatabaseonconnect",
99 | "whether_populatefakedata":"false",
100 | "whether_populaterealdata":"false",
101 | "whether_populategenerateddata":"false"
102 | }
103 | }
104 |
105 |
106 | check_command
107 | How to check system, after deployment or upgrade.
108 | cat /root/chef_update/report.txt
109 |
110 |
111 | env_parameters
112 |
113 | export KILL_RUNNING_CHEF_UPDATE=false
114 | export CODE_SH='/root/git_update.sh'
115 | export code_dir='/root/chef'
116 | export git_repo_url=git@gitlabcn.dennyzhang.com:devops/chef_community_cookbooks.git
117 |
118 |
119 |
120 |
121 |
122 | true
123 | false
124 | false
125 | false
126 |
127 | false
128 |
129 |
130 | #!/bin/bash -e
131 | function download_script() {
132 | local download_file=${1?}
133 | . /etc/profile
134 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
135 | working_dir="/var/lib/jenkins/code/devops_public"
136 | bash_script="${working_dir}/${download_file}"
137 | dir_name=$(dirname "$bash_script")
138 |
139 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
140 | if [ ! -f "$bash_script" ]; then
141 | mkdir -p "$dir_name"
142 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
143 | chmod 755 "$bash_script"
144 | fi
145 | }
146 | ################################################################################
147 | download_file="jenkins/deploy_cluster.sh"
148 | download_script "$download_file"
149 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 | http://jenkins.dennyzhang.com:18080/
158 |
159 | false
160 | false
161 | false
162 | false
163 | true
164 | true
165 | true
166 | false
167 | false
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
--------------------------------------------------------------------------------
/DiagnosticJenkinsJobSlow/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | jenkins_job
19 |
20 | BuildAllCode
21 |
22 |
23 | job_run_id
24 |
25 | 1
26 |
27 |
28 | env_parameters
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | true
37 | false
38 | false
39 | false
40 |
41 | false
42 |
43 |
44 | #!/bin/bash -e
45 | function download_script() {
46 | local download_file=${1?}
47 | . /etc/profile
48 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
49 | working_dir="/var/lib/jenkins/code/devops_public"
50 | bash_script="${working_dir}/${download_file}"
51 | dir_name=$(dirname "$bash_script")
52 |
53 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
54 | if [ ! -f "$bash_script" ]; then
55 | mkdir -p "$dir_name"
56 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
57 | chmod 755 "$bash_script"
58 | fi
59 | }
60 | ################################################################################
61 | download_file="performance/diagnostic_jenkinsjob_slow/diagnostic_jenkinsjob_slow.sh"
62 | download_script "$download_file"
63 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | http://jenkins.dennyzhang.com:18080/
72 |
73 | false
74 | false
75 | false
76 | false
77 | true
78 | true
79 | true
80 | false
81 | false
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/DigitalOceanDeployCookbooks/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | git_repo_url
19 | Repo url for chef source code.
20 |
21 | https://github.com/DennyZhang/chef_community_cookbooks.git
22 |
23 |
24 | branch_name
25 | branch name for the chef cookbook code.
26 | master
27 |
28 |
29 | test_command
30 |
31 | curl https://raw.githubusercontent.com/DennyZhang/devops_public/tag_v2/chef/kitchen_raw_test.sh | bash
32 |
33 |
34 | cookbook_list
35 | What cookbooks to test. Separated by whitespace.
36 |
37 | If "ALL", all cookbooks under the given directory will be tested. Otherwise perform tests for given cookbooks.
38 | sandbox-test
39 |
40 |
41 | skip_cookbook_list
42 | What cookbooks to skip test. Separated by whitespace.
43 | couchbase
44 |
45 |
46 | must_cookbook_list
47 | What cookbooks to must test, no matter what. Separated by whitespace.
48 |
49 |
50 |
51 | env_parameters
52 |
53 | export KEEP_INSTANCE=false
54 | export KEEP_FAILED_INSTANCE=false
55 |
56 | export TEST_KITCHEN_YAML=.kitchen.digitalocean_yml
57 | # export DIGITALOCEAN_ACCESS_TOKEN="XXXX"
58 | # export DIGITALOCEAN_SSH_KEY_IDS="XXX"
59 | export DIGITALOCEAN_FLAVOR=8gb
60 | export APP_BRANCH_NAME=sprint-29
61 |
62 |
63 |
64 |
65 |
66 | true
67 | false
68 | false
69 |
70 | true
71 |
72 |
73 | #!/bin/bash -e
74 | function download_script() {
75 | local download_file=${1?}
76 | . /etc/profile
77 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
78 | working_dir="/var/lib/jenkins/code/devops_public"
79 | bash_script="${working_dir}/${download_file}"
80 | dir_name=$(dirname "$bash_script")
81 |
82 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
83 | if [ ! -f "$bash_script" ]; then
84 | mkdir -p "$dir_name"
85 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
86 | chmod 755 "$bash_script"
87 | fi
88 | }
89 | ################################################################################
90 | download_file="chef/kitchen_test_cookbooks.sh"
91 | download_script "$download_file"
92 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/DigtalOceanSlackReport/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Cost BreakDown For all Running DigitalOcean Droplets In Slack
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | SLACK_CHANNEL
19 |
20 | YOUR_SLACK_CHANNEL
21 |
22 |
23 |
24 |
25 |
26 | true
27 | false
28 | false
29 | false
30 | false
31 |
32 |
33 | #!/bin/bash
34 |
35 | function download_script() {
36 | local download_file=${1?}
37 | . /etc/profile
38 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
39 | working_dir="/var/lib/jenkins/code/devops_public"
40 | bash_script="${working_dir}/${download_file}"
41 | dir_name=$(dirname "$bash_script")
42 |
43 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
44 | if [ ! -f "$bash_script" ]; then
45 | mkdir -p "$dir_name"
46 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
47 | chmod 755 "$bash_script"
48 | fi
49 | }
50 | ################################################################################
51 | download_file="report/digitalocean_cost_slack_report.sh"
52 | download_script "$download_file"
53 |
54 | export DIGITALOCEAN_TOKEN=YOUR_DIGITALOCEAN_TOKEN
55 | export SLACK_TOKEN=YOUR_SLACK_TOKEN
56 |
57 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/DockerDeploySandboxActiveSprint/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/DockerDeploySandboxActiveSprint/config.xml
5 |
6 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/DockerDeploySandboxActiveSprint.png
7 |
8 | Read more: https://www.dennyzhang.com/sandbox_setup
9 | false
10 |
11 |
12 |
13 | -1
14 | 50
15 | -1
16 | -1
17 |
18 |
19 |
20 |
21 |
22 | git_repo_url
23 | Repo url for chef source code.
24 |
25 | https://github.com/DennyZhang/chef_community_cookbooks.git
26 |
27 |
28 | branch_name
29 | branch name for the chef cookbook code.
30 | master
31 |
32 |
33 | test_command
34 |
35 | curl https://raw.githubusercontent.com/DennyZhang/devops_public/tag_v2/chef/kitchen_raw_test.sh | bash
36 |
37 |
38 | cookbook_list
39 | What cookbooks to test. Separated by whitespace.
40 |
41 | If "ALL", all cookbooks under the given directory will be tested. Otherwise perform tests for given cookbooks.
42 | sandbox-test
43 |
44 |
45 | env_parameters
46 |
47 | export TEST_KITCHEN_YAML=.kitchen.yml
48 |
49 | export KEEP_FAILED_INSTANCE=false
50 | export KEEP_INSTANCE=false
51 | export DOCKER_IMAGE_URL=http://172.17.0.1:80/my_sandbox_latest.tar.gz
52 | export DOCKER_PORT_FORWARD_PREFIX=52
53 | export CLEAN_START=false
54 | export APP_BRANCH_NAME=sprint-34
55 | export FRAMEWORK_BRANCH_NAME=sprint-34
56 |
57 |
58 |
59 |
60 |
61 | true
62 | false
63 | false
64 | false
65 |
66 | true
67 |
68 |
69 | #!/bin/bash -e
70 | function download_script() {
71 | local download_file=${1?}
72 | . /etc/profile
73 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
74 | working_dir="/var/lib/jenkins/code/devops_public"
75 | bash_script="${working_dir}/${download_file}"
76 | dir_name=$(dirname "$bash_script")
77 |
78 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
79 | if [ ! -f "$bash_script" ]; then
80 | mkdir -p "$dir_name"
81 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
82 | chmod 755 "$bash_script"
83 | fi
84 | }
85 | ################################################################################
86 | download_file="chef/kitchen_test_cookbooks.sh"
87 | download_script "$download_file"
88 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/DockerDeploySandboxPreviousActiveSprint/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/DockerDeploySandboxPreviousActiveSprint/config.xml
5 |
6 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/DockerDeploySandboxPreviousActiveSprint.png
7 |
8 | Read more: https://www.dennyzhang.com/sandbox_setup
9 | false
10 |
11 |
12 |
13 | -1
14 | 50
15 | -1
16 | -1
17 |
18 |
19 |
20 |
21 |
22 | git_repo_url
23 | Repo url for chef source code.
24 |
25 | https://github.com/DennyZhang/chef_community_cookbooks.git
26 |
27 |
28 | branch_name
29 | branch name for the chef cookbook code.
30 | master
31 |
32 |
33 | test_command
34 |
35 | curl https://raw.githubusercontent.com/DennyZhang/devops_public/tag_v2/chef/kitchen_raw_test.sh | bash
36 |
37 |
38 | cookbook_list
39 | What cookbooks to test. Separated by whitespace.
40 |
41 | If "ALL", all cookbooks under the given directory will be tested. Otherwise perform tests for given cookbooks.
42 | sandbox-test
43 |
44 |
45 | env_parameters
46 |
47 | export TEST_KITCHEN_YAML=.kitchen.yml
48 |
49 | export KEEP_FAILED_INSTANCE=false
50 | export KEEP_INSTANCE=false
51 | export DOCKER_IMAGE_URL=http://172.17.0.1:80/my_sandbox_latest.tar.gz
52 | export DOCKER_PORT_FORWARD_PREFIX=50
53 | export CLEAN_START=false
54 | export APP_BRANCH_NAME=sprint-34
55 | export FRAMEWORK_BRANCH_NAME=sprint-34
56 |
57 |
58 |
59 |
60 |
61 | true
62 | false
63 | false
64 | false
65 |
66 | true
67 |
68 |
69 | #!/bin/bash -e
70 | function download_script() {
71 | local download_file=${1?}
72 | . /etc/profile
73 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
74 | working_dir="/var/lib/jenkins/code/devops_public"
75 | bash_script="${working_dir}/${download_file}"
76 | dir_name=$(dirname "$bash_script")
77 |
78 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
79 | if [ ! -f "$bash_script" ]; then
80 | mkdir -p "$dir_name"
81 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
82 | chmod 755 "$bash_script"
83 | fi
84 | }
85 | ################################################################################
86 | download_file="chef/kitchen_test_cookbooks.sh"
87 | download_script "$download_file"
88 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/DockerDeploySandboxUpgradeLegacyEnv/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/DockerDeploySandboxUpgradeLegacyEnv/config.xml
5 |
6 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/DockerDeploySandboxUpgradeLegacyEnv.png
7 |
8 | Read more: https://www.dennyzhang.com/sandbox_setup
9 | false
10 |
11 |
12 |
13 | -1
14 | 50
15 | -1
16 | -1
17 |
18 |
19 |
20 |
21 |
22 | git_repo_url
23 | Repo url for chef source code.
24 |
25 | https://github.com/DennyZhang/chef_community_cookbooks.git
26 |
27 |
28 | branch_name
29 | branch name for the chef cookbook code.
30 | master
31 |
32 |
33 | test_command
34 |
35 | curl https://raw.githubusercontent.com/DennyZhang/devops_public/tag_v2/chef/kitchen_raw_test.sh | bash
36 |
37 |
38 | cookbook_list
39 | What cookbooks to test. Separated by whitespace.
40 |
41 | If "ALL", all cookbooks under the given directory will be tested. Otherwise perform tests for given cookbooks.
42 | sandbox-test
43 |
44 |
45 | env_parameters
46 |
47 | export TEST_KITCHEN_YAML=.kitchen.yml
48 |
49 | export KEEP_FAILED_INSTANCE=false
50 | export KEEP_INSTANCE=false
51 | export DOCKER_IMAGE_URL=http://172.17.0.1:80/my_sandbox_latest.tar.gz
52 | export DOCKER_PORT_FORWARD_PREFIX=51
53 | export CLEAN_START=false
54 | export APP_BRANCH_NAME=sprint-34
55 | export FRAMEWORK_BRANCH_NAME=sprint-34
56 |
57 |
58 |
59 |
60 |
61 | true
62 | false
63 | false
64 | false
65 |
66 | true
67 |
68 |
69 | #!/bin/bash -e
70 | function download_script() {
71 | local download_file=${1?}
72 | . /etc/profile
73 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
74 | working_dir="/var/lib/jenkins/code/devops_public"
75 | bash_script="${working_dir}/${download_file}"
76 | dir_name=$(dirname "$bash_script")
77 |
78 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
79 | if [ ! -f "$bash_script" ]; then
80 | mkdir -p "$dir_name"
81 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
82 | chmod 755 "$bash_script"
83 | fi
84 | }
85 | ################################################################################
86 | download_file="chef/kitchen_test_cookbooks.sh"
87 | download_script "$download_file"
88 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/GitPullCode/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | git_pull_list
19 |
20 | # devops consultant
21 | /var/lib/jenkins/code,https://github.com/DennyZhang/devops_public.git,master
22 | /var/lib/jenkins/code/,https://github.com/DennyZhang/chef_community_cookbooks.git,master
23 |
24 |
25 |
26 |
27 |
28 | true
29 | false
30 | false
31 | false
32 | false
33 |
34 |
35 | #!/bin/bash -e
36 | function download_script() {
37 | local download_file=${1?}
38 | . /etc/profile
39 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
40 | working_dir="/var/lib/jenkins/code/devops_public"
41 | bash_script="${working_dir}/${download_file}"
42 | dir_name=$(dirname "$bash_script")
43 |
44 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
45 | if [ ! -f "$bash_script" ]; then
46 | mkdir -p "$dir_name"
47 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
48 | chmod 755 "$bash_script"
49 | fi
50 | }
51 | ################################################################################
52 | download_file="jenkins/jenkins_code_pull.sh"
53 | download_script "$download_file"
54 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | http://jenkins.dennyzhang.com:18080/
63 |
64 | false
65 | false
66 | false
67 | false
68 | true
69 | true
70 | true
71 | false
72 | false
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/ListHTTPTraffic/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | List all http requests made from given servers.
5 |
6 | Typical use scenario for this job is detect whether deployment will need to make unexpected outgoing traffic for external servers.
7 | false
8 |
9 |
10 |
11 | -1
12 | 50
13 | -1
14 | -1
15 |
16 |
17 |
18 |
19 |
20 | server_list
21 |
22 | 172.17.0.3:22:root
23 |
24 |
25 |
26 | env_parameters
27 |
28 | export FORCE_RESTART_JUSTNIFFER_PROCESS=false
29 | export STOP_JUSTNIFFER_PROCESS=false
30 |
31 |
32 |
33 |
34 |
35 |
36 | true
37 | false
38 | false
39 | false
40 |
41 | false
42 |
43 |
44 | #!/bin/bash -e
45 | function download_script() {
46 | local download_file=${1?}
47 | . /etc/profile
48 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
49 | working_dir="/var/lib/jenkins/code/devops_public"
50 | bash_script="${working_dir}/${download_file}"
51 | dir_name=$(dirname "$bash_script")
52 |
53 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
54 | if [ ! -f "$bash_script" ]; then
55 | mkdir -p "$dir_name"
56 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
57 | chmod 755 "$bash_script"
58 | fi
59 | }
60 | ################################################################################
61 | download_file="network/list_http_traffic.sh"
62 | download_script "$download_file"
63 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/LongRunAllInOne/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | cat > /root/provision_longrunaio.sh <<EOF
5 | #!/bin/bash -e
6 | docker stop longrun-aio
7 | docker rm longrun-aio
8 | rm -rf /data/docker/longrunaio/couchbase && mkdir -p /data/docker/longrunaio/couchbase
9 |
10 | docker run -t -d --privileged -h longrunaio --name longrun-aio -p 7022:22 -v /data/docker/longrunaio/couchbase:/opt/couchbase denny/aio:latest /usr/sbin/sshd -D
11 |
12 | docker exec -it longrun-aio wget -O /root/devops_provision_os.sh https://raw.githubusercontent.com/DennyZhang/devops_public/master/chef/devops_provision_os.sh
13 |
14 | docker exec -it longrun-aio bash /root/devops_provision_os.sh
15 | EOF
16 |
17 | bash /root/provision_longrunaio.sh
18 |
19 | # For the first time, run deployment with whether_flushdatabaseonconnect true. For the following, run with false
20 | false
21 |
22 |
23 |
24 | -1
25 | 50
26 | -1
27 | -1
28 |
29 |
30 |
31 |
32 |
33 | ssh_server_ip
34 |
35 | 172.17.0.1
36 |
37 |
38 | ssh_port
39 |
40 | 7022
41 |
42 |
43 | project_name
44 |
45 | all-in-one
46 |
47 |
48 | devops_branch_name
49 |
50 | master
51 |
52 |
53 | chef_json
54 |
55 | {
56 | "run_list": ["recipe[all-in-one]"],
57 | "common_basic":
58 | {"app_branch_name": "sprint-32",
59 | "framework_branch_name": "sprint-32",
60 | "package_url":"http://172.17.0.2:18000"},
61 | "os_basic":
62 | {"enable_firewall": "0"},
63 | "elasticsearch_mdm":
64 | {"elasticsearch_clustername": "longaio-mdm"},
65 | "all_in_one":
66 | {"mgmt_timeout": "900000",
67 | "max_timeout": "960000"
68 | },
69 | "app_mdm":
70 | {"cb_bucket_retries": "10",
71 | "cb_bucket_retryinterval": "10000",
72 | "cb_bucket_timeout": "100000",
73 | "whether_flushdatabaseonconnect": "false"
74 | },
75 | "nagois_mdm":
76 | {"mdm_http_port": "8443",
77 | "enable_nagios_check": "0",
78 | "enable_gui_check": "0"
79 | }
80 | }
81 |
82 |
83 | check_command
84 |
85 | sleep 10; service myservice status
86 |
87 |
88 | env_parameters
89 |
90 | export STOP_CONTAINER=true
91 | export KILL_RUNNING_CHEF_UPDATE=false
92 | export START_COMMAND="docker start longrun-aio"
93 | export POST_START_COMMAND="service couchbase-server start; service elasticsearch start; service mdm start; true"
94 | export PRE_STOP_COMMAND="service mdm stop; service elasticsearch stop; service couchbase-server start; true"
95 | export STOP_COMMAND="docker stop longrun-aio"
96 | export git_repo_url="https://github.com/DennyZhang/chef_community_cookbooks.git"
97 | export code_dir="/root/chef/"
98 | export CODE_SH='/root/git_update.sh'
99 |
100 |
101 |
102 |
103 |
104 | true
105 | false
106 | false
107 | false
108 |
109 | false
110 |
111 |
112 | #!/bin/bash -e
113 | function download_script() {
114 | local download_file=${1?}
115 | . /etc/profile
116 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
117 | working_dir="/var/lib/jenkins/code/devops_public"
118 | bash_script="${working_dir}/${download_file}"
119 | dir_name=$(dirname "$bash_script")
120 |
121 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
122 | if [ ! -f "$bash_script" ]; then
123 | mkdir -p "$dir_name"
124 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
125 | chmod 755 "$bash_script"
126 | fi
127 | }
128 | ################################################################################
129 | download_file="chef/longrun_allinone.sh"
130 | download_script "$download_file"
131 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 | http://jenkins.dennyzhang.com:18080/
140 |
141 | false
142 | false
143 | false
144 | false
145 | true
146 | true
147 | true
148 | false
149 | false
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/LongRunCluster/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # Create docker network, so that container's ip persist
5 | docker network create --subnet=172.18.0.0/16 longruncluster
6 |
7 | cat > /root/provision_longruncluster.sh << EOF
8 | #!/bin/bash -e
9 | docker stop kitchen-cluster-node1 kitchen-cluster-node2 kitchen-cluster-node3
10 | docker rm kitchen-cluster-node1 kitchen-cluster-node2 kitchen-cluster-node3
11 |
12 | rm -rf /data/docker/longruncluster/ && mkdir -p /data/docker/longruncluster/couchbase1 /data/docker/longruncluster/couchbase2 /data/docker/longruncluster/couchbase3
13 |
14 | docker run -t -d -h kitchen-cluster-node1 --name kitchen-cluster-node1 --privileged -p 5122:22 --net=longruncluster --ip 172.18.0.22 -v /data/docker/longruncluster/couchbase1:/opt/couchbase denny/aio:latest /usr/sbin/sshd -D
15 | docker run -t -d -h kitchen-cluster-node2 --name kitchen-cluster-node2 --privileged -p 5123:22 --net=longruncluster --ip 172.18.0.23 -v /data/docker/longruncluster/couchbase2:/opt/couchbase denny/aio:latest /usr/sbin/sshd -D
16 | docker run -t -d -h kitchen-cluster-node3 --name kitchen-cluster-node3 --privileged -p 5124:22 --net=longruncluster --ip 172.18.0.24 -v /data/docker/longruncluster/couchbase3:/opt/couchbase denny/aio:latest /usr/sbin/sshd -D
17 |
18 | docker exec -it kitchen-cluster-node1 wget -O /root/devops_provision_os.sh https://raw.githubusercontent.com/DennyZhang/devops_public/master/chef/devops_provision_os.sh
19 | docker exec -it kitchen-cluster-node2 wget -O /root/devops_provision_os.sh https://raw.githubusercontent.com/DennyZhang/devops_public/master/chef/devops_provision_os.sh
20 | docker exec -it kitchen-cluster-node3 wget -O /root/devops_provision_os.sh https://raw.githubusercontent.com/DennyZhang/devops_public/master/chef/devops_provision_os.sh
21 |
22 | docker exec -it kitchen-cluster-node1 bash /root/devops_provision_os.sh
23 | docker exec -it kitchen-cluster-node2 bash /root/devops_provision_os.sh
24 | docker exec -it kitchen-cluster-node3 bash /root/devops_provision_os.sh
25 |
26 | EOF
27 |
28 | bash /root/provision_longruncluster.sh
29 |
30 | # For initial setup:
31 | # 1. Run for first time, set initialize_system true, STOP_CONTAINER false
32 | # 2. Run for second time, with everything default
33 | false
34 |
35 |
36 |
37 | -1
38 | 50
39 | -1
40 | -1
41 |
42 |
43 |
44 |
45 |
46 | server_list
47 |
48 | # server_ip:ssh_port
49 | 172.17.0.1:5122
50 | 172.17.0.1:5123
51 | 172.17.0.1:5124
52 |
53 |
54 | initialize_system
55 |
56 | true
57 |
58 |
59 | app_branch_name
60 |
61 | sprint-32
62 |
63 |
64 | framework_branch_name
65 |
66 | sprint-32
67 |
68 |
69 | devops_branch_name
70 |
71 | sprint-32
72 |
73 |
74 | elasticsearch_clustername
75 |
76 | kitchen-cluster-mdm
77 |
78 |
79 | deploy_run_list
80 |
81 | "recipe[mdm-cluster::default]"
82 |
83 |
84 | chef_json
85 |
86 | {
87 | "common_basic":
88 | {
89 | # service hosts: deploy service to which host
90 | "couchbase_hosts":["kitchen-cluster-node1", "kitchen-cluster-node2"],
91 | "elasticsearch_hosts":["kitchen-cluster-node1", "kitchen-cluster-node2"],
92 | "xxx_hosts":["kitchen-cluster-node2", "kitchen-cluster-node3"],
93 | "haproxy_hosts":["kitchen-cluster-node1","kitchen-cluster-node2"],
94 | "nagios_server":"kitchen-cluster-node3",
95 |
96 | # specify branch name
97 | "app_branch_name":"$app_branch_name",
98 | "framework_branch_name":"$framework_branch_name",
99 | "devops_branch_name":"$devops_branch_name",
100 |
101 | "package_url":"http://172.17.0.1.:80",
102 |
103 | # tcp ports
104 | "haproxy_port":"8182",
105 | "haproxy_ssl_port":"443",
106 | "app_http_port":"8080",
107 | "app_https_port":"8443"
108 | },
109 | "couchbase_xxx":
110 | {"memory_quota_mb":"2048"},
111 | "elasticsearch_xxx":
112 | {"allocated_memory_mb":"512",
113 | "audit_allocated_memory_mb":"256",
114 | "enable_audit_elasticsearch":"true",
115 | "elasticsearch_clustername":"$elasticsearch_clustername",
116 | "elasticsearch_audit_clustername":"$elasticsearch_clustername-audit"
117 | },
118 | "app_xxx":
119 | {"maxSimultaneousThreads":"8",
120 | "maxTotalThreads":"64",
121 | "cb_bucket_retries":"10",
122 | "cb_bucket_retryinterval":"10000",
123 | "cb_bucket_timeout":"100000",
124 | "session_bucket_quota_in_mb":"100",
125 | "staging_bucket_quota_in_mb":"512",
126 | "master_bucket_quota_in_mb":"640",
127 | "mgmt_timeout":"900000",
128 | "max_timeout":"960000",
129 | "xxx_java_opts":"-Xms1024m -Xmx1024m",
130 | "whether_flushdatabaseonconnect":"$initialize_system",
131 | "whether_populatefakedata":"$initialize_system",
132 | "whether_populaterealdata":"$initialize_system",
133 | "whether_populategenerateddata":"$initialize_system"
134 | }
135 | }
136 |
137 |
138 | ssh_private_key
139 |
140 |
141 |
142 |
143 | env_parameters
144 |
145 | export STOP_CONTAINER=true
146 | export KILL_RUNNING_CHEF_UPDATE=false
147 |
148 | export git_repo_url="git@github.com:TOTVS/mdmdevops.git"
149 | export CODE_SH='/root/git_update.sh'
150 | export code_dir='/root/chef'
151 | export START_COMMAND="ssh root@172.17.0.1 docker start kitchen-cluster-node1 kitchen-cluster-node2 kitchen-cluster-node3"
152 | export STOP_COMMAND="ssh root@172.17.0.1 docker stop kitchen-cluster-node1 kitchen-cluster-node2 kitchen-cluster-node3"
153 |
154 | export POST_START_COMMAND="sleep 5;
155 | ssh -p 5122 root@172.17.0.1 'cp /opt/hosts /etc/hosts; true';
156 | ssh -p 5123 root@172.17.0.1 'cp /opt/hosts /etc/hosts; true';
157 | ssh -p 5124 root@172.17.0.1 'cp /opt/hosts /etc/hosts; true';
158 |
159 | ssh -p 5122 root@172.17.0.1 '/root/manage_all_services.sh start couchbase-server,elasticsearch';
160 | sleep 5;
161 | ssh -p 5123 root@172.17.0.1 '/root/manage_all_services.sh start couchbase-server,elasticsearch';
162 | sleep 5;
163 | ssh -p 5124 root@172.17.0.1 '/root/manage_all_services.sh start couchbase-server,elasticsearch';
164 |
165 | sleep 10;
166 |
167 | ssh -p 5122 root@172.17.0.1 '/root/manage_all_services.sh start mdm || true';
168 | sleep 15;
169 | ssh -p 5123 root@172.17.0.1 '/root/manage_all_services.sh start mdm || true';
170 | sleep 15;
171 | ssh -p 5124 root@172.17.0.1 '/root/manage_all_services.sh start mdm || true';
172 |
173 | ssh -p 5122 root@172.17.0.1 '/root/manage_all_services.sh status couchbase-server,elasticsearch,mdm';
174 | ssh -p 5123 root@172.17.0.1 '/root/manage_all_services.sh status couchbase-server,elasticsearch,mdm';
175 | ssh -p 5124 root@172.17.0.1 '/root/manage_all_services.sh status couchbase-server,elasticsearch,mdm';
176 | "
177 |
178 | export PRE_STOP_COMMAND="
179 | ssh -p 5122 root@172.17.0.1 'cat /root/chef_update/report.txt; /root/manage_all_services.sh stop mdm,elasticsearch,couchbase-server';
180 | ssh -p 5123 root@172.17.0.1 'cat /root/chef_update/report.txt; /root/manage_all_services.sh stop mdm,elasticsearch,couchbase-server';
181 | ssh -p 5124 root@172.17.0.1 'cat /root/chef_update/report.txt; /root/manage_all_services.sh stop mdm,elasticsearch,couchbase-server';
182 | "
183 |
184 |
185 |
186 |
187 |
188 | true
189 | false
190 | false
191 | false
192 |
193 | false
194 |
195 |
196 | #!/bin/bash -e
197 | function download_script() {
198 | local download_file=${1?}
199 | . /etc/profile
200 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
201 | working_dir="/var/lib/jenkins/code/devops_public"
202 | bash_script="${working_dir}/${download_file}"
203 | dir_name=$(dirname "$bash_script")
204 |
205 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
206 | if [ ! -f "$bash_script" ]; then
207 | mkdir -p "$dir_name"
208 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
209 | chmod 755 "$bash_script"
210 | fi
211 | }
212 | ################################################################################
213 | download_file="chef/deploy_cluster.sh"
214 | download_script "$download_file"
215 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 | http://jenkins.dennyzhang.com:18080/
224 |
225 | false
226 | false
227 | false
228 | false
229 | true
230 | true
231 | true
232 | false
233 | false
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
--------------------------------------------------------------------------------
/MonitorGitFileChanges/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Monitor Git repo to interested file changes.
5 |
6 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/MonitorGitFileChanges/config.xml
7 |
8 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/MonitorGitFileChanges.png
9 |
10 | Read more: https://www.dennyzhang.com/avoid_toi_communication/
11 | false
12 |
13 |
14 |
15 | -1
16 | 50
17 | -1
18 | -1
19 |
20 |
21 |
22 |
23 |
24 | git_repo_url
25 |
26 | https://github.com/DennyZhang/devops_public.git
27 |
28 |
29 | branch_name
30 |
31 | master
32 |
33 |
34 | filelist_to_monitor
35 |
36 | devops_common_library.cksum
37 |
38 |
39 | env_parameters
40 |
41 | export MARK_PREVIOUS_FIXED=false
42 | export CLEAN_START=false
43 |
44 |
45 |
46 |
47 |
48 | true
49 | false
50 | false
51 | false
52 | false
53 |
54 |
55 | #!/bin/bash -e
56 | function download_script() {
57 | local download_file=${1?}
58 | . /etc/profile
59 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
60 | working_dir="/var/lib/jenkins/code/devops_public"
61 | bash_script="${working_dir}/${download_file}"
62 | dir_name=$(dirname "$bash_script")
63 |
64 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
65 | if [ ! -f "$bash_script" ]; then
66 | mkdir -p "$dir_name"
67 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
68 | chmod 755 "$bash_script"
69 | fi
70 | }
71 | ################################################################################
72 | download_file="monitor/monitor_git_filechanges.sh"
73 | download_script "$download_file"
74 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | http://jenkins.dennyzhang.com:18080/
83 |
84 | false
85 | false
86 | false
87 | false
88 | true
89 | true
90 | true
91 | false
92 | false
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/MonitorITResource/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/MonitorITResource/config.xml
6 |
7 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/MonitorITResource.png
8 |
9 |
10 | false
11 |
12 |
13 |
14 | -1
15 | 50
16 | -1
17 | -1
18 |
19 |
20 |
21 |
22 |
23 | test_spec
24 |
25 | # Check anonymous http links
26 | [# "https://www.dennyzhang.com", # HTTP repo,
27 | "https://github.com/",
28 | ].each do |url|
29 | describe command('curl -I -k %s 2>&1' %[url]) do
30 | its(:stdout) { should match /HTTP\/1.1 200 OK/ }
31 | end
32 | end
33 |
34 | # Check remote tcp port
35 | [# "124.57.240.190:29995", # ssh reversel tunnel
36 | #"52.74.151.55:29995", # ssh reversel tunnel
37 | ].each do |ip_port|
38 | (ip, port) = ip_port.split(':')
39 | describe command('nc -z -v -w5 %s %s 2>&1' %[ip, port]) do
40 | its(:stdout) { should match /Connection to.*succeeded/ }
41 | end
42 | end
43 |
44 | # # Check free disk: >=10GB
45 | # describe command("[ `ssh root@104.236.159.226 df -h /data | tail -n1 |awk -F' ' '{print $4}' | awk -F'G' '{print $1}' | awk -F'.' '{print $1}'` -gt 10 ]") do
46 | # its(:exit_status) { should eq 0 }
47 | # end
48 |
49 | # # check whether ssl certificate expire in 30 days
50 | # ["mydata.com:443"].each do |domain_port|
51 | # describe command('echo | openssl s_client -connect ' + domain_port + \
52 | # ' 2>/dev/null | openssl x509 -noout -subject -enddate -checkend 2592000') do
53 | # its(:exit_status) { should eq 0 }
54 | # end
55 | # end
56 |
57 | # # Check at least 2 GB free memory
58 | # describe command("[ `free -ml | grep 'buffers/cache' | awk -F' ' '{print $4}'` -gt 2048 ]") do
59 | # its(:exit_status) { should eq 0 }
60 | # end
61 |
62 |
63 |
64 |
65 |
66 |
67 | true
68 | false
69 | false
70 | false
71 | false
72 |
73 |
74 | #!/bin/bash -e
75 | function download_script() {
76 | local download_file=${1?}
77 | . /etc/profile
78 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
79 | working_dir="/var/lib/jenkins/code/devops_public"
80 | bash_script="${working_dir}/${download_file}"
81 | dir_name=$(dirname "$bash_script")
82 |
83 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
84 | if [ ! -f "$bash_script" ]; then
85 | mkdir -p "$dir_name"
86 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
87 | chmod 755 "$bash_script"
88 | fi
89 | }
90 | ################################################################################
91 | download_file="monitor/serverspec_check.sh"
92 | download_script "$download_file"
93 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/MonitorNewActiveSprint/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Detect whether active sprint is changed
5 |
6 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/MonitorNewActiveSprint/config.xml
7 |
8 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/MonitorNewActiveSprint.png
9 |
10 | Read more: https://www.dennyzhang.com/slack_activesprint/
11 | false
12 |
13 |
14 |
15 | -1
16 | 50
17 | -1
18 | -1
19 |
20 |
21 |
22 |
23 |
24 | git_repo_url
25 |
26 | https://github.com/DennyZhang/chef_community_cookbooks.git
27 |
28 |
29 | branch_name
30 |
31 | master
32 |
33 |
34 | activesprint_branch_pattern
35 |
36 | ^sprint-[0-9]+$
37 |
38 |
39 | env_parameters
40 |
41 | export MARK_PREVIOUS_FIXED=false
42 | export CLEAN_START=false
43 |
44 |
45 |
46 |
47 |
48 | true
49 | false
50 | false
51 | false
52 | false
53 |
54 |
55 | #!/bin/bash -e
56 | function download_script() {
57 | local download_file=${1?}
58 | . /etc/profile
59 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
60 | working_dir="/var/lib/jenkins/code/devops_public"
61 | bash_script="${working_dir}/${download_file}"
62 | dir_name=$(dirname "$bash_script")
63 |
64 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
65 | if [ ! -f "$bash_script" ]; then
66 | mkdir -p "$dir_name"
67 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
68 | chmod 755 "$bash_script"
69 | fi
70 | }
71 | ################################################################################
72 | download_file="monitor/monitor_git_branch_list.sh"
73 | download_script "$download_file"
74 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | http://jenkins.dennyzhang.com:18080/
83 |
84 | false
85 | false
86 | false
87 | false
88 | true
89 | true
90 | true
91 | false
92 | false
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/MonitorProcess/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | process_list
19 |
20 | # Columns Explained: ssh_ip, ssh_port, ssh username, type, pid pattern
21 | 172.17.0.1:22:root:cmdpattern:docker.*daemon
22 | 172.17.0.1:22:root:pid:1104
23 |
24 |
25 |
26 | env_parameters
27 |
28 | export UPDATE_SERVER_SCRIPT=true
29 |
30 |
31 |
32 |
33 |
34 | true
35 | false
36 | false
37 | false
38 |
39 | false
40 |
41 |
42 | #!/bin/bash -e
43 | function download_script() {
44 | local download_file=${1?}
45 | . /etc/profile
46 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
47 | working_dir="/var/lib/jenkins/code/devops_public"
48 | bash_script="${working_dir}/${download_file}"
49 | dir_name=$(dirname "$bash_script")
50 |
51 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
52 | if [ ! -f "$bash_script" ]; then
53 | mkdir -p "$dir_name"
54 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
55 | chmod 755 "$bash_script"
56 | fi
57 | }
58 | ################################################################################
59 | download_file="monitor/monitor_remote_process.sh"
60 | download_script "$download_file"
61 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/MonitorServerFileChangesAudit/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Monitor servers for key files change. Once they are changed, send out alerts. This helps us to detect malicious or unexpected changes.
5 |
6 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/MonitorServerFileChangesAudit/config.xml
7 |
8 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/MonitorServerFileChangesAudit.png
9 |
10 | Read more: https://www.dennyzhang.com/monitor_filechange/
11 | false
12 |
13 |
14 |
15 | -1
16 | 50
17 | -1
18 | -1
19 |
20 |
21 |
22 |
23 |
24 | server_list
25 |
26 | 172.17.0.2:22
27 | 172.17.0.1:2702
28 |
29 |
30 | file_list
31 |
32 | /etc/hosts
33 | /etc/rc.local
34 | /root/.ssh/authorized_keys
35 | /tmp/hosts
36 |
37 |
38 | env_parameters
39 |
40 | export MARK_PREVIOUS_AS_TRUE=false
41 | export FORCE_RESTART_INOTIFY_PROCESS=false
42 | export CLEAN_START=false
43 |
44 |
45 |
46 |
47 |
48 | true
49 | false
50 | false
51 | false
52 | false
53 |
54 |
55 | #!/bin/bash -e
56 | function download_script() {
57 | local download_file=${1?}
58 | . /etc/profile
59 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
60 | working_dir="/var/lib/jenkins/code/devops_public"
61 | bash_script="${working_dir}/${download_file}"
62 | dir_name=$(dirname "$bash_script")
63 |
64 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
65 | if [ ! -f "$bash_script" ]; then
66 | mkdir -p "$dir_name"
67 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
68 | chmod 755 "$bash_script"
69 | fi
70 | }
71 | ################################################################################
72 | download_file="monitor/monitor_server_filechanges.sh"
73 | download_script "$download_file"
74 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | http://jenkins.dennyzhang.com:18080/
83 |
84 | false
85 | false
86 | false
87 | false
88 | true
89 | true
90 | true
91 | false
92 | false
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/NetworkLatencyReport/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Check network latency by ssh or ping
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | from_ssh_server
19 |
20 | 172.17.0.3:22:root
21 |
22 |
23 | target_server_list
24 |
25 | 172.17.0.3:22:root
26 |
27 |
28 |
29 | env_parameters
30 |
31 | export CHECK_METHOD="ssh"
32 | export TIMEOUT_THRESHOLD_MS="1000"
33 | export ssh_key_file="/var/lib/jenkins/.ssh/id_rsa"
34 | export connect_key_file="/var/lib/jenkins/.ssh/id_rsa"
35 |
36 |
37 |
38 |
39 |
40 | true
41 | false
42 | false
43 | false
44 |
45 | false
46 |
47 |
48 | #!/bin/bash -e
49 | function download_script() {
50 | local download_file=${1?}
51 | . /etc/profile
52 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
53 | working_dir="/var/lib/jenkins/code/devops_public"
54 | bash_script="${working_dir}/${download_file}"
55 | dir_name=$(dirname "$bash_script")
56 |
57 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
58 | if [ ! -f "$bash_script" ]; then
59 | mkdir -p "$dir_name"
60 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
61 | chmod 755 "$bash_script"
62 | fi
63 | }
64 | ################################################################################
65 | download_file="network/network_latency_report.sh"
66 | download_script "$download_file"
67 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/NetworkTCPScanAuditReport/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | nmap TCP port scan to detect security hole.
5 |
6 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/NetworkTCPScanAuditReport/config.xml
7 |
8 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/NetworkTCPScanAuditReport.png
9 |
10 | Read more: https://www.dennyzhang.com/nmap_port_scan
11 | false
12 |
13 |
14 |
15 | -1
16 | 50
17 | -1
18 | -1
19 |
20 |
21 |
22 |
23 |
24 | server_list
25 |
26 | 172.17.0.1
27 | 172.17.0.2
28 |
29 |
30 | white_list
31 |
32 | *:22
33 | *:80
34 | *:443
35 | *:18080
36 | *:18000
37 | *:2702
38 | 172.17.0.1:9000
39 |
40 |
41 |
42 | extra_port_list
43 |
44 | 9200-9500
45 | 8091-8100
46 | 18080
47 | 18000
48 |
49 |
50 |
51 |
52 |
53 | true
54 | false
55 | false
56 | false
57 | false
58 |
59 |
60 | #!/bin/bash -e
61 | curl -o /tmp/tcp_port_scan.py https://raw.githubusercontent.com/DennyZhang/devops_public/tag_v2/python/tcp_port_scan/tcp_port_scan.py
62 |
63 | echo "$server_list" > "/tmp/server_list_${JOB_NAME}"
64 | echo "$white_list" > "/tmp/white_list_${JOB_NAME}"
65 | echo "$extra_port_list" > "/tmp/extra_port_list_${JOB_NAME}"
66 |
67 | set -x
68 | python /tmp/tcp_port_scan.py --server_list_file "/tmp/server_list_${JOB_NAME}" \
69 | --white_list_file "/tmp/white_list_${JOB_NAME}" \
70 | --extra_port_list_file "/tmp/extra_port_list_${JOB_NAME}"
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/OSPackageActionAuditReport/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | List recent actions of packages installation or removal for a given server
5 |
6 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/OSPackageActionAuditReport/config.xml
7 |
8 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/OSPackageActionAuditReport.png
9 |
10 | Read more: https://www.dennyzhang.com/list_packages_installed/
11 | false
12 |
13 |
14 |
15 | -1
16 | 50
17 | -1
18 | -1
19 |
20 |
21 |
22 |
23 |
24 | ssh_server
25 | ssh_ip, ssh_port, ssh_username
26 | 172.17.0.3:22:root
27 |
28 |
29 | env_parameters
30 |
31 | export HAS_INIT_ANALYSIS=false
32 | export PARSE_MAXIMUM_ENTRIES="500"
33 | export OS_VERSION="ubuntu-14.04"
34 |
35 |
36 |
37 |
38 |
39 | true
40 | false
41 | false
42 | false
43 |
44 | false
45 |
46 |
47 | #!/bin/bash -e
48 | function download_script() {
49 | local download_file=${1?}
50 | . /etc/profile
51 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
52 | working_dir="/var/lib/jenkins/code/devops_public"
53 | bash_script="${working_dir}/${download_file}"
54 | dir_name=$(dirname "$bash_script")
55 |
56 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
57 | if [ ! -f "$bash_script" ]; then
58 | mkdir -p "$dir_name"
59 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
60 | chmod 755 "$bash_script"
61 | fi
62 | }
63 | ################################################################################
64 | download_file="report/os_package_action_report.sh"
65 | download_script "$download_file"
66 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/PackageListReport/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | List recent actions of packages installation or removal for a given server
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | ssh_server
19 |
20 | 172.17.0.3:22:root
21 |
22 |
23 | env_parameters
24 |
25 | export CHECK_SCENARIO="all"
26 |
27 |
28 |
29 |
30 |
31 | true
32 | false
33 | false
34 | false
35 |
36 | false
37 |
38 |
39 | #!/bin/bash -e
40 | function download_script() {
41 | local download_file=${1?}
42 | . /etc/profile
43 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
44 | working_dir="/var/lib/jenkins/code/devops_public"
45 | bash_script="${working_dir}/${download_file}"
46 | dir_name=$(dirname "$bash_script")
47 |
48 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
49 | if [ ! -f "$bash_script" ]; then
50 | mkdir -p "$dir_name"
51 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
52 | chmod 755 "$bash_script"
53 | fi
54 | }
55 | ################################################################################
56 | download_file="report/package_list_report.sh"
57 | download_script "$download_file"
58 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/PipelineActiveSprint/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 |
5 |
6 | false
7 |
--------------------------------------------------------------------------------
/PipelineAddNodes/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | true
13 |
14 |
15 | false
16 |
--------------------------------------------------------------------------------
/PipelineMaster/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | true
13 |
14 |
15 | false
16 |
--------------------------------------------------------------------------------
/PipelineMonitor/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | true
13 |
14 |
15 | false
16 |
--------------------------------------------------------------------------------
/PipelineRemoveNodes/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | true
13 |
14 |
15 | false
16 |
--------------------------------------------------------------------------------
/PythonCodeQualityCheck/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | git_list
19 |
20 | # https://github.com/DennyZhang/chef_community_cookbooks.git,master
21 | https://github.com/DennyZhang/devops_public.git,master
22 | https://github.com/DennyZhang/devops_public.git,master
23 |
24 |
25 |
26 | env_parameters
27 |
28 | export pip_packages_install="elasticsearch,flask"
29 |
30 |
31 |
32 |
33 |
34 | true
35 | false
36 | false
37 | false
38 | false
39 |
40 |
41 | #!/bin/bash -e
42 | function download_script() {
43 | local download_file=${1?}
44 | . /etc/profile
45 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
46 | working_dir="/var/lib/jenkins/code/devops_public"
47 | bash_script="${working_dir}/${download_file}"
48 | dir_name=$(dirname "$bash_script")
49 |
50 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
51 | if [ ! -f "$bash_script" ]; then
52 | mkdir -p "$dir_name"
53 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
54 | chmod 755 "$bash_script"
55 | fi
56 | }
57 | ################################################################################
58 | download_file="code_style/python_style_check.sh"
59 | download_script "$download_file"
60 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [](https://www.linkedin.com/in/dennyzhang001) [](https://github.com/DennyZhang)
4 |
5 | - File me [tickets](https://github.com/DennyZhang/devops_jenkins/issues) or star [the repo](https://github.com/DennyZhang/devops_jenkins)
6 |
7 | Jenkins Jobs To Perform Routine DevOps Tasks Easily
8 |
9 | Check this to learn more: https://www.dennyzhang.com/tag/jenkins
10 |
11 | ```
12 | git clone https://github.com/DennyZhang/devops_jenkins.git
13 | mv devops_jenkins jobs
14 | chmod 777 -R jobs
15 | ```
16 |
17 | Code is licensed under [MIT License](https://www.dennyzhang.com/wp-content/mit_license.txt).
18 |
--------------------------------------------------------------------------------
/ReplicateGitRepoCode/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | repo_list
19 |
20 | # Columns explained: customer_git_repo, customer_branch_name, out_git_repo, our_branch_name
21 |
22 |
23 |
24 | env_parameters
25 |
26 | export CLEAN_START=false
27 |
28 |
29 |
30 |
31 |
32 | true
33 | false
34 | false
35 | false
36 |
37 |
38 | #!/bin/bash -e
39 | function download_script() {
40 | local download_file=${1?}
41 | . /etc/profile
42 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
43 | working_dir="/var/lib/jenkins/code/devops_public"
44 | bash_script="${working_dir}/${download_file}"
45 | dir_name=$(dirname "$bash_script")
46 |
47 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
48 | if [ ! -f "$bash_script" ]; then
49 | mkdir -p "$dir_name"
50 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
51 | chmod 755 "$bash_script"
52 | fi
53 | }
54 | ################################################################################
55 | download_file="jenkins/replicate_git_repos.sh"
56 | download_script "$download_file"
57 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | http://jenkins.dennyzhang.com:18080/
66 |
67 | false
68 | false
69 | false
70 | false
71 | true
72 | true
73 | true
74 | false
75 | false
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/RubyCodeQualityCheck/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/RubyCodeQualityCheck/config.xml
5 |
6 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/RubyCodeQualityCheck.png
7 |
8 | Read more: https://www.dennyzhang.com/rubocop_errors
9 | false
10 |
11 |
12 |
13 | -1
14 | 50
15 | -1
16 | -1
17 |
18 |
19 |
20 |
21 |
22 | git_list
23 |
24 | https://github.com/DennyZhang/chef_community_cookbooks.git,master
25 | https://github.com/DennyZhang/devops_public.git,master
26 |
27 |
28 |
29 | env_parameters
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | true
38 | false
39 | false
40 | false
41 | false
42 |
43 |
44 | #!/bin/bash -e
45 | function download_script() {
46 | local download_file=${1?}
47 | . /etc/profile
48 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
49 | working_dir="/var/lib/jenkins/code/devops_public"
50 | bash_script="${working_dir}/${download_file}"
51 | dir_name=$(dirname "$bash_script")
52 |
53 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
54 | if [ ! -f "$bash_script" ]; then
55 | mkdir -p "$dir_name"
56 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
57 | chmod 755 "$bash_script"
58 | fi
59 | }
60 | ################################################################################
61 | download_file="code_style/chef_style_check.sh"
62 | download_script "$download_file"
63 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/RunCommandOnServers/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Run remote commands on multiple servers by ssh
5 |
6 | Job Configuration: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/RunCommandOnServers/config.xml
7 |
8 | Job Screenshot: https://github.com/DennyZhang/devops_jenkins/blob/tag_v6/images_screenshot/RunCommandOnServers.png
9 |
10 | Read more: https://www.dennyzhang.com/jenkins_run_ssh
11 | false
12 |
13 |
14 |
15 | -1
16 | 50
17 | -1
18 | -1
19 |
20 |
21 |
22 | false
23 |
24 |
25 |
26 |
27 | server_list
28 |
29 | 172.17.0.3
30 | 172.17.0.4
31 |
32 |
33 |
34 | command_list
35 |
36 | cat /etc/hosts
37 | ls /opt/
38 |
39 |
40 | env_parameters
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | true
49 | false
50 | false
51 | false
52 |
53 | false
54 |
55 |
56 | #!/bin/bash -e
57 | function download_script() {
58 | local download_file=${1?}
59 | . /etc/profile
60 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
61 | working_dir="/var/lib/jenkins/code/devops_public"
62 | bash_script="${working_dir}/${download_file}"
63 | dir_name=$(dirname "$bash_script")
64 |
65 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
66 | if [ ! -f "$bash_script" ]; then
67 | mkdir -p "$dir_name"
68 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
69 | chmod 755 "$bash_script"
70 | fi
71 | }
72 | ################################################################################
73 | download_file="jenkins/run_command_on_servers.sh"
74 | download_script "$download_file"
75 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/RunRemoteCommand/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | command_list
19 |
20 | # Columns Explained: ssh ip, ssh port, username, bash command
21 |
22 | # Remove old remote backup older than 30 days
23 | 172.17.0.3:22:root:find /tmp -type f -mtime +30 -and -not -type d -delete
24 |
25 |
26 |
27 | env_parameters
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | true
36 | false
37 | false
38 | false
39 | false
40 |
41 |
42 | #!/bin/bash -e
43 | function download_script() {
44 | local download_file=${1?}
45 | . /etc/profile
46 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
47 | working_dir="/var/lib/jenkins/code/devops_public"
48 | bash_script="${working_dir}/${download_file}"
49 | dir_name=$(dirname "$bash_script")
50 |
51 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
52 | if [ ! -f "$bash_script" ]; then
53 | mkdir -p "$dir_name"
54 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
55 | chmod 755 "$bash_script"
56 | fi
57 | }
58 | ################################################################################
59 | download_file="jenkins/run_remote_command.sh"
60 | download_script "$download_file"
61 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | http://jenkins.dennyzhang.com:18080/
70 |
71 | false
72 | false
73 | false
74 | false
75 | true
76 | true
77 | true
78 | false
79 | false
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/SSHLoginAuditReport/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SSH login report for successful ssh sessions.
5 |
6 | This would be helpful to detect:
7 | - Who has ssh to my server. If using ssh key, it will translate it to associated email.
8 | - How long he/she stays
9 | false
10 |
11 |
12 |
13 | -1
14 | 50
15 | -1
16 | -1
17 |
18 |
19 |
20 |
21 |
22 | ssh_server
23 | ssh_ip, ssh_port, ssh_username
24 | 172.17.0.3:22:root
25 |
26 |
27 | env_parameters
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | true
36 | false
37 | false
38 | false
39 |
40 | false
41 |
42 |
43 | #!/bin/bash -e
44 | function download_script() {
45 | local download_file=${1?}
46 | . /etc/profile
47 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
48 | working_dir="/var/lib/jenkins/code/devops_public"
49 | bash_script="${working_dir}/${download_file}"
50 | dir_name=$(dirname "$bash_script")
51 |
52 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
53 | if [ ! -f "$bash_script" ]; then
54 | mkdir -p "$dir_name"
55 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
56 | chmod 755 "$bash_script"
57 | fi
58 | }
59 | ################################################################################
60 | download_file="report/ssh_login_report.sh"
61 | download_script "$download_file"
62 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/SonarCodeQualityCheck/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | git_repo_url
19 | Repo url for source code.
20 | https://github.com/DennyZhang/java8-tutorial.git
21 |
22 |
23 | branch_name
24 | Which branch to build.
25 | master
26 |
27 |
28 | env_parameters
29 |
30 | export SONAR_BASE_URL=http://jenkinscn.dennyzhang.com:49000
31 | export SONAR_PROJECTKEY=
32 | export REFRESH_SONAR_CONF=true
33 | export SONAR_LANGUAGE=java
34 |
35 |
36 |
37 |
38 |
39 | true
40 | false
41 | false
42 | false
43 |
44 | false
45 |
46 |
47 | #!/bin/bash -e
48 | function download_script() {
49 | local download_file=${1?}
50 | . /etc/profile
51 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
52 | working_dir="/var/lib/jenkins/code/devops_public"
53 | bash_script="${working_dir}/${download_file}"
54 | dir_name=$(dirname "$bash_script")
55 |
56 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
57 | if [ ! -f "$bash_script" ]; then
58 | mkdir -p "$dir_name"
59 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
60 | chmod 755 "$bash_script"
61 | fi
62 | }
63 | ################################################################################
64 | download_file="code_style/sonar_static_check.sh"
65 | download_script "$download_file"
66 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | http://jenkins.dennyzhang.com:18080/
75 |
76 | false
77 | false
78 | false
79 | false
80 | true
81 | true
82 | true
83 | false
84 | false
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/SyncHTTPRepoServer/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | repo_server
19 |
20 | http://104.131.129.100:80/
21 |
22 |
23 | dst_path
24 |
25 | /var/www/repo/image/
26 |
27 |
28 | download_files
29 |
30 | denny_protractor_v1.tar.bz2
31 | denny_atlassian_v1.tar.bz2
32 | denny_chefserver_v1.tar.bz2
33 | denny_devubuntu_v1.tar.bz2
34 | denny_elk_v1.tar.bz2
35 | denny_ftp_v1.tar.bz2
36 | denny_hadoop_v1.tar.bz2
37 | denny_jenkins_v1.tar.bz2
38 | denny_openvpn_v1.tar.bz2
39 | denny_shadowsock_v1.tar.bz2
40 | denny_squid_v1.tar.bz2
41 | denny_sshd_v1.tar.bz2
42 |
43 |
44 |
45 |
46 |
47 | true
48 | false
49 | false
50 | false
51 |
52 | false
53 |
54 |
55 | #!/bin/bash -e
56 | function download_script() {
57 | local download_file=${1?}
58 | . /etc/profile
59 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
60 | working_dir="/var/lib/jenkins/code/devops_public"
61 | bash_script="${working_dir}/${download_file}"
62 | dir_name=$(dirname "$bash_script")
63 |
64 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
65 | if [ ! -f "$bash_script" ]; then
66 | mkdir -p "$dir_name"
67 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
68 | chmod 755 "$bash_script"
69 | fi
70 | }
71 | ################################################################################
72 | download_file="jenkins/sync_http_repo_server.sh"
73 | download_script "$download_file"
74 | bash -e "/var/lib/jenkins/code/devops_public/$download_file"
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/VerifyGUILogin/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 | -1
10 | 50
11 | -1
12 | -1
13 |
14 |
15 |
16 |
17 |
18 | protractor_rest_server
19 | REST API to accept GUI verification requests.
20 | http://${protractor_rest_server}/protractor_request
21 |
22 | 104.131.129.100:4445
23 |
24 |
25 | protractor_testcase_js
26 |
27 | describe('angularjs homepage todo list', function() {
28 | it('should add a todo', function() {
29 | browser.get('https://angularjs.org');
30 |
31 | element(by.model('todoList.todoText')).sendKeys('write first protractor test');
32 | element(by.css('[value="add"]')).click();
33 |
34 | var todoList = element.all(by.repeater('todo in todoList.todos'));
35 | expect(todoList.count()).toEqual(3);
36 | expect(todoList.get(2).getText()).toEqual('write first protractor test');
37 |
38 | // You wrote your first test, cross it off the list
39 | todoList.get(2).element(by.css('input')).click();
40 | var completedAmount = element.all(by.css('.done-true'));
41 | expect(completedAmount.count()).toEqual(2);
42 |
43 | var working_dir = "/opt/protractor/"
44 | var file = working_dir + "test.png"
45 | var fs = require('fs');
46 | browser.takeScreenshot().then(function (png) {
47 | console.log('Writing file ' + file);
48 | fs.writeFileSync(file, png, {encoding: 'base64'}, console.log);
49 | }, console.log);
50 | });
51 | });
52 |
53 |
54 | conf_js
55 |
56 | exports.config = {
57 | seleniumAddress: 'http://localhost:4444/wd/hub',
58 | specs: ['/opt/protractor/protractor.js']
59 | };
60 |
61 |
62 | env_parameters
63 |
64 | export REMOVE_TMP_FILES=true
65 |
66 |
67 |
68 |
69 |
70 | true
71 | false
72 | false
73 | false
74 |
75 | false
76 |
77 |
78 | #!/bin/bash -e
79 | function download_script() {
80 | local download_file=${1?}
81 | . /etc/profile
82 | [ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v2"
83 | working_dir="/var/lib/jenkins/code/devops_public"
84 | bash_script="${working_dir}/${download_file}"
85 | dir_name=$(dirname "$bash_script")
86 |
87 | export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
88 | if [ ! -f "$bash_script" ]; then
89 | mkdir -p "$dir_name"
90 | wget -O "$bash_script" "${DOWNLOAD_PREFIX}/jenkins_scripts/${download_file}"
91 | chmod 755 "$bash_script"
92 | fi
93 | }
94 | ################################################################################
95 | download_script "gui_test/protractor_verify_gui_login.sh"
96 | bash -e "/var/lib/jenkins/code/devops_public/$bash_script"
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | http://jenkins.dennyzhang.com:18080/
105 |
106 | false
107 | false
108 | false
109 | false
110 | true
111 | true
112 | true
113 | false
114 | false
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/images_screenshot/BashCodeQualityCheck.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/BashCodeQualityCheck.png
--------------------------------------------------------------------------------
/images_screenshot/DockerDeploySandboxActiveSprint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/DockerDeploySandboxActiveSprint.png
--------------------------------------------------------------------------------
/images_screenshot/DockerDeploySandboxPreviousActiveSprint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/DockerDeploySandboxPreviousActiveSprint.png
--------------------------------------------------------------------------------
/images_screenshot/DockerDeploySandboxUpgradeLegacyEnv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/DockerDeploySandboxUpgradeLegacyEnv.png
--------------------------------------------------------------------------------
/images_screenshot/MonitorGitFileChanges.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/MonitorGitFileChanges.png
--------------------------------------------------------------------------------
/images_screenshot/MonitorITResource.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/MonitorITResource.png
--------------------------------------------------------------------------------
/images_screenshot/MonitorNewActiveSprint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/MonitorNewActiveSprint.png
--------------------------------------------------------------------------------
/images_screenshot/MonitorServerFileChangesAudit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/MonitorServerFileChangesAudit.png
--------------------------------------------------------------------------------
/images_screenshot/NetworkTCPScanAuditReport.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/NetworkTCPScanAuditReport.png
--------------------------------------------------------------------------------
/images_screenshot/OSPackageActionAuditReport.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/OSPackageActionAuditReport.png
--------------------------------------------------------------------------------
/images_screenshot/RubyCodeQualityCheck.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/RubyCodeQualityCheck.png
--------------------------------------------------------------------------------
/images_screenshot/RunCommandOnServers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dennyzhang/devops_jenkins/73343479a41a1cbedea663a4d1a85d537cd68aa3/images_screenshot/RunCommandOnServers.png
--------------------------------------------------------------------------------