Jenkins in Docker Container and Google Cloud Source Repository - no Credentials visible

1.4k views Asked by At

I read everything in this post and multiple others but nothing is working... I cannot use Google Credentials to access my git Repo in Google Cloud Platform

I have Jenkins running in a Docker Container in Google Cloud Platform. I have Source Code in a Google Cloud Repository that I want to use for a Build.

On the Google Cloud Platform side I created a Service User, gave the User the following Roles:

  • Project Worker
  • Source-Repository Admin
  • Storageobject creator
  • ComputeEngine creator

I created the JSON File and downloaded it.

On The Jenkins Side I installed the Google OAuth Credentials and the Google Container Registry Auth Plugin.

I added new Credentials "Google Service Account from private key" and added the json file.

enter image description here

So, if I now want to create a new Job (Freestyle or pipeline does not matter) I see the following: enter image description here

I see the credentials I created but for the "Google Container Registry". As soon as I add the repository URL, "https://source.developers.google.com/p...." The Drop-down is cleared and all is gone.

I also took a look at the credentials.xml and job file, to see, if I can rewrite there something by myself. The Google Credentials do not have an credentialId like others...

<com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials plugin="[email protected]">
      <module/>
      <projectId>testprojekt</projectId>
      <serviceAccountConfig class="com.google.jenkins.plugins.credentials.oauth.JsonServiceAccountConfig">
        <jsonKeyFile>/var/jenkins_home/gauth/key8529180263669390055.json</jsonKeyFile>
      </serviceAccountConfig>
    </com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials>

I'm currently out of ideas... would be happy for any hint. Thank you!

0

There are 0 answers