Skip to content

Commit

Permalink
Sonatype Scan Gradle Plugin (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
micronaut-build authored Jan 9, 2025
1 parent 2ec74de commit 5b98235
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}"
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSS_INDEX_USERNAME: ${{ secrets.OSS_INDEX_USERNAME }}
OSS_INDEX_PASSWORD: ${{ secrets.OSS_INDEX_PASSWORD }}
steps:
# https://github.com/actions/virtual-environments/issues/709
- name: "🗑 Free disk space"
Expand Down Expand Up @@ -58,6 +60,11 @@ jobs:
run: |
[ -f ./setup.sh ] && ./setup.sh || [ ! -f ./setup.sh ]
- name: "🚔 Sonatype Scan"
id: sonatypescan
run: |
./gradlew ossIndexAudit --no-parallel --info
- name: "🛠 Build with Gradle"
id: gradle
run: |
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ repositories {

dependencies {
implementation libs.gradle.micronaut
implementation(libs.sonatype.scan)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
plugins {
id 'io.micronaut.build.internal.flyway-base'
id 'io.micronaut.build.internal.module'
id("org.sonatype.gradle.plugins.scan")
}
String ossIndexUsername = System.getenv("OSS_INDEX_USERNAME") ?: project.properties["ossIndexUsername"]
String ossIndexPassword = System.getenv("OSS_INDEX_PASSWORD") ?: project.properties["ossIndexPassword"]
boolean sonatypePluginConfigured = ossIndexUsername != null && ossIndexPassword != null
if (sonatypePluginConfigured) {
ossIndexAudit {
username = ossIndexUsername
password = ossIndexPassword
excludeCompileOnly = true
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ graal-svm = "23.1.5"
persistence-api = '2.2'
groovy = "4.0.17"
spock = "2.3-groovy-4.0"
sonatype-scan = "3.0.0"

[libraries]
# Core
Expand All @@ -38,3 +39,4 @@ gradle-micronaut = { module = "io.micronaut.gradle:micronaut-gradle-plugin", ver
persistence-api = { module = 'javax.persistence:javax.persistence-api', version.ref = 'persistence-api'}

test-containers-spock = { module = "org.testcontainers:spock" }
sonatype-scan = { module = "org.sonatype.gradle.plugins:scan-gradle-plugin", version.ref = "sonatype-scan" }

0 comments on commit 5b98235

Please sign in to comment.