diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
new file mode 100644
index 0000000..82cec91
--- /dev/null
+++ b/.github/workflows/sonar.yml
@@ -0,0 +1,44 @@
+name: Sonar
+
+env:
+ MAVEN_ARGS: -V -ntp -e
+
+concurrency:
+ group: ${{ github.ref }}-${{ github.workflow }}
+ cancel-in-progress: true
+on:
+ push:
+ paths-ignore:
+ - 'docs/**'
+ - 'adr/**'
+ branches: [ main ]
+ pull_request:
+ paths-ignore:
+ - 'docs/**'
+ - 'adr/**'
+ types: [ opened, synchronize, reopened ]
+
+jobs:
+ sonar:
+ runs-on: ubuntu-latest
+ if: ${{ ( github.event_name == 'push' ) || ( github.event_name == 'pull_request' ) }}
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Java and Maven
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: 21
+ cache: 'maven'
+ - name: Cache SonarCloud packages
+ uses: actions/cache@v4
+ with:
+ path: ~/.sonar/cache
+ key: ${{ runner.os }}-sonar
+ restore-keys: ${{ runner.os }}-sonar
+ - name: Build and analyze
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: mvn -B org.jacoco:jacoco-maven-plugin:prepare-agent clean install verify org.jacoco:jacoco-maven-plugin:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=java-operator-sdk_kubernetes-glue-operator
+
diff --git a/pom.xml b/pom.xml
index a3b5569..363c810 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,8 @@
${java.version}
UTF-8
3.5.2
+ java-operator-sdk
+ https://sonarcloud.io
6.13.1
3.8.3
24.1.1
diff --git a/src/test/java/io/javaoperatorsdk/operator/glue/TestUtils.java b/src/test/java/io/javaoperatorsdk/operator/glue/TestUtils.java
index e43d958..ea6bf0e 100644
--- a/src/test/java/io/javaoperatorsdk/operator/glue/TestUtils.java
+++ b/src/test/java/io/javaoperatorsdk/operator/glue/TestUtils.java
@@ -24,7 +24,7 @@
public class TestUtils {
- public static final Duration GC_WAIT_TIMEOUT = Duration.ofSeconds(120);
+ public static final Duration GC_WAIT_TIMEOUT = Duration.ofSeconds(180);
public static final Duration INITIAL_RECONCILE_WAIT_TIMEOUT = Duration.ofMillis(150);
public static final int CRD_READY_WAIT = 1000;