There is like 3000 ways to setup authentification between jenkins and gitlab and i'm pretty confused. What I want to do is pretty trivial : Checkout from a gitlab branch, build with maven, create a docker image, push it into a registry
What I did :
- Install gitlab plugins into jenkins
- Setup API Token between gitlab and jenkins (Test SUCCESS)
- Setup webhook between gitlab and jenkins (OK, my job if called for any push on git repo)
- Add SSH PUBLIC credentials into Jenkins : id_rsa.pub content from the server that contains the jenkins docker container (with admin user)
My pipeline first stage :
node {
deleteDir()
def mvnHome
def pom
stage('Checkout SCM') {
git branch: 'develop', credentialsId: 'xxxxxxxxxxxxxxx', url: '[email protected]:blablabla/blablablabla.git'
mvnHome = tool 'M3'
pom = readMavenPom file: 'pom.xml'}
Error :
ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Command "git fetch --tags --progress [email protected]:blablabla/blablablabla.git +refs/heads/:refs/remotes/origin/" returned status code 128: stdout: stderr: Permission denied (publickey). fatal: Could not read from remote repository.