# Using Jenkins with Google Cloud

**URL:** <https://community.jenkins.io/t/using-jenkins-with-google-cloud/4002>\
**Category:** Using Jenkins\
**Created:** [September 28, 2022, 4:07pm UTC](https://community.jenkins.io/t/using-jenkins-with-google-cloud/4002 "2022-09-28T16:07:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![koranke](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/koranke/32/2206_2.png) [@koranke](https://community.jenkins.io/u/koranke)\
**Post date:** [September 28, 2022, 4:07pm UTC](https://community.jenkins.io/t/using-jenkins-with-google-cloud/4002/1 "2022-09-28T16:07:38Z")

</div>

This is more of a Google Cloud issue, but I’m hoping someone here might have experience with this. I have a project that runs E2E tests that interact with services hosted on Google Cloud and that run commands from the Google Cloud CLI (gcloud, gsutil). These all run under my personal Google Cloud auth when running them locally. For Jenkins, which is running on a VM hosted on Google Cloud, we installed the plugin Google OAuth Credentials. I’ve followed the instructions for adding credentials that use a json key file linked to a Google Cloud service account. However, when I run tests from Jenkins, they continue to fail with the following error. Anyone know what I’m doing wrong here or what the fix is?

com.google.api.gax.rpc.UnavailableException: io.grpc.StatusRuntimeException: UNAVAILABLE: Credentials failed to obtain metadata  
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: Credentials failed to obtain metadata  
Caused by: java.io.IOException: Error code 404 trying to get security access token from Compute Engine metadata for the default service account. This may be because the virtual machine instance does not have permission scopes specified. It is possible to skip checking for Compute Engine metadata by specifying the environment variable NO\_GCE\_CHECK=true.

---

<div class="post-metadata">

**Author:** ![koranke](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/koranke/32/2206_2.png) [@koranke](https://community.jenkins.io/u/koranke)\
**Post date:** [September 28, 2022, 4:14pm UTC](https://community.jenkins.io/t/using-jenkins-with-google-cloud/4002/2 "2022-09-28T16:14:46Z")

</div>

One thing I’ve noticed, that maybe is unrelated, but on an older install of Jenkins, all credentials are for the domain “Jenkins”, but on this newer install all the credentials are for the domain “System”. Does that matter? Also, maybe I’ve just missed something obvious. I created the credential, but is there an additional step I need to take in Jenkins so that projects actually use the credentials?

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [September 28, 2022, 4:22pm UTC](https://community.jenkins.io/t/using-jenkins-with-google-cloud/4002/3 "2022-09-28T16:22:19Z")

</div>

Does this help? [https://dareplanet.tech/en/insights/how-to-configure-jenkins-with-google-cloud-platform/](https://dareplanet.tech/en/insights/how-to-configure-jenkins-with-google-cloud-platform/)

---

<div class="post-metadata">

**Author:** ![koranke](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/koranke/32/2206_2.png) [@koranke](https://community.jenkins.io/u/koranke)\
**Post date:** [September 28, 2022, 4:29pm UTC](https://community.jenkins.io/t/using-jenkins-with-google-cloud/4002/4 "2022-09-28T16:29:59Z")

</div>

I don’t think so. It’s about how to set up Jenkins with Google Cloud in order to spin up Jenkins agents on Google Cloud Compute engine. But my issue is how to interact with the Google CLI commands and Google services (Google CLI is installed on the Jenkins server). Still, I’ve done the basic instructions as listed there in that article.

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [September 28, 2022, 5:37pm UTC](https://community.jenkins.io/t/using-jenkins-with-google-cloud/4002/5 "2022-09-28T17:37:07Z")

</div>

I think the credentials portion of that plugin would be useful to you since it sounds like that is where you are getting hung up.

---

<div class="post-metadata">

**Author:** ![koranke](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/koranke/32/2206_2.png) [@koranke](https://community.jenkins.io/u/koranke)\
**Post date:** [September 28, 2022, 7:00pm UTC](https://community.jenkins.io/t/using-jenkins-with-google-cloud/4002/6 "2022-09-28T19:00:23Z")

</div>

Yes, but I already configured that and it didn’t solve anything. However, I’m starting to suspect that the core issue is outside of Jenkins configuration. That plugin may not be intended for things like running Google CLI commands from a test getting run by Jenkins, but instead for things like the link you provided where it’s used for more Google Admin type stuff.

For example, there is a Google CLI command that one needs to run to get authorized to use the CLI.

sudo -u jenkins gcloud auth activate-service-account SERVICE\_ACCOUNT --key-file=KEY\_FILE

I just ran this on the Jenkins server as user jenkins. Tests are still failing despite that, but that’s probably more the direction I need to investigate than configuration within Jenkins.
