]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21119 Add Gitlab BBT for user provisioning
authorAntoine Vigneau <antoine.vigneau@sonarsource.com>
Sun, 10 Dec 2023 17:51:02 +0000 (18:51 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 22 Dec 2023 20:03:02 +0000 (20:03 +0000)
.cirrus.yml
server/sonar-db-dao/src/main/java/org/sonar/db/alm/setting/ProjectAlmSettingDao.java
sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java
sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/UserTester.java

index ccdbe2a10c327b0e31e4d6d0f32021014f6a3533..9caad464b91388a4665ef361ce92afe79ccd04aa 100644 (file)
@@ -626,12 +626,22 @@ qa_gitlab_provisioning_task:
   <<: *GITLAB_PROVISIONING_TASK_TEMPLATE
   <<: *JAR_CACHE_TEMPLATE
   <<: *GRADLE_CACHE_TEMPLATE
+  env:
+    QA_CATEGORY: GITLAB_PROVISIONING
+  matrix:
+    - name: qa_gitlab_provisioning_latest
+      env:
+        - GITLAB_VERSION: latest
+    - name: qa_gitlab_provisioning_oldest
+      env:
+        - GITLAB_VERSION: 15.6.2-ce.0
   eks_container:
     <<: *CONTAINER_TEMPLATE
-    cpu: 4
+    cpu: 2.4
     memory: 7Gb
-  env:
-    QA_CATEGORY: GITLAB_PROVISIONING
+    use_in_memory_disk: true
+    additional_containers:
+      - <<: *GITLAB_CONTAINER_TEMPLATE
   script:
     - ./private/cirrus/cirrus-qa.sh h2
   <<: *DEFAULT_ARTIFACTS_TEMPLATE
index 8ca55a8037d82e711818506a6df33beeb680ac30..d7a9c54d4b4c3338990605dcca8e557046d9d80b 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.db.alm.setting;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.Optional;
@@ -108,6 +109,9 @@ public class ProjectAlmSettingDao implements Dao {
   }
 
   public List<ProjectAlmSettingDto> selectByProjectUuidsAndAlm(DbSession dbSession, Set<String> projectUuids, ALM alm) {
+    if (projectUuids.isEmpty()) {
+      return Collections.emptyList();
+    }
     return getMapper(dbSession).selectByProjectUuidsAndAlm(projectUuids, alm.getId().toLowerCase(Locale.ROOT));
   }
 
index 577fe35bbc66145d9d60650a461228cf9fddcce2..0739127a6cb7041a2587a526bcfe6d69de298a8e 100644 (file)
@@ -34,6 +34,7 @@ public class SearchRequest {
   private String ps;
   private String q;
   private Boolean deactivated;
+  private Boolean managed;
 
   /**
    * Example value: "42"
@@ -78,4 +79,13 @@ public class SearchRequest {
     this.deactivated = deactivated;
     return this;
   }
+
+  public Boolean getManaged() {
+    return managed;
+  }
+
+  public SearchRequest setManaged(Boolean managed) {
+    this.managed = managed;
+    return this;
+  }
 }
index 078546cde0eb8ee70232a1f532f873b90c9d4a62..25457cf5aa01c3cf53a41c576ebec90fa82d20de 100644 (file)
@@ -149,7 +149,8 @@ public class UsersService extends BaseService {
         .setParam("p", request.getP())
         .setParam("ps", request.getPs())
         .setParam("q", request.getQ())
-        .setParam("deactivated", request.getDeactivated()),
+        .setParam("deactivated", request.getDeactivated())
+        .setParam("managed", request.getManaged()),
       SearchWsResponse.parser());
   }
 
index f5dbe9bb912ffe602280d050adf374d9a1f0137d..885bff99aefda4eff4412072ce5550f97e4f58d4 100644 (file)
@@ -172,6 +172,10 @@ public class UserTester {
     return queryForUser(name, t -> t.getName().equals(name));
   }
 
+  public List<Users.SearchWsResponse.User> getAllManagedUsers() {
+    return service().search(new SearchRequest().setManaged(true)).getUsersList();
+  }
+
   public void changePassword(String login, String previousPassword, String newPassword) {
     service().changePassword(new ChangePasswordRequest().setLogin(login).setPreviousPassword(previousPassword).setPassword(newPassword));
   }