Subject: Update on GitLab-Jenkins Integration Issue

Hi Mark and Dirk,

I hope this email finds you well. I wanted to give you an update on our
ongoing efforts to resolve the GitLab-Jenkins integration issue.

We've made significant progress in addressing the webhook problem in
GitLab. The webhook is now executing successfully with an HTTP 200
response, indicating that it's functioning as expected.

Here are the latest details regarding our webhook configuration in GitLab:

Webhooks
- URL: http://192.168.0.24:40080/Berechit/easyformer/-/hooks

Jenkins Integration
- URL:
http://192.168.0.24:8080/git/notifyCommit?url=http://192.168.0.24:40080/Berechit/easyformer.git&token=75a8746bcf9c658b08491f27860f356d
- SSL Verification: Unchecked
- Trigger: Push events

Manage Jenkins" -> "Security" -> "Git plugin notifyCommit access tokens
- URL: http://192.168.0.24:8080/manage/configureSecurity/
- Current access tokens: Nissan (Token: 75a8746bcf9c658b08491f27860f356d)

However, we are still encountering difficulties with fetching the Git
repository in Jenkins. Despite our efforts, Jenkins prompts for a password
when attempting to clone the repository, which is unexpected behavior for
SSH authentication.

Here are the latest logs from the Jenkins build :
WARNING: Unknown parameter(s) found for class type
'jenkins.plugins.git.GitStep': credentials
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir
/var/jenkins_home/workspace/EasyFormerPipeline/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url [email protected]:Berechit/easyformer.git #
timeout=10
Fetching upstream changes from [email protected]:Berechit/easyformer.git
 > git --version # timeout=10
 > git --version # 'git version 2.39.2'
 > git fetch --tags --force --progress --
[email protected]:Berechit/easyformer.git
+refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from [email protected]:
Berechit/easyformer.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
at
org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
at
org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
at
org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
at
org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags
--force --progress -- [email protected]:Berechit/easyformer.git
+refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: Permission denied, please try again.
Permission denied, please try again.
[email protected]: Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846)
at
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
at
org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997)
... 11 more
ERROR: Error fetching remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting

We are actively working to resolve this issue and will keep you updated on
our progress.

I will also send you the following documents for reference:

1. Issue Jenkins GitLab Integration-Project Documents tittle-28042024-EN
2. Issue Jenkins GitLab Integration-Groovy Pipeline-28042024-EN
3. Issue Jenkins GitLab Integration-Build Logs-28042024-EN
4. Issue Jenkins GitLab Integration-Installation Notes-28042024-EN

Thank you for your continued support and assistance.

Best regards,
Erick

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Sans
virus.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Le dim. 28 avr. 2024 à 00:54, Mark Waite <[email protected]> a
écrit :

>
>
> On Saturday, April 27, 2024 at 3:46:30 PM UTC-6 [email protected] wrote:
>
> Subject: Issue with accessing GitLab repository from Jenkins
>
> Problem Description:
> We have configured Jenkins to access a GitLab repository hosted at
> `192.168.0.24:Berechit/easyformer.git`, but we are encountering
> authentication errors when attempting to retrieve changes from this
> repository. Despite several checks, we have been unable to resolve the
> issue.
>
> Verified Elements:
> - Correct configuration of SSH keys in GitLab and Jenkins.
> - Permissions on the GitLab repository have been checked and appear to be
> correct.
> - SSH keys have been manually tested from the Jenkins container and appear
> to be functioning correctly.
> - Jenkins logs indicate an authentication error when attempting to
> retrieve changes from the repository.
> WARNING: Unknown parameter(s) found for class type
> 'jenkins.plugins.git.GitStep': credentials The recommended git tool is:
> NONE No credentials specified
>
> That message likely means that your pipeline includes the step:
>
> git credential: 'abc' url: 'your-git-repo-url'
>
> The "credential" parameter is not a valid parameter for the "git" step.
> Use the Pipeline syntax snippet generator to use the correct parameter
> name. The Git client plugin documentation page includes a 90 second video
> that shows how to use the generator
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/910f6025-7cff-424d-b6df-5a4ca26d0fe8n%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/910f6025-7cff-424d-b6df-5a4ca26d0fe8n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPrX6vDPi3Bc7rpZk0hrLjOc5JtJi_5f4doZjXxdQ83ooJH0tw%40mail.gmail.com.
1- Installation Procedure for GitLab and Jenkins with Docker on VirtualBox 
7.0.14

2- GitLab Configuration Procedure in Relation to Jenkins

3.0- Webhook Testing Procedure between GitLab and Jenkins for the EasyFormer 
Project

3.1- Creation of an EasyFormer Project on GitLab

3.2- Creation of an EasyFormer Pipeline Project on Jenkins

3.3- Storage of a Word Document in an EasyFormer Folder

3.4- Verification of Document Retrieval by Jenkins

4.0- Integration of a Python Script into a Jenkins Pipeline Project for 
Monitoring Email Inbox and Sending Documents to GitLab

4.1- Setting up Email Inbox Monitoring in Jenkins

4.2- Pipeline Configuration in Jenkins

4.3- Scheduling Regular Execution of the Pipeline in Jenkins

4.4- Configuration of GitLab in Jenkins Pipeline

4.5- Testing the Integration between Jenkins, Gmail, and GitLab
pipeline {
    agent any
    
    stages {
        stage('Checkout') {
            steps {
                // Utilise l'authentification SSH pour accéder au dépôt GitLab
                script {
                    // Définit les informations d'authentification SSH
                    sshCredentials = credentials('jenkinsgitlabssh')
                    
                    // Spécifie l'URL du dépôt GitLab avec l'authentification 
SSH
                    git branch: 'main', credentials: sshCredentials, url: 
'[email protected]:Berechit/easyformer.git'
                }
            }
        }
        stage('Test Pipeline') {
            steps {
                // Copie du document Word à partir de l'emplacement local vers 
le workspace Jenkins
                bat 'copy C:\\Users\\PC\\Documents\\EasyFormer\\Docker Workflow 
- Procédure DSI DevOps.docx .'
                
                // Autres étapes de test à ajouter ici
                
                // Exemple : Vérification des logs de Jenkins
                // Attendre que le processus de build soit terminé
                timeout(time: 10, unit: 'MINUTES') {
                    // Attendre que le build se termine
                    script {
                        def build = currentBuild
                        def job = 
Jenkins.instance.getItemByFullName("EasyFormerPipeline")
                        def log = 
job.getBuildByNumber(build.number).logFile.text

                        if (log =~ /Document Word récupéré avec succès/) {
                            echo 'Document Word récupéré avec succès.'
                        } else {
                            error 'Échec de récupération du document Word.'
                        }
                    }
                }
            }
        }
    }
}
root@easyformer:~# docker exec -it jenkins bash
jenkins@192:/$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/jenkins_home/.ssh/id_rsa):
Created directory '/var/jenkins_home/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/jenkins_home/.ssh/id_rsa
Your public key has been saved in /var/jenkins_home/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:sj/ft651tSyUKHnOZ2X8hVuInHBKSpcBjQdQ9A6Mzpo [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|      .+==.      |
|       o..oo     |
|      . +.* .    |
|     o . *.=.ooo |
|      + Sooo+oo++|
|     o o  = . +o=|
|    E .    o +ooo|
|       ..  .o.o. |
|        .o. o+o. |
+----[SHA256]-----+
jenkins@192:/$ ls ~/.ssh
id_rsa  id_rsa.pub
jenkins@192:/$ cat ~/.ssh/id_rsa.pub
ssh-rsa 
AAAAB3NzaC1yc2EAAAADAQABAAABgQC/eX95bkbtGwbm00kdDbYfK++iQRG+8Q1G1niJSOIv323vbl3vnbILPNvFqIC8tGzzT/JwfkQHwAm6cxNRlMDW6OOZauVgdarY5K5BTM51CvwYN9NiSYCEIVGIYgbRTayn6LFyv8cUIAmd26eUoCF32zjp/daQK+QhDlVAfu0d2BPU+CFpi9XHp679k/8RR3cunWHHTSbN8Xn9D8VxpWcdXpMnFTDCJkLqlGHWHP1Zlk1w2P50ejTCE1OsHkdUlEy3qBBbiojtTAkaIpAXOnIcUt4foTN5Gv51RJIIggN7g0DV/zjR2gXYeUu9ehJGFus6GqDMnNm/PoAlwBOlznzBreSWUMlm3L9dyDg+Ak9zv/6H+pJBYE037CIX42Iyf/Umn6RL3ozdcvWwdS8ReaU2+Y6npy9/LuEe2Zltska+pIJCye+rNiT6/aim6hq+SBwKULLclnlk5Xa79YTx4oOgOs/SOJgcx2Y265kNEfgUub4S0JgwpPgZSUoDaGPF7Dk=
 [email protected]

*** Add the key to GitLab
http://192.168.0.24:40080/-/profile/keys
ssh-rsa 
AAAAB3NzaC1yc2EAAAADAQABAAABgQC/eX95bkbtGwbm00kdDbYfK++iQRG+8Q1G1niJSOIv323vbl3vnbILPNvFqIC8tGzzT/JwfkQHwAm6cxNRlMDW6OOZauVgdarY5K5BTM51CvwYN9NiSYCEIVGIYgbRTayn6LFyv8cUIAmd26eUoCF32zjp/daQK+QhDlVAfu0d2BPU+CFpi9XHp679k/8RR3cunWHHTSbN8Xn9D8VxpWcdXpMnFTDCJkLqlGHWHP1Zlk1w2P50ejTCE1OsHkdUlEy3qBBbiojtTAkaIpAXOnIcUt4foTN5Gv51RJIIggN7g0DV/zjR2gXYeUu9ehJGFus6GqDMnNm/PoAlwBOlznzBreSWUMlm3L9dyDg+Ak9zv/6H+pJBYE037CIX42Iyf/Umn6RL3ozdcvWwdS8ReaU2+Y6npy9/LuEe2Zltska+pIJCye+rNiT6/aim6hq+SBwKULLclnlk5Xa79YTx4oOgOs/SOJgcx2Y265kNEfgUub4S0JgwpPgZSUoDaGPF7Dk=
 [email protected]

*** New credential
http://192.168.0.24:8080/manage/credentials/store/system/domain/_/newCredentials

Type
SSH Username with private key

Scope
(Global (Jenkins, agents, items, etc...)

ID
jenkinsgitlabssh

Enter directly
Key

### Dashboard -> Administer Jenkins -> Security
http://192.168.0.24:8080/manage/configureSecurity/

Git Host Key Verification Configuration
Host Key Verification Strategy
Accept first connection

### Create a token in GitLab
http://192.168.0.24:40080/-/user_settings/personal_access_tokens

glpat-LpjdaKoJTAjMabWUC3yd

### In Jenkins New credentials
http://192.168.0.24:8080/manage/credentials/store/system/domain/_/newCredentials

Type 
Secret text

ID
Jenkinsgitlabaccesstoken

### Install the GitLab plugin
http://192.168.0.24:8080/manage/pluginManager/available

### Dashboard -> Administer Jenkins -> System
http://192.168.0.24:8080/manage/configure

GitLab 
Enable authentication for '/project' end-point
GitLab connections
Connection name
A name for the connection
Jenkinsgitlabconnection
GitLab host URL
The complete URL to the GitLab server (e.g. http://gitlab.mydomain.com)
http://192.168.0.24:40080
Credentials
API Token for accessing GitLab
jenkinsgitlabaccesstoken
*** Connection test
Success

### Test with curl
root@easyformer:~# docker exec -it -uroot jenkins bash
root@192:/# curl http://192.168.0.24:40080/
<html><body>You are being <a 
href="http://192.168.0.24:40080/users/sign_in";>redirected</a>.</body></html>root@192:/#

### Dashboard -> EasyFormerPipeline -> Configuration
http://192.168.0.24:8080/job/EasyFormerPipeline/configure

Build when a change is pushed to GitLab. GitLab webhook URL: 
http://192.168.0.24:8080/project/EasyFormerPipeline
Configure GitLab to deliver a POST request to your Jenkins instance like GitLab 
CI.

Secret token
If this is configured only WebHooks that have configured the same token can 
trigger a build.

11b263dbb6e2a1f398bee5f391e98041a5

### GitLab

Log in as admin 
http://192.168.0.24:40080/admin/application_settings/network

Outbound requests
Allow requests to the local network from hooks and integrations.

Check the following options:
       Allow requests to the local network from webhooks and integrations
       Allow requests to the local network from system hooks


### Webhooks
http://192.168.0.24:40080/Berechit/easyformer/-/hooks

Webhooks enable you to send notifications to web applications in response to 
events in a group or project. We recommend using an integration in preference 
to a webhook.

URL
http://192.168.0.24:8080/git/notifyCommit?url=http://192.168.0.24:40080/Berechit/easyformer.git&token=75a8746bcf9c658b08491f27860f356d

SSL verification
Uncheck Check
Enable SSL verification

Trigger
Check 
Push events

### Manage Jenkins" -> "Security" -> "Git plugin notifyCommit access tokens
Generate a token
1.      From your Jenkins instance, go to Manage Jenkins → Configure Global 
Security.
2.      Find the Git plugin notifyCommit access tokens section.
3.      Click Add new access token.
4.      Enter the token name and click Generate.
5.      Jenkins generates the notifyCommit token required in the Bitbucket 
Jenkins Base dialog.
http://192.168.0.24:8080/manage/configureSecurity/
Git plugin notifyCommit access tokens 
Current access tokens
Nissan
75a8746bcf9c658b08491f27860f356d

### Test Push events
Hook executed successfully: HTTP 200
WARNING: Unknown parameter(s) found for class type 
'jenkins.plugins.git.GitStep': credentials
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir 
 > /var/jenkins_home/workspace/EasyFormerPipeline/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url [email protected]:Berechit/easyformer.git # 
 > timeout=10
Fetching upstream changes from [email protected]:Berechit/easyformer.git
 > git --version # timeout=10
 > git --version # 'git version 2.39.2'
 > git fetch --tags --force --progress -- 
 > [email protected]:Berechit/easyformer.git +refs/heads/*:refs/remotes/origin/* 
 > # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from 
[email protected]:Berechit/easyformer.git
        at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)
        at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
        at 
org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
        at 
org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
        at 
org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
        at 
org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
        at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown 
Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown 
Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --force 
--progress -- [email protected]:Berechit/easyformer.git 
+refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied, please try again.
Permission denied, please try again.
[email protected]: Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

        at 
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846)
        at 
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
        at 
org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
        at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997)
        ... 11 more
ERROR: Error fetching remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting

Reply via email to