Skip to content

Commit

Permalink
Spotless yaml (GoogleCloudPlatform#227)
Browse files Browse the repository at this point in the history
* Update spotless to v6.18.0

* Add spotless config to add license header to YAML

* Cleanup: remove empty yaml file

* Update license headers via spotlessApply
  • Loading branch information
psx95 authored Apr 12, 2023
1 parent 7a8aedd commit e4cf50f
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 18 deletions.
24 changes: 24 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,33 @@ plugins {
id 'nebula.release'
}

// Required with spotless v6+
// See https://github.com/diffplug/spotless/issues/984 for details
spotless {
predeclareDepsFromBuildscript()
}

// Need to predeclare every configuration used with spotless
spotlessPredeclare {
java {
googleJavaFormat("1.9")
}
groovyGradle {
greclipse()
}
}

// Format the root build too.
spotless {
groovyGradle {
target '*.gradle' // default target of groovyGradle
greclipse()
licenseHeaderFile rootProject.file('buildscripts/spotless.license.gradle'), '(import|pluginManagement)'
}
yaml {
target "*.yaml"
licenseHeaderFile rootProject.file('buildscripts/spotless.license.yaml'), '([a-zA-Z]*:)'
}
}

// Configure release mechanism.
Expand Down Expand Up @@ -90,6 +110,10 @@ subprojects {
greclipse()
licenseHeaderFile rootProject.file('buildscripts/spotless.license.gradle'), '(import|plugins|description)'
}
yaml {
target "*.yaml"
licenseHeaderFile rootProject.file('buildscripts/spotless.license.yaml'), '([a-zA-Z]*:)'
}
}

// Make sure test failures include exception error messages for correction.
Expand Down
13 changes: 13 additions & 0 deletions buildscripts/spotless.license.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
3 changes: 1 addition & 2 deletions cloudbuild-e2e-cloud-functions-gen2.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Google
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
# Generate shadowJar for the instrumented test server
- name: "gradle:8.0.2-jdk11"
Expand Down
3 changes: 1 addition & 2 deletions cloudbuild-e2e-cloud-run.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Google
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
# Wait for the image to exist
- name: "docker"
Expand Down
3 changes: 1 addition & 2 deletions cloudbuild-e2e-gae.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Google
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
# Wait for the image to exist
- name: "docker"
Expand Down
3 changes: 1 addition & 2 deletions cloudbuild-e2e-gce.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
# Wait for the image to exist
- name: "docker"
Expand Down
6 changes: 3 additions & 3 deletions cloudbuild-e2e-gke.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright 2021 Google
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0 #
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
# Wait for the image to exist
- name: "docker"
Expand Down
3 changes: 1 addition & 2 deletions cloudbuild-e2e-image.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
# If the image doesn't exist, create a skip file for the next step to know
- name: "gcr.io/cloud-builders/gcloud"
Expand Down
3 changes: 1 addition & 2 deletions cloudbuild-e2e-local.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
# Wait for the image to exist
- name: "docker"
Expand Down
13 changes: 13 additions & 0 deletions examples/autoconf/job.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: batch/v1
kind: Job
metadata:
Expand Down
2 changes: 0 additions & 2 deletions examples/autoinstrument/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
Empty file.
13 changes: 13 additions & 0 deletions examples/resource/job.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: batch/v1
kind: Job
metadata:
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
pluginManagement {
plugins {
id "com.diffplug.spotless" version "5.9.0"
id "com.diffplug.spotless" version "6.18.0"
id 'nebula.release' version '15.2.0'
id "com.github.johnrengelman.shadow" version "8.1.1"
id 'com.google.cloud.tools.jib' version '3.1.4'
Expand Down

0 comments on commit e4cf50f

Please sign in to comment.