Closed gpongelli closed 1 month ago
further tests using raw curl commands from a local machine, using the same token configured as gitlab-branch-plugin's credential:
list groups
curl --header "PRIVATE-TOKEN: glpat-...." "https://gitlab-<server>/api/v4/groups/" | jq
it works
list descendant subgroups
curl --header "PRIVATE-TOKEN: glpat-...." "https://gitlab-<server>/api/v4/groups/15/descendant_groups" | jq
it works
show the group passed as plugin's input
curl --header "PRIVATE-TOKEN: glpat-...." "https://gitlab-<server>/api/v4/groups/7038" | jq
it works
search the group by its name, as written into gitlab-branch-plugin text field
curl --header "PRIVATE-TOKEN: glpat-...." "https://gitlab-<server>/api/v4/groups?search=<rootgroup>/<subgroup>" | jq
it works, and the array contains the group 7038 of previous test
so in terms of gitlab token and permissions, seems everything is working as expected.
same issue happens with this configuration
main differences between those two configurations:
I've also made a simple java app with following code, and it worked:
package gitlab4j.api.tester;
import org.gitlab4j.api.GitLabApi;
import org.gitlab4j.api.GitLabApiException;
import org.gitlab4j.api.models.Project;
import org.gitlab4j.api.models.Group;
import java.util.List;
public class App {
public void test_gitlab() {
GitLabApi gitLabApi = new GitLabApi("https://gitlab-<server>", "glpat-...");
try {
// Get the list of projects your account has access to
List<Project> projects = gitLabApi.getProjectApi().getProjects();
for (int i = 0; i < projects.size(); i++) {
Project p = projects.get(i);
System.out.println(p.getName());
}
// Get a list of groups that you have access to
List<Group> groups = gitLabApi.getGroupApi().getGroups();
for (int i = 0; i < groups.size(); i++) {
Group g = groups.get(i);
System.out.println(g.getName());
}
Group gr = gitLabApi.getGroupApi().getGroup("<rootgroup>/<subgroup>");
System.out.println(gr.getName());
} catch (GitLabApiException e) {
throw new RuntimeException(e);
}
}
public static void main(String[] args) {
App test_app = new App();
test_app.test_gitlab();
}
}
I've no idea on how to investigate further.
Thank you.
I've found the root cause of this issue: this plugin relies on an host connection, defined into "Manage Jenkins -> System" that was using a different token, that is expired too.
Once created a new token it had started working as usual.
I'm closing this issue, sorry.
Jenkins and plugins versions report
Environment
```text Jenkins: 2.462.2 OS: Linux - 6.1.85+ Java: 17.0.12 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) --- agent-maintenance:2.207.v73c521a_1d9db_ ansible:403.v8d0ca_dcb_b_502 ansicolor:1.0.4 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 asm-api:9.7-33.v4d23ef79fcc8 authentication-tokens:1.119.v50285141b_7e1 bootstrap5-api:5.3.3-1 bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_ branch-api:2.1178.v969d9eb_c728e build-user-vars-plugin:176.vb_9c7907fd524 caffeine-api:3.1.8-133.v17b_1ff2e0599 calendar-view:0.3.3 checks-api:2.2.1 cloudbees-folder:6.951.v5f91d88d76b_b_ command-launcher:115.vd8b_301cc15d0 commons-lang3-api:3.17.0-84.vb_b_938040b_078 commons-text-api:1.12.0-129.v99a_50df237f7 configuration-as-code:1850.va_a_8c31d3158b_ credentials:1371.vfee6b_095f0a_3 credentials-binding:681.vf91669a_32e45 data-tables-api:2.1.6-1 display-url-api:2.204.vf6fddd8a_8b_e9 downstream-buildview:69.v16da_b_2c36f6c durable-task:568.v8fb_5c57e8417 echarts-api:5.5.1-1 eddsa-api:0.3.0-4.v84c6f0f4969e email-ext:1814.v404722f34263 flatpickr-api:4.6.13-5.v534d8025a_a_59 font-awesome-api:6.6.0-2 gcp-secrets-manager-credentials-provider:0.3.1 git:5.4.1 git-client:5.0.0 gitlab-api:5.6.0-97.v6603a_83f8690 gitlab-branch-source:710.v6f19df32544b_ gitlab-oauth:1.19 gitlab-plugin:1.8.1 gson-api:2.11.0-41.v019fcf6125dc handy-uri-templates-2-api:2.1.8-30.v7e777411b_148 instance-identity:185.v303dc7c645f9 ionicons-api:74.v93d5eb_813d5f jackson2-api:2.17.0-379.v02de8ec9f64c jakarta-activation-api:2.1.3-1 jakarta-mail-api:2.1.3-1 javax-activation-api:1.2.0-7 javax-mail-api:1.6.2-10 jaxb:2.3.9-1 jdk-tool:80.v8a_dee33ed6f0 jersey2-api:2.44-151.v6df377fff741 jfrog:1.5.1 jira:3.13 jobConfigHistory:1259.v8f2448483000 joda-time-api:2.12.7-29.v5a_b_e3a_82269a_ jquery:1.12.4-1 jquery3-api:3.7.1-2 json-api:20240303-41.v94e11e6de726 json-path-api:2.9.0-58.v62e3e85b_a_655 junit:1300.v03d9d8a_cf1fb_ kiuwanJenkinsPlugin:1.6.1 kubernetes:4287.v73451380b_576 kubernetes-client-api:6.10.0-240.v57880ce8b_0b_2 kubernetes-credentials:189.v90a_488b_d1d65 ldap:725.v3cb_b_711b_1a_ef lockable-resources:1301.v0e3b_da_4b_4462 mailer:472.vf7c289a_4b_420 mask-passwords:173.v6a_077a_291eb_5 matrix-auth:3.2.2 matrix-project:832.va_66e270d2946 metrics:4.2.21-451.vd51df8df52ec mina-sshd-api-common:2.13.2-125.v200281b_61d59 mina-sshd-api-core:2.13.2-125.v200281b_61d59 okhttp-api:4.11.0-172.vda_da_1feeb_c6e parameterized-scheduler:277.v61a_4b_a_49a_c5c pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-graph-analysis:216.vfd8b_ece330ca_ pipeline-groovy-lib:730.ve57b_34648c63 pipeline-input-step:495.ve9c153f6067b_ pipeline-milestone-step:119.vdfdc43fc3b_9a_ pipeline-model-api:2.2214.vb_b_34b_2ea_9b_83 pipeline-model-definition:2.2214.vb_b_34b_2ea_9b_83 pipeline-model-extensions:2.2214.vb_b_34b_2ea_9b_83 pipeline-rest-api:2.34 pipeline-stage-step:312.v8cd10304c27a_ pipeline-stage-tags-metadata:2.2214.vb_b_34b_2ea_9b_83 pipeline-stage-view:2.34 plain-credentials:183.va_de8f1dd5a_2b_ plugin-util-api:4.1.0 prism-api:1.29.0-17 pubsub-light:1.18 role-strategy:743.v142ea_b_d5f1d3 schedule-build:577.v0613c45b_9eef scm-api:696.v778d637b_a_762 script-security:1361.v913100720139 snakeyaml-api:2.3-123.v13484c65210a_ sse-gateway:1.27 ssh-credentials:343.v884f71d78167 sshd:3.330.vc866a_8389b_58 structs:338.v848422169819 timestamper:1.27 token-macro:400.v35420b_922dcb_ trilead-api:2.147.vb_73cc728a_32e variant:60.v7290fc0eb_b_cd workflow-aggregator:600.vb_57cdd26fdd7 workflow-api:1336.vee415d95c521 workflow-basic-steps:1058.vcb_fc1e3a_21a_9 workflow-cps:3961.ve48ee2c44a_b_3 workflow-durable-task-step:1371.vb_7cec8f3b_95e workflow-job:1436.vfa_244484591f workflow-multibranch:795.ve0cb_1f45ca_9a_ workflow-scm-step:427.v4ca_6512e7df1 workflow-step-api:678.v3ee58b_469476 workflow-support:920.v59f71ce16f04 ```What Operating System are you using (both controller, and any agents involved in the problem)?
Linux operating system in kubernetes deployment.
Reproduction steps
Expected Results
plugin can talk with gitlab correctly
Actual Results
"Unable to Fetch Group"
Anything else?
credentials are synched between GCP Secret Manager and Jenkins through Kubernetes credentials jenkins' plugin.
gitlab server is at version 17.4.1 .
Thanks.
Are you interested in contributing a fix?
I could, no idea how.