jenkinsci / jenkinsci/java-client-api

Exception: org.apache.http.client.HttpResponseException: Forbidden error

Aperta
#319 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
913
Fork
466
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi,

I'm using this jenkins client to trigger jobs and get the console output. But, since yesterday I'm getting the error
"**Exception: org.apache.http.client.HttpResponseException: Forbidden**" exception when I trigger a job using my existing credentials.

I'm able to fetch details of the job but not trigger a build using the same credentials.

Here's the sample snippet of code i'm using for triggering a job and fetching details from a job.

Triggering a job (Not working)

`String uri = "http://A.B.C.D:PORT/jenkins";
String username = "xyz";
String password = "xyz";
JenkinsServer js = null;

try {
js = new JenkinsServer(new URI(uri), username, password);
} catch(Exception e) {
System.out.println("Exception: " + e);
}
BuildWithDetails buildDetails = null;

try {
JenkinsTriggerHelper jsHelper = new JenkinsTriggerHelper(js);
buildDetails = jsHelper.triggerJobAndWaitUntilFinished("dev-3");
} catch(Exception e) {
System.out.println("Exception: " + e);
}

String consoleOutput = "";
System.out.println("Build details: " + buildDetails.getResult());
System.out.println("Build duration: " + buildDetails.getDuration());
//System.out.println("Build logs: " + buildDetails.getConsoleOutputText());

System.out.println(getBuildInfo(buildDetails.getConsoleOutputText()));
`

I believe it is something to do with authorizations for a user but as far as I know there haven't been any upgrades to the jenkins server we're using.

Any help is appreciated.

Thank you!

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with JenkinsTriggerHelper.triggerJobAndWaitUntilFinished and compare its request with the job-details request shown in the issue. Reproduce the trigger call using the provided JenkinsServer credentials and inspect the HTTP response to determine whether the client request or Jenkins authorization produces the 403. Done means the cause of the forbidden response is identified and the issue has a confirmed client-side or server-side resolution path.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api, authorization
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.