]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13978 validate gitlab alm settings
authorPierre <pierre.guillot@sonarsource.com>
Tue, 20 Oct 2020 14:09:31 +0000 (16:09 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 4 Nov 2020 20:05:48 +0000 (20:05 +0000)
.cirrus.yml
sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/AlmSettingsService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/ValidateRequest.java [new file with mode: 0644]

index 04d0c9fd2391a5d8bcc409fc4fc6d587e5e2a421..664b8bfa90208e13bc5cd59f47f0f2896dac89bd 100644 (file)
@@ -226,7 +226,14 @@ qa_gitlab_task:
         memory: 5Gb
         env:
           # Creating a personnal access token from rails console for test purpuse (can't do through gitlab REST API)
-          GITLAB_POST_RECONFIGURE_SCRIPT: "gitlab-rails runner \"token = User.find_by_username('root').personal_access_tokens.create(scopes: [:api], name: 'token'); token.set_token('token-here-456'); token.save!\""
+          GITLAB_POST_RECONFIGURE_SCRIPT: "gitlab-rails runner \"
+          token = User.find_by_username('root').personal_access_tokens.create(scopes: [:api], name: 'token');
+          token.set_token('token-here-456');
+          token.save!;
+          token_read = User.find_by_username('root').personal_access_tokens.create(scopes: [:read_api], name: 'token_read');
+          token_read.set_token('token-read-123');
+          token_read.save!;
+          \""
   env:
     # No need to clone the full history.
     # Depth of 1 is not enough because it would fail the build in case of consecutive pushes
index 3f7bc52032c96970c2451e963a728f04a1cee6cd..b12d6197b56168e10618eb5d6fbf30fa12419b3c 100644 (file)
@@ -162,6 +162,17 @@ public class AlmSettingsService extends BaseService {
       AlmSettings.ListWsResponse.parser());
   }
 
+  /**
+   * This is a GET request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/validate">Further information about this action online (including a response example)</a>
+   * @since 8.6
+   */
+  public void validate(ValidateRequest request) {
+    call(
+      new GetRequest(path("validate"))
+        .setParam("key", request.getKey()));
+  }
+
   /**
    *
    * This is a GET request.
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/ValidateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/ValidateRequest.java
new file mode 100644 (file)
index 0000000..6433199
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonarqube.ws.client.almsettings;
+
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/validate">Further information about this action online (including a response example)</a>
+ * @since 8.6
+ */
+@Generated("sonar-ws-generator")
+public class ValidateRequest {
+
+  private String key;
+
+  public String getKey() {
+    return key;
+  }
+
+  public ValidateRequest setKey(String key) {
+    this.key = key;
+    return this;
+  }
+}