-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.gradle
27 lines (25 loc) · 1.86 KB
/
deploy.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
ext.copyFilesToServer = {server, args = [] ->
String keyFile = args.keyFile?:ant.properties."build.userkey"
String buildUser = args.buildUser?:ant.properties."build.user"
String deployFolder = "${ant.properties.deployFolder}/build_${ant.properties.BUILD_NUMBER}"
runSshCmd("mkdir -p ${deployFolder}; rm -f ${ant.properties."apacheVhostDir"}/vhost-${ant.properties.site}.conf", server)
runCmd("scp ${ant.properties.sshOptions} -i ${keyFile} ${ant.properties."application.name"}.tar.gz ${buildUser}@${server}:${deployFolder}", new File(ant.properties.target))
runCmd("scp ${ant.properties.sshOptions} -i ${keyFile} etc/vhost-${ant.properties.site}.conf ${buildUser}@${server}:${ant.properties."apacheVhostDir"}", new File(ant.properties.target))
runSshCmd( "cd ${deployFolder}; tar xzf ${ant.properties."application.name"}.tar.gz", server)
runSshCmd("rm -f ${deployFolder}/${ant.properties."application.name"}.tar.gz", server)
}
ext.createReleaseSymlinks = {server, args = [] ->
String keyFile = args.keyFile?:ant.properties."build.userkey"
String buildUser = args.buildUser?:ant.properties."build.user"
String deployFolder = "${ant.properties.deployFolder}/build_${ant.properties.BUILD_NUMBER}"
String releaseFolder = "${ant.properties.deployFolder}/current"
runSshCmd( "/bin/ln -sfn ${ant.properties."drupal.filesTarget"} ${deployFolder}/${ant.properties."drupal.filesDir"}",server)
runSshCmd( "/bin/chmod 777 ${deployFolder}/${ant.properties."drupal.filesDir"}",server)
runSshCmd("ln -sfn ${deployFolder} ${releaseFolder}", server)
}
ext.restartApache = {server, args = [] ->
String keyFile = args.keyFile?:ant.properties."build.userkey"
String buildUser = args.buildUser?:ant.properties."build.user"
String apacheRestartCmd = args.apacheRestartCmd?:ant.properties."apacheRestartCmd"
runSshCmd(apacheRestartCmd, server)
}