archiveFile) {
100 | this.archiveFile = archiveFile;
101 | }
102 |
103 | @TaskAction
104 | void publishDeb() throws GeneralSecurityException, InterruptedException, IOException {
105 | Storage storage = StorageOptions.newBuilder().setCredentials(resolveCredentials()).build().getService();
106 | BlobId blobId = uploadDebToGcs(storage);
107 | Operation importOperation = importDebToArtifactRegistry(blobId);
108 |
109 | deleteDebFromGcs(storage, blobId);
110 |
111 | if (!operationIsDone(importOperation)) {
112 | throw new IOException("Operation timed out importing debian package to Artifact Registry.");
113 | } else if (getErrors(importOperation) != null) {
114 | throw new IOException(
115 | "Received an error importing debian package to Artifact Registry: " + getErrors(importOperation)
116 | );
117 | }
118 | }
119 |
120 | private void deleteDebFromGcs(Storage storage, BlobId blobId) {
121 | try {
122 | storage.delete(blobId);
123 | } catch (StorageException e) {
124 | getProject().getLogger().warn("Error deleting deb from temp GCS storage", e);
125 | }
126 | }
127 |
128 | private Credentials resolveCredentials() throws IOException {
129 | String fromEnvironmentVar = System.getenv(GOOGLE_SERVICE_ACCT_JSON_ENV_VAR);
130 |
131 | if (!Strings.isNullOrEmpty(fromEnvironmentVar)) {
132 | return GoogleCredentials.fromStream(new StringInputStream(fromEnvironmentVar)).createScoped(
133 | ArtifactRegistryScopes.CLOUD_PLATFORM
134 | );
135 | }
136 |
137 | return new DefaultCredentialProvider().getCredential();
138 | }
139 |
140 | /**
141 | * Import the blob into Artifact Registry and return an Operation representing the import.
142 | *
143 | *
144 | * If the Operation is not done, that means we timed out before finishing the import. The operation
145 | * should also be checked for errors.
146 | */
147 | private Operation importDebToArtifactRegistry(BlobId blobId) throws GeneralSecurityException, IOException,
148 | InterruptedException {
149 |
150 | ArtifactRegistry artifactRegistryClient = new ArtifactRegistry(
151 | GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(), new HttpCredentialsAdapter(
152 | resolveCredentials()
153 | )
154 | );
155 |
156 | String parent = String.format(
157 | "projects/%s/locations/%s/repositories/%s",
158 | repoProject.get(),
159 | location.get(),
160 | repository.get()
161 | );
162 | ImportAptArtifactsGcsSource gcsSource = new ImportAptArtifactsGcsSource();
163 | gcsSource.setUris(List.of(String.format("gs://%s/%s", blobId.getBucket(), blobId.getName())));
164 |
165 | ImportAptArtifactsRequest content = new ImportAptArtifactsRequest();
166 | content.setGcsSource(gcsSource);
167 |
168 | ArtifactRegistry.Projects.Locations.Repositories.AptArtifacts.ArtifactRegistryImport request =
169 | artifactRegistryClient.projects().locations().repositories().aptArtifacts().artifactregistryImport(
170 | parent,
171 | content
172 | );
173 |
174 | Operation operation = request.execute();
175 |
176 | Stopwatch timer = Stopwatch.createStarted();
177 | while (!operationIsDone(operation) && !operationTimedOut(timer)) {
178 | Thread.sleep(30000);
179 | operation = artifactRegistryClient.projects().locations().operations().get(operation.getName()).execute();
180 | }
181 |
182 | return operation;
183 | }
184 |
185 | private BlobId uploadDebToGcs(Storage storage) throws IOException {
186 | BlobId blobId = BlobId.of(uploadBucket.get(), archiveFile.get().getAsFile().getName());
187 | BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build();
188 | try (ByteChannel fileChannel = Files.newByteChannel(archiveFile.get().getAsFile().toPath());
189 | WritableByteChannel gcsChannel = storage.writer(blobInfo)) {
190 | ByteStreams.copy(fileChannel, gcsChannel);
191 | }
192 | return blobId;
193 | }
194 |
195 | /** Checks for done, correctly handling a null result. */
196 | private boolean operationIsDone(Operation operation) {
197 | return Boolean.TRUE.equals(operation.getDone());
198 | }
199 |
200 | private boolean operationTimedOut(Stopwatch timer) {
201 | return timer.elapsed(TimeUnit.SECONDS) > aptImportTimeoutSeconds.get();
202 | }
203 |
204 | private Object getErrors(Operation operation) {
205 | return operation.getResponse().get("errors");
206 | }
207 | }
208 |
--------------------------------------------------------------------------------
/spinnaker-project-plugin/src/main/groovy/com/netflix/spinnaker/gradle/publishing/artifactregistry/ArtifactRegistryPublishExtension.groovy:
--------------------------------------------------------------------------------
1 | package com.netflix.spinnaker.gradle.publishing.artifactregistry
2 |
3 | import org.gradle.api.Project
4 | import org.gradle.api.model.ObjectFactory
5 | import org.gradle.api.provider.Property
6 | import org.gradle.api.provider.Provider
7 |
8 | class ArtifactRegistryPublishExtension {
9 |
10 | protected final Project project
11 |
12 | final Property enabled
13 |
14 | final Property mavenEnabled
15 | final Property aptEnabled
16 |
17 | final Property mavenProject
18 | final Property mavenLocation
19 | final Property mavenRepository
20 |
21 | final Property aptProject
22 | final Property aptLocation
23 | final Property aptRepository
24 |
25 | final Property aptTempGcsBucket
26 |
27 | final Property aptImportTimeoutSeconds;
28 |
29 | ArtifactRegistryPublishExtension(Project project) {
30 | this.project = project
31 | ObjectFactory props = project.objects
32 | enabled = props.property(Boolean).convention(false)
33 | mavenEnabled = props.property(Boolean).convention(false)
34 | aptEnabled = props.property(Boolean).convention(true)
35 | mavenProject = props.property(String).convention("spinnaker-community")
36 | mavenLocation = props.property(String).convention("us")
37 | mavenRepository = props.property(String).convention("maven")
38 | aptProject = props.property(String).convention("spinnaker-community")
39 | aptLocation = props.property(String).convention("us")
40 | aptRepository = props.property(String).convention("apt")
41 | aptTempGcsBucket = props.property(String).convention("spinnaker-deb-temp-uploads")
42 | aptImportTimeoutSeconds = props.property(Integer).convention(3600)
43 | }
44 |
45 | Provider enabled() {
46 | return withSysProp(enabled, Boolean, "artifactRegistryPublishEnabled")
47 | }
48 |
49 | Provider mavenEnabled() {
50 | return withSysProp(mavenEnabled, Boolean, "artifactRegistryPublishMavenEnabled")
51 | }
52 |
53 | Provider aptEnabled() {
54 | return withSysProp(aptEnabled, Boolean, "artifactRegistryPublishAptEnabled")
55 | }
56 |
57 | Provider mavenProject() {
58 | return withSysProp(mavenProject, String, "artifactRegistryMavenProject")
59 | }
60 |
61 | Provider mavenLocation() {
62 | return withSysProp(mavenLocation, String, "artifactRegistryMavenLocation")
63 | }
64 |
65 | Provider mavenRepository() {
66 | return withSysProp(mavenRepository, String, "artifactRegistryMavenRepository")
67 | }
68 |
69 | Provider mavenUrl() {
70 | return mavenProject().flatMap { String project ->
71 | mavenLocation().flatMap { String location ->
72 | mavenRepository().map { String repository ->
73 | "artifactregistry://$location-maven.pkg.dev/$project/$repository".toString()
74 | }
75 | }
76 | }
77 | }
78 |
79 | Provider aptProject() {
80 | return withSysProp(aptProject, String, "artifactRegistryAptProject")
81 | }
82 |
83 | Provider aptLocation() {
84 | return withSysProp(aptLocation, String, "artifactRegistryAptLocation")
85 | }
86 |
87 | Provider aptRepository() {
88 | return withSysProp(aptRepository, String, "artifactRegistryAptRepository")
89 | }
90 |
91 | Provider aptTempGcsBucket() {
92 | return withSysProp(aptTempGcsBucket, String, "artifactRegistryAptTempGcsBucket")
93 | }
94 |
95 | Provider aptImportTimeoutSeconds() {
96 | return withSysProp(aptImportTimeoutSeconds, Integer, "artifactRegistryAptImportTimeoutSeconds")
97 | }
98 |
99 | //------------------------------------------------------------------------
100 | //
101 | // Note the following utility methods are protected rather than private
102 | // because the Gradle lazy properties generate some dynamic subclass that
103 | // needs visibility into these methods.
104 | //
105 | //------------------------------------------------------------------------
106 | protected Provider withSysProp(Property property, Class type, String projectPropertyName) {
107 | return property.map { T value ->
108 | return projectProperty(type, projectPropertyName, value)
109 | }
110 | }
111 |
112 | protected T projectProperty(Class type, String projectPropertyName, T defaultValue) {
113 | if (project.hasProperty(projectPropertyName)) {
114 | if (type == Boolean) {
115 | return Boolean.valueOf(project.property(projectPropertyName).toString()) as T
116 | }
117 | return project.property(projectPropertyName).asType(type)
118 | }
119 | return defaultValue
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/spinnaker-project-plugin/src/main/groovy/com/netflix/spinnaker/gradle/publishing/artifactregistry/ArtifactRegistryPublishPlugin.groovy:
--------------------------------------------------------------------------------
1 | package com.netflix.spinnaker.gradle.publishing.artifactregistry
2 |
3 | import com.google.cloud.artifactregistry.gradle.plugin.ArtifactRegistryGradlePlugin
4 | import com.netflix.gradle.plugins.deb.Deb
5 | import com.netflix.gradle.plugins.packaging.SystemPackagingPlugin
6 | import org.gradle.api.Plugin
7 | import org.gradle.api.Project
8 | import org.gradle.api.Task
9 | import org.gradle.api.plugins.JavaLibraryPlugin
10 | import org.gradle.api.plugins.JavaPlatformPlugin
11 | import org.gradle.api.publish.PublishingExtension
12 | import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
13 | import org.gradle.api.tasks.TaskProvider
14 |
15 | class ArtifactRegistryPublishPlugin implements Plugin {
16 | @Override
17 | void apply(Project project) {
18 |
19 | def extension = project.extensions.create("artifactRegistrySpinnaker", ArtifactRegistryPublishExtension, project)
20 |
21 | if (!extension.enabled().get()) {
22 | return
23 | }
24 |
25 | if (extension.mavenEnabled().get()) {
26 | project.plugins.withType(JavaLibraryPlugin) {
27 | project.plugins.apply(MavenPublishPlugin)
28 | project.plugins.apply(ArtifactRegistryGradlePlugin)
29 | project.extensions.configure(PublishingExtension) { publishingExtension ->
30 | publishingExtension.repositories.maven {
31 | it.name = 'artifactRegistry'
32 | it.url = extension.mavenUrl().get()
33 | }
34 | }
35 | }
36 |
37 | project.plugins.withType(JavaPlatformPlugin) {
38 | project.plugins.apply(MavenPublishPlugin)
39 | project.plugins.apply(ArtifactRegistryGradlePlugin)
40 | project.extensions.configure(PublishingExtension) { publishingExtension ->
41 | publishingExtension.repositories.maven {
42 | it.name = 'artifactRegistry'
43 | it.url = extension.mavenUrl().get()
44 | }
45 | }
46 | }
47 | }
48 |
49 | if (extension.aptEnabled().get()) {
50 | project.plugins.withType(SystemPackagingPlugin) {
51 | TaskProvider debTask = project.tasks.named("buildDeb", Deb)
52 | TaskProvider publishDeb = project.tasks.register("publishDebToArtifactRegistry", ArtifactRegistryDebPublishTask) {
53 | it.archiveFile = debTask.flatMap { it.archiveFile }
54 | it.uploadBucket = extension.aptTempGcsBucket()
55 | it.repoProject = extension.aptProject()
56 | it.location = extension.aptLocation()
57 | it.repository = extension.aptRepository()
58 | it.aptImportTimeoutSeconds = extension.aptImportTimeoutSeconds()
59 | it.dependsOn(debTask)
60 | it.onlyIf { extension.enabled().get() }
61 | it.onlyIf { extension.aptEnabled().get() }
62 | it.onlyIf { project.version.toString() != Project.DEFAULT_VERSION }
63 | }
64 |
65 | project.tasks.matching { it.name == "publish" }.configureEach {
66 | it.dependsOn(publishDeb)
67 | }
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/spinnaker-project-plugin/src/main/groovy/com/netflix/spinnaker/gradle/publishing/nexus/NexusPublishExtension.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Armory, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 |
18 | package com.netflix.spinnaker.gradle.publishing.nexus
19 |
20 | import org.gradle.api.Project
21 | import org.gradle.api.model.ObjectFactory
22 | import org.gradle.api.provider.Property
23 | import org.gradle.api.provider.Provider;
24 |
25 | class NexusPublishExtension {
26 | protected Project project
27 |
28 | final Property enabled
29 | final Property nexusStagingUrl
30 | final Property nexusSnapshotUrl
31 | final Property nexusStagingProfileId
32 |
33 | NexusPublishExtension(Project project) {
34 | this.project = project
35 | ObjectFactory props = project.objects
36 | enabled = props.property(Boolean).convention(false)
37 | nexusStagingUrl = props.property(String).convention("https://s01.oss.sonatype.org/service/local/")
38 | nexusSnapshotUrl = props.property(String).convention("https://s01.oss.sonatype.org/content/repositories/snapshots/")
39 | nexusStagingProfileId = props.property(String).convention("b6b58aed9c738")
40 | }
41 |
42 | Provider enabled() {
43 | return withSysProp(enabled, Boolean, "nexusPublishEnabled")
44 | }
45 |
46 | Provider nexusStagingUrl() {
47 | return withSysProp(nexusStagingUrl, String, "nexusStagingUrl")
48 | }
49 |
50 | Provider nexusSnapshotUrl() {
51 | return withSysProp(nexusSnapshotUrl, String, "nexusSnapshotUrl")
52 | }
53 |
54 | Provider nexusStagingProfileId() {
55 | return withSysProp(nexusStagingProfileId, String, "nexusStagingProfileId")
56 | }
57 |
58 | String pgpSigningKey() {
59 | return projectProperty(String, "nexusPgpSigningKey")
60 | }
61 |
62 | String pgpSigningPassword() {
63 | return projectProperty(String, "nexusPgpSigningPassword")
64 | }
65 |
66 | String nexusUsername() {
67 | return projectProperty(String, "nexusUsername")
68 | }
69 |
70 | String nexusPassword() {
71 | return projectProperty(String, "nexusPassword")
72 | }
73 |
74 | protected Provider withSysProp(Property property, Class type, String projectPropertyName) {
75 | return property.map { T value ->
76 | return projectProperty(type, projectPropertyName, value)
77 | }
78 | }
79 |
80 | protected T projectProperty(Class type, String projectPropertyName) {
81 | return projectProperty(type, projectPropertyName, null)
82 | }
83 |
84 | protected T projectProperty(Class type, String projectPropertyName, T defaultValue) {
85 | if (project.hasProperty(projectPropertyName)) {
86 | if (type == Boolean) {
87 | return Boolean.valueOf(project.property(projectPropertyName).toString()) as T
88 | }
89 | return project.property(projectPropertyName).asType(type)
90 | }
91 | return defaultValue
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/spinnaker-project-plugin/src/main/groovy/com/netflix/spinnaker/gradle/publishing/nexus/NexusPublishPlugin.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Armory, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 |
18 | package com.netflix.spinnaker.gradle.publishing.nexus
19 |
20 | import com.netflix.spinnaker.gradle.publishing.PublishingPlugin
21 | import io.github.gradlenexus.publishplugin.NexusPublishPlugin as BaseNexusPublishPlugin
22 | import io.github.gradlenexus.publishplugin.NexusPublishExtension as BaseNexusPublishExtension
23 | import org.gradle.api.Plugin
24 | import org.gradle.api.Project
25 | import org.gradle.api.plugins.JavaLibraryPlugin
26 | import org.gradle.api.plugins.JavaPlatformPlugin
27 | import org.gradle.api.plugins.JavaPlugin
28 | import org.gradle.api.publish.Publication
29 | import org.gradle.api.publish.PublishingExtension
30 | import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
31 | import org.gradle.jvm.tasks.Jar
32 | import org.gradle.plugins.signing.SigningExtension
33 | import org.gradle.plugins.signing.SigningPlugin
34 | import org.jetbrains.dokka.gradle.DokkaPlugin
35 |
36 | class NexusPublishPlugin implements Plugin {
37 |
38 | @Override
39 | void apply(Project project) {
40 | def nexusExtension = project.extensions.create("nexusSpinnaker", NexusPublishExtension, project)
41 | if (!nexusExtension.enabled().get()) {
42 | return
43 | }
44 |
45 | if (project == project.rootProject) {
46 | configureBaseNexusPlugin(project, nexusExtension)
47 | }
48 |
49 | project.plugins.withType(JavaLibraryPlugin) {
50 | project.plugins.apply(MavenPublishPlugin)
51 | project.plugins.apply(SigningPlugin)
52 |
53 | configureSpinnakerPublicationForNexus(project, nexusExtension)
54 | }
55 | project.plugins.withType(JavaPlatformPlugin) {
56 | project.plugins.apply(MavenPublishPlugin)
57 | project.plugins.apply(SigningPlugin)
58 |
59 | configureSpinnakerPublicationForNexus(project, nexusExtension)
60 | }
61 | }
62 |
63 | private void configureBaseNexusPlugin(Project project, NexusPublishExtension nexusExtension) {
64 | project.plugins.apply(BaseNexusPublishPlugin)
65 | project.extensions.configure(BaseNexusPublishExtension) { nexus ->
66 | nexus.repositories.create("nexus") {
67 | nexusUrl = new URI(nexusExtension.nexusStagingUrl().get())
68 | snapshotRepositoryUrl = new URI(nexusExtension.nexusSnapshotUrl().get())
69 | username = nexusExtension.nexusUsername()
70 | password = nexusExtension.nexusPassword()
71 | stagingProfileId = nexusExtension.nexusStagingProfileId()
72 | }
73 | }
74 | }
75 |
76 | private void configureSpinnakerPublicationForNexus(Project project, NexusPublishExtension nexusExtension) {
77 | project.extensions.configure(PublishingExtension) { publishingExtension ->
78 | def spinnakerPublication = publishingExtension.publications.getByName(PublishingPlugin.PUBLICATION_NAME)
79 |
80 | configurePom(project, spinnakerPublication)
81 |
82 | project.extensions.configure(SigningExtension) { signingExtension ->
83 | signingExtension.useInMemoryPgpKeys(nexusExtension.pgpSigningKey(), nexusExtension.pgpSigningPassword())
84 | signingExtension.sign(spinnakerPublication)
85 | }
86 |
87 | if (project.plugins.hasPlugin(DokkaPlugin)) {
88 | def javadocTask = project.tasks.findByName("dokkaJavadoc")
89 | def dokkaJar = project.task(type: Jar, "dokkaJar") {
90 | archiveClassifier.set("javadoc")
91 | from(javadocTask)
92 | }
93 | spinnakerPublication.artifact(dokkaJar)
94 | } else if (project.plugins.hasPlugin(JavaPlugin)) {
95 | def javadocTask = project.tasks.findByName(JavaPlugin.JAVADOC_TASK_NAME)
96 | def javadocJar = project.task(type: Jar, "javadocJar") {
97 | archiveClassifier.set("javadoc")
98 | from(javadocTask)
99 | }
100 | spinnakerPublication.artifact(javadocJar)
101 | }
102 | }
103 | }
104 |
105 | void configurePom(Project project, Publication publication) {
106 | def service = project.rootProject.name
107 | publication.pom {
108 | name = service
109 | description = "Spinnaker ${service.capitalize()}"
110 | url = "https://github.com/spinnaker/$service"
111 | licenses {
112 | license {
113 | name = "The Apache License, Version 2.0"
114 | url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
115 | }
116 | }
117 | developers {
118 | developer {
119 | id = "toc"
120 | name = "Technical Oversight Committee"
121 | email = "toc@spinnaker.io"
122 | }
123 | }
124 | inceptionYear = "2014"
125 | scm {
126 | connection = "scm:git:git://github.com/spinnaker/${service}.git"
127 | developerConnection = "scm:git:ssh://github.com/spinnaker/${service}.git"
128 | url = "http://github.com/spinnaker/${service}/"
129 | }
130 | issueManagement {
131 | system = "GitHub Issues"
132 | url = "https://github.com/spinnaker/spinnaker/issues"
133 | }
134 | }
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/spinnaker-project-plugin/src/main/groovy/com/netflix/spinnaker/gradle/publishing/nexus/README.md:
--------------------------------------------------------------------------------
1 | # Publishing to Maven Central
2 |
3 | As of 3/2021, Spinnaker projects push jars to [Maven
4 | Central](https://repo.maven.apache.org/maven2/io/spinnaker/).
5 |
6 | Sonatype hosts instances of Nexus for OSS projects. Releases published through
7 | Nexus are synced with Maven Central. The sync takes about 10 minutes to
8 | complete.
9 |
10 | The jars are signed with a PGP key owned by `toc@spinnaker.io` with the
11 | fingerprint `9C88 1F6B 9595 3116 4FE3 CCD2 6A3E 0DDE A960 2C12`.
12 |
13 | Our Nexus instance is hosted at [s01.oss.sonatype.org](https://s01.oss.sonatype.org).
14 |
15 | ## Secrets
16 |
17 | There are four org-level GitHub secrets available to publish to Nexus:
18 | `NEXUS_USERNAME`, `NEXUS_PASSWORD`, `NEXUS_PGP_SIGNING_KEY`, and
19 | `NEXUS_PGP_SIGNING_PASSWORD`.
20 |
21 | If you need to sign in to the Nexus UI, ask the Spinnaker TOC for the root
22 | username and password credentials.
23 |
24 | ## Publishing with Gradle
25 |
26 | You can publish to Nexus without releasing to Maven Central:
27 |
28 | ```shell
29 | ./gradlew -P nexusPublishEnabled=true publishToNexus
30 | ```
31 |
32 | This stages a release in an `Open` state. The Nexus UI provides a staging URL
33 | for staged artifacts if you need to test them out.
34 |
35 | From the UI, you can either `Close` a release, which will start the sync
36 | process, or `Drop` it, which will delete it.
37 |
38 | You can also publish and close a release programmatically:
39 |
40 | ```shell
41 | ./gradlew -P nexusPublishEnabled=true publishToNexus closeAndReleaseNexusStagingRepository
42 | ```
43 |
--------------------------------------------------------------------------------
/spinnaker-project-plugin/src/main/resources/license-normalizer-bundle.json:
--------------------------------------------------------------------------------
1 | {
2 | "bundles" : [
3 | { "bundleName" : "apache1", "licenseName" : "Apache Software License, Version 1.1", "licenseUrl" : "http://www.apache.org/licenses/LICENSE-1.1" },
4 | { "bundleName" : "apache2", "licenseName" : "Apache License, Version 2.0", "licenseUrl" : "http://www.apache.org/licenses/LICENSE-2.0" },
5 | { "bundleName" : "cddl1", "licenseName" : "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0 (CDDL-1.0)", "licenseUrl" : "http://opensource.org/licenses/CDDL-1.0" },
6 | { "bundleName" : "cddl+gpl", "licenseName" : "CDDL+GPL License", "licenseUrl" : "http://glassfish.java.net/public/CDDL+GPL_1_1.html" },
7 | { "bundleName" : "mit", "licenseName" : "The MIT License (MIT)", "licenseUrl" : "http://opensource.org/licenses/MIT" },
8 | { "bundleName" : "epl", "licenseName" : "Eclipse Public License - Version 1.0", "licenseUrl" : "http://www.eclipse.org/org/documents/epl-v10.php" },
9 | { "bundleName" : "lgpl2.1", "licenseName" : "LGPL 2.1", "licenseUrl" : "http://www.gnu.org/licenses/lgpl-2.1.html" },
10 | { "bundleName" : "bsd", "licenseName" : "BSD", "licenseUrl" : "http://www.opensource.org/licenses/bsd-license.php" }
11 | ],
12 | "transformationRules" : [
13 | { "bundleName" : "apache2", "licenseNamePattern" : ".*The Apache Software License, Version 2.0.*" },
14 | { "bundleName" : "apache2", "licenseNamePattern" : "Apache 2" },
15 | { "bundleName" : "apache2", "licenseNamePattern" : "Apache License 2.0" },
16 | { "bundleName" : "apache2", "licenseUrlPattern" : "http://www.apache.org/licenses/LICENSE-2.0" },
17 | { "bundleName" : "apache2", "licenseNamePattern" : "Special Apache", "transformUrl" : false },
18 | { "bundleName" : "apache2", "licenseNamePattern" : "Keep this name", "transformName" : false },
19 | { "bundleName" : "mit", "licenseNamePattern" : ".*MIT.*", "transformUrl" : false },
20 | { "bundleName" : "cddl+gpl", "licenseUrlPattern" : ".*CDDL+GPL.*", "transformUrl" : false },
21 | { "bundleName" : "cddl+gpl", "licenseNamePattern" : "CDDL 1.1", "transformUrl" : false },
22 | { "bundleName" : "cddl+gpl", "licenseNamePattern" : "GPLv2+CE", "transformUrl" : false },
23 | { "bundleName" : "epl", "licenseUrlPattern" : "http://www.eclipse.org/org/documents/epl-v10.*"},
24 | { "bundleName" : "epl", "licenseNamePattern" : ".*Eclipse Public License.*"},
25 | { "bundleName" : "lgpl2.1", "licenseNamePattern" : "LGPL.*2.1", "transformUrl" : false},
26 | { "bundleName" : "bsd", "licenseUrlPattern" : "http://www.opensource.org/licenses/bsd-license.*", "transformUrl" : false},
27 | { "bundleName" : "bsd", "licenseNamePattern" : ".*BSD.*", "transformUrl" : false}
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/spinnaker-project-plugin/src/main/resources/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [[ "$SPOTLESS_SKIP" -eq "1" ]]; then
4 | echo '[git hook] $SPOTLESS_SKIP set: Skipping spotlessApply'
5 | exit 0
6 | fi
7 |
8 | echo '[git hook] executing gradle spotlessCheck before commit'
9 |
10 | STAGED=$(git diff --name-only --staged)
11 | ./gradlew spotlessApply
12 | echo ${STAGED} | xargs git add
13 |
14 | exit 0
15 |
--------------------------------------------------------------------------------