This repository has been archived by the owner on Jul 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
105 lines (89 loc) · 2.53 KB
/
build.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import com.aestasit.infrastructure.aws.gradle.tasks.StartInstance
import com.aestasit.infrastructure.aws.gradle.tasks.TerminateInstance
buildscript {
repositories {
mavenCentral()
maven { url ossSnapshotRepositoryUrl }
}
dependencies {
classpath 'com.aestasit.infrastructure.aws:gramazon:0.3.6-SNAPSHOT'
classpath 'com.aestasit.infrastructure.sshoogr:sshoogr-gradle:0.9.3'
}
}
apply plugin: 'gramazon'
apply plugin: 'secureShell'
apply plugin: 'groovy'
apply plugin: 'maven'
aws {
acceesKeyId = awsAccessKeyId
secretKey = awsSecretKey
region = 'eu-west-1'
}
sshOptions {
defaultUser = 'root'
defaultKeyFile = file('cloud-do.pem')
trustUnknownHosts = true
}
repositories {
mavenCentral()
maven { url ossSnapshotRepositoryUrl }
}
dependencies {
compile localGroovy()
testCompile 'junit:junit:4.11'
testCompile 'com.aestasit.infrastructure.puppet:puppet-unit:0.5.1-SNAPSHOT'
}
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
sourceSets.test.groovy.srcDirs = ['tests/groovy']
sourceSets.test.resources.srcDirs = ['tests/resources']
test {
testLogging.showStandardStreams = true
}
task startInstance(type: StartInstance) {
keyName 'cloud-do'
securityGroup 'cloud-do'
instanceName 'gramazon/cloud-do'
stateFileName 'cloud-do.json'
ami 'ami-6f07e418'
instanceType 't1.micro'
waitForStart true
}
task terminateInstance(type: TerminateInstance) {
stateFileName 'cloud-do.json'
}
task zipModules(type: Zip) {
baseName = 'puppet-setup'
destinationDir = buildDir
from("${projectDir}/modules") {
include '**/*.*'
}
from("${projectDir}") {
include 'manifests/**'
include 'templates/**'
include 'lib/**'
include 'files/**'
include 'Modulefile'
into 'derby'
}
includeEmptyDirs = false
}
task uploadModules(dependsOn: [zipModules]) << {
remoteSession {
host = getInstanceState('cloud-do.json').host
exec 'rm -rf /tmp/puppet-setup.zip'
scp {
from { localFile "${buildDir}/puppet-setup.zip" }
into { remoteDir "/tmp" }
}
exec 'rm -rf /tmp/puppet_modules'
exec 'unzip /tmp/puppet-setup.zip -d /tmp/puppet_modules'
}
}
test.doFirst {
systemProperties = System.getProperties()
systemProperties['puppet.integration.tests.host'] = getInstanceState('cloud-do.json').host
systemProperties['puppet.integration.tests.user'] = sshOptions.defaultUser
systemProperties['puppet.integration.tests.keyFile'] = sshOptions.defaultKeyFile
systemProperties['puppet.integration.tests.modulePath'] = '/tmp/puppet_modules'
}