-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
89 lines (74 loc) · 2.82 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
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
}
plugins {
id("io.spinnaker.plugin.bundler").version("$spinnakerGradleVersion")
id "com.palantir.docker" version "0.25.0"
}
apply plugin: "io.spinnaker.plugin.bundler"
version = normalizedVersion()
spinnakerBundle {
pluginId = "Armory.EAP"
description = "Dynamically load accounts from different sources"
provider = "https://armory.io"
version = rootProject.version
}
subprojects { project ->
group = "io.armory.plugin.eap"
version = rootProject.version
apply plugin: "maven-publish"
repositories {
mavenCentral()
maven {
url 'https://armory.jfrog.io/artifactory/gradle-dev'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
}
task version() {
println(version)
}
docker {
dockerfile project.file("build-tools/Dockerfile")
def registry = System.getenv('REGISTRY') ?: "docker.io"
def registryOrg = System.getenv('REGISTRY_ORG') ?: "armory"
name "$registry/$registryOrg/eap-plugin:$version"
files project.file("build/distributions"),
project.file("build-tools/install.sh"),
project.file("git-poller/src/main/bash/git-poller.sh")
buildArgs([PLUGIN_ID: "eap-$version"])
copySpec.from("build/distributions").into("distributions")
}
String normalizedVersion() {
new ByteArrayOutputStream().withStream { os ->
exec {
executable = "$projectDir/build-tools/version.sh"
standardOutput = os
}
ext.version = os.toString().trim()
}
}
task generatePluginsJson {
doLast {
def pluginInfoFile = new File("$buildDir/distributions/plugin-info.json")
def pluginInfo = new JsonSlurper().parse(pluginInfoFile)
pluginInfo.releases[0].url = "file:///opt/spinnaker/lib/local-plugins/eap/${version}/eap-${version}.zip"
def plugins = [pluginInfo]
File dockerPlugins = new File("$buildDir/distributions/plugins-docker.json")
dockerPlugins.write(JsonOutput.prettyPrint(JsonOutput.toJson(plugins)))
pluginInfo.releases[0].url = "https://github.com/armory-plugins/external-accounts/releases/download/v${version}/eap-${version}.zip"
File remotePlugins = new File("$buildDir/distributions/plugins-remote.json")
remotePlugins.write(JsonOutput.prettyPrint(JsonOutput.toJson(plugins)))
pluginInfo.releases[0].url = "file://$buildDir/distributions/eap-${version}.zip"
File localPlugins = new File("$buildDir/distributions/plugins.json")
localPlugins.write(JsonOutput.prettyPrint(JsonOutput.toJson(plugins)))
}
}
releaseBundle.finalizedBy generatePluginsJson