actions-hub / gcloud Goto Github PK
View Code? Open in Web Editor NEWGitHub Action for interacting with Google Cloud Platform (GCP)
Home Page: https://github.com/marketplace/actions/google-cloud-platform-gcp-cli-gcloud
License: MIT License
GitHub Action for interacting with Google Cloud Platform (GCP)
Home Page: https://github.com/marketplace/actions/google-cloud-platform-gcp-cli-gcloud
License: MIT License
Hello, I have been successfully using this action for some time and I am suddenly getting an error as of yesterday. Neither the GitHub actions yaml
nor the GAE app.yaml
have been changed for 14 days.
The error from the build log is:
Detect credentials from previous session...
APPLICATION_CREDENTIALS found. Setting up a credentials....
APPLICATION_CREDENTIALS is Base64 Encoded
Activated service account credentials for: [github-actions-sa-dev@***.iam.gserviceaccount.com]
Previous project id not detected
Updated property [core/project].
Services to deploy:
descriptor: [/github/workspace/app/app.yaml]
source: [/github/workspace/app]
target project: [***]
target service: [default]
target version: [20210204t103742]
target url: [https://***.uc.r.appspot.com]
Do you want to continue (Y/n)?
Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 11 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...
.........................................................................................................................................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [5] Cannot get cloud region in global job.
The section of the GitHub actions yaml
file that creates this log is:
- name: Deploy
uses: actions-hub/gcloud@master
env:
APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_DEV }}
PROJECT_ID: ${{ secrets.PROJECT_ID_DEV }}
with:
args: "app deploy app/app.yaml --project=${{ secrets.PROJECT_ID_DEV }}"
The app.yaml
is:
runtime: python37
entrypoint: gunicorn -t 120 -b :$PORT main:app
handlers:
- url: /.*
secure: always
script: auto
env_variables:
REGION: "us-central1"
EMAIL_FUNCTION: "sendEmailSMTP"
Let me know if I can provide any more information to be helpful.
Thanks for this repo!
About
PROJECT_ID - must be provided to activate a specific project.
Do we really need this? In service account(json), it already has project_id in it?
Hi,
I am trying to use this action to deploy a coud function gen2.
I need to have access to the --concurency argument, which is only available in the gcloud beta component.
So instead of running functions deploy xxx
I need to be able to run beta functions deploy xxx
because the concurrency flag only exists there.
Is this achievable in the current version of this action?
Kind regards,
Jimmy
https://github.com/actions-hub/gcloud/blob/master/entrypoint.sh#L16
Should become:
if [ "$(echo "$APPLICATION_CREDENTIALS" | tr -d \\n)" = "$(echo "$APPLICATION_CREDENTIALS" | base64 -d | base64 | tr -d \\n)" ]; then
There is currently an issue with gcloud update: https://stackoverflow.com/questions/59000291/cant-deploy-to-app-engine-standard-with-gcloud-components-272-0-0
It would be great if we could choose the version of gloud components so we can mitigate this sort of thing in the future.
Right now I have to do args: components update --version=271.0.0 && gcloud app deploy app.yaml
I'm getting the following on deploy:
ERROR: (gcloud.app.deploy) [/github/workspace/app.yaml] does not exist.
I noticed this similar issue but the suggestion there does not help in my case (already declared actions/checkout@v1
). Any ideas?
name: Deploy to Google App Engine
on:
push:
branches:
- master
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-hub/gcloud@master
env:
PROJECT_ID: ${{secrets.GCLOUD_PROJECT_ID}}
APPLICATION_CREDENTIALS: ${{secrets.GCP_CREDENTIALS}}
with:
args: app deploy app.yaml
Hi
I'm setting up github actions to deploy some functions to gcloud. The project was build in a weird way, meaning functions were in different directories as if they were separate projects.
How can I set the working directory to be used when calling the gcloud CLI?
I see there is a parameter called entryPoint, but there is no documentation about this.
I've also tried using PROJECT_PATH environment variable with no success (saw this suggested for the firebase cli).
thanks!
Hi,
Not an error but a confusing behavior.
When using gcloud app deploy on a flex environment using the --image-url parameter, the briefing before the initial confirmation prompt still shows the source like it would without a specified image.
In my opinion, since it doesn't use the source folder, it should either not show the source line or show it with the image url provided.
Thanks!
A simple workflow with a step like:
- name: Upload to Google Cloud
uses: actions-hub/gcloud@master
env:
PROJECT_ID: my-project-id
APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
CLI: gsutil
with:
args: -h "Cache-Control:public, max-age=86400" -m cp -r docs/** gs://my-bucket/${{ env.GITHUB_REF_SLUG }}
Fails with CommandException: Invalid command "max-age=86400".
The same command works if -h "Cache-Control:public, max-age=86400"
is omitted.
Following the docs here it appears that this should work?
Hello there,
I managed to set up the gcloud access via this step :
- name: GCS
uses: google-github-actions/[email protected]
with:
service_account_email : ${{ secrets.GCP_SA_MAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
I guess this works, because it outputs this :
Activated service account credentials for: [***]
Successfully exported Default Application Credentials
However this next step does not :
- name: Get data
run: gsutil -m cp gs://pubsite_prod_7763943235860257566/stats/installs/* data/
I get the error :
AccessDeniedException: 403 *** does not have storage.objects.list access to the Google Cloud Storage bucket.
I'm not sure that's it's related to gcloud action, maybe it's more on the service account I use (that does have the proper permission, but the bucket I tried to access is not mine, it's generated by google play console to share some stats reports). If you have any recommendations on my gcloud setup here, I'm all ears. If it's not related, feel free to close this.
Cheers,
Hi, was wondering if anyone has any exmaples of using action-hub/gcloud to setup the auth configure-docker and being able to push docker images to GCR.
I have been trying and getting authentication failures but it seems to work if I switch back to the old way of doing docker pushes i.e via gcloud docker -- push ..
instead of just a simple docker push ...
I did also validate that the authentication is setup because before running the docker push action I use gcloud@master to setup my docker authentication by running: gcloud auth configure-docker
So, if anyone has success or a working example that would be great help.
Weirdly this command works:
gcloud config set project ${{GCLOUD_PROJECT}}
But when I set the actions it doesn't.
Using your exact example:
name: gcloud
on: [push]
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-hub/gcloud@master
env:
PROJECT_ID: myProject
APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
with:
args: app deploy app.yaml
Given that you have two service accounts and one have access to one project and other have access to the other.
When you have a multistep like this:
name: gcloud
on: [push]
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "deploy to project A"
uses: actions-hub/gcloud@master
env:
PROJECT_ID: ${{secrets.GCLOUD_PROJECT_ID_A}}
APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS_A}}
with:
args: app deploy app.yaml
- name: "deploy to project B"
uses: actions-hub/gcloud@master
env:
PROJECT_ID: ${{secrets.GCLOUD_PROJECT_ID_B}}
APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS_B}}
with:
args: app deploy app.yaml
This error is thrown in the "deploy to project B" step:
WARNING: You do not appear to have access to project [***] or it does not exist.
If you run each step in a separated job, it works.
Got this error when added key.json to GitHub secret directly.
The solution is to convert the key to base64, as the README of this repo says.
If possible, can we improve this error message?
Thanks for the hard work! :)
Warnings while using the action.
Warning: The `add-path` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
The code at issue here is at the following lines -> https://github.com/actions-hub/gcloud/blob/master/entrypoint.sh#L59-L60
According to this blog post https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
Action and workflow authors who are setting environment variables via stdout should update any usage of the set-env and add-path workflow commands to use the new environment files.
Documentation on adding to the system path. https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
echo "{path}" >> $GITHUB_PATH
I've recently bumped my GitHub Action workflow to the latest version of actions-hub/[email protected]
and noticed a significant increase in build time.
Before, the step "Build actions-hub/gcloud" was taking around 15 seconds.
Now, this step takes more than a minute. I suspect this is caused by the gcloud components install kubectl
, which was added in this commit: 6bab6cb
2021-06-08T14:51:21.4987582Z ##[group]Build container for action use: '/home/runner/work/_actions/actions-hub/gcloud/342.0.0/Dockerfile'.
2021-06-08T14:51:21.5064958Z ##[command]/usr/bin/docker build -t 8a33c1:80a600b1500d495d83dd85e865c7381e -f "/home/runner/work/_actions/actions-hub/gcloud/342.0.0/Dockerfile" "/home/runner/work/_actions/actions-hub/gcloud/342.0.0"
2021-06-08T14:51:21.7853814Z Sending build context to Docker daemon 20.99kB
2021-06-08T14:51:21.7855470Z
2021-06-08T14:51:21.8435208Z Step 1/7 : FROM google/cloud-sdk:341.0.0-alpine
2021-06-08T14:51:22.0723542Z 341.0.0-alpine: Pulling from google/cloud-sdk
2021-06-08T14:51:22.0740757Z 540db60ca938: Already exists
2021-06-08T14:51:22.0792032Z 64e5d75b238f: Pulling fs layer
2021-06-08T14:51:22.0792862Z 0c2748428a7c: Pulling fs layer
2021-06-08T14:51:22.0793485Z 3e47295c32ab: Pulling fs layer
2021-06-08T14:51:22.0794108Z e4e07e27c52d: Pulling fs layer
2021-06-08T14:51:22.0794732Z e4e07e27c52d: Waiting
2021-06-08T14:51:22.1459865Z 0c2748428a7c: Verifying Checksum
2021-06-08T14:51:22.1461810Z 0c2748428a7c: Download complete
2021-06-08T14:51:22.2086215Z e4e07e27c52d: Verifying Checksum
2021-06-08T14:51:22.2086992Z e4e07e27c52d: Download complete
2021-06-08T14:51:22.3121465Z 64e5d75b238f: Verifying Checksum
2021-06-08T14:51:22.3125421Z 64e5d75b238f: Download complete
2021-06-08T14:51:23.7491638Z 64e5d75b238f: Pull complete
2021-06-08T14:51:23.7672622Z 3e47295c32ab: Verifying Checksum
2021-06-08T14:51:23.7680985Z 3e47295c32ab: Download complete
2021-06-08T14:51:23.9462304Z 0c2748428a7c: Pull complete
2021-06-08T14:51:32.4521519Z 3e47295c32ab: Pull complete
2021-06-08T14:51:32.5178638Z e4e07e27c52d: Pull complete
2021-06-08T14:51:32.5216710Z Digest: sha256:42fe876c36dc916cb5a90038c14bf7d1fdee617534bfce227e3d128d5f25b749
2021-06-08T14:51:32.5236183Z Status: Downloaded newer image for google/cloud-sdk:341.0.0-alpine
2021-06-08T14:51:32.5250241Z ---> a25e29c380dc
2021-06-08T14:51:32.5252273Z Step 2/7 : COPY LICENSE README.md /
2021-06-08T14:51:33.4532915Z ---> 1f6675ce5258
2021-06-08T14:51:33.4539855Z Step 3/7 : RUN gcloud components install kubectl
2021-06-08T14:51:33.4824944Z ---> Running in 64823edb3f19
2021-06-08T14:51:34.5533099Z �[91m
2021-06-08T14:51:34.5545733Z �[0m�[91m
2021-06-08T14:51:34.5548519Z Your current Cloud SDK version is: 341.0.0
2021-06-08T14:51:34.5573788Z Installing components from version: 341.0.0
2021-06-08T14:51:34.5574823Z
2021-06-08T14:51:34.5623642Z �[0m�[91m┌──────────────────────────────────────────────────────────────────┐�[0m�[91m
2021-06-08T14:51:34.5625246Z │ These components will be installed. │�[0m�[91m
2021-06-08T14:51:34.5626735Z �[0m�[91m├─────────────────────┬─────────────────────┬──────────────────────┤
2021-06-08T14:51:34.5628115Z �[0m�[91m│ Name │ Version │ Size │�[0m�[91m
2021-06-08T14:51:34.5629517Z �[0m�[91m├─────────────────────┼─────────────────────┼──────────────────────┤�[0m�[91m
2021-06-08T14:51:34.5631103Z �[0m�[91m│ �[0m�[91mkubectl �[0m�[91m �[0m�[91m│ �[0m�[91m 1.18.18�[0m�[91m �[0m�[91m│ �[0m�[91m < 1 MiB�[0m�[91m �[0m�[91m│�[0m�[91m
2021-06-08T14:51:34.5632920Z �[0m�[91m│ �[0m�[91mkubectl �[0m�[91m �[0m�[91m│ �[0m�[91m 1.18.18�[0m�[91m �[0m�[91m│ �[0m�[91m 73.4 MiB�[0m�[91m │
2021-06-08T14:51:34.5637944Z └─────────────────────┴─────────────────────┴──────────────────────┘�[0m�[91m
2021-06-08T14:51:34.5638551Z �[0m�[91m
2021-06-08T14:51:34.6451688Z �[0m�[91mFor the latest full release notes, please visit:
2021-06-08T14:51:34.6457306Z https://cloud.google.com/sdk/release_notes
2021-06-08T14:51:34.6458972Z
2021-06-08T14:51:34.6521764Z �[0m�[91mDo you want to continue (Y/n)? �[0m�[91m
2021-06-08T14:51:34.6522499Z ╔════════════════════════════════════════════════════════════╗
2021-06-08T14:51:34.6523223Z ╠═ Creating update staging area ═╣
2021-06-08T14:51:37.3340169Z �[0m�[91m╚�[0m�[91m══════�[0m�[91m══════�[0m�[91m══════�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m╝
2021-06-08T14:51:37.4562018Z �[0m�[91m╔════════════════════════════════════════════════════════════╗
2021-06-08T14:51:37.4588638Z �[0m�[91m╠═ Installing: kubectl ═╣
2021-06-08T14:51:37.5298333Z ╚�[0m�[91m══════════�[0m�[91m═══════════�[0m�[91m═════════�[0m�[91m══════════════════════════════�[0m�[91m╝
2021-06-08T14:51:37.5396815Z �[0m�[91m╔════════════════════════════════════════════════════════════╗
2021-06-08T14:51:37.5397524Z �[0m�[91m╠═ Installing: kubectl ═╣
2021-06-08T14:51:42.7468150Z �[0m�[91m╚�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═�[0m�[91m═════�[0m�[91m═════�[0m�[91m═════�[0m�[91m════�[0m�[91m══════�[0m�[91m═════�[0m�[91m╝
2021-06-08T14:51:42.7647253Z �[0m�[91m╔════════════════════════════════════════════════════════════╗
2021-06-08T14:51:42.7648354Z �[0m�[91m╠═ Creating backup and activating new installation ═╣
2021-06-08T14:51:42.7649407Z ╚�[0m�[91m══════════════════════════════�[0m�[91m══════════════════════════════�[0m�[91m╝
2021-06-08T14:51:42.7688800Z �[0m�[91m
2021-06-08T14:52:01.8061910Z �[0m�[91mPerforming post processing steps...
2021-06-08T14:52:01.8067779Z ...........................................................................done.
2021-06-08T14:52:01.8068465Z
2021-06-08T14:52:01.8069377Z Update done!
2021-06-08T14:52:01.8069699Z
2021-06-08T14:52:16.3408608Z �[0mRemoving intermediate container 64823edb3f19
2021-06-08T14:52:16.3410048Z ---> d8eb9cb629de
2021-06-08T14:52:16.3411080Z Step 4/7 : COPY entrypoint.sh /entrypoint.sh
2021-06-08T14:52:18.2751870Z ---> 97fef045927e
2021-06-08T14:52:18.2753310Z Step 5/7 : RUN chmod +x /entrypoint.sh
2021-06-08T14:52:18.3098454Z ---> Running in 1eaa940d130f
2021-06-08T14:52:20.6120843Z Removing intermediate container 1eaa940d130f
2021-06-08T14:52:20.6121662Z ---> d8c951229a88
2021-06-08T14:52:20.6122319Z Step 6/7 : ENTRYPOINT ["/entrypoint.sh"]
2021-06-08T14:52:20.6531965Z ---> Running in aaa7324b032b
2021-06-08T14:52:22.5134507Z Removing intermediate container aaa7324b032b
2021-06-08T14:52:22.5135874Z ---> f52c4e7280fd
2021-06-08T14:52:22.5136397Z Step 7/7 : CMD ["info"]
2021-06-08T14:52:22.5514736Z ---> Running in e9499f81a305
2021-06-08T14:52:24.4557066Z Removing intermediate container e9499f81a305
2021-06-08T14:52:24.4559294Z ---> f6b28f322473
2021-06-08T14:52:24.4560120Z Successfully built f6b28f322473
2021-06-08T14:52:24.4740487Z Successfully tagged 8a33c1:80a600b1500d495d83dd85e865c7381e
2021-06-08T14:52:24.4777545Z ##[endgroup]
When running lot of workflows, this is a significant amount of time and wasted credits, especially when you don't need Kubernetes.
I guess the solution would be to create a base image with already this component installed, rather than installing it over and over at each build.
Cheers 😄
The newest version of this action seems to fail after commit c93f62d .
manifest for google/cloud-sdk:285.0.0-alpine not found: manifest unknown: manifest unknown
Dear maintainer,
You might already be aware of this, but I'm reporting it just in case. We use gcloud@master in our GitHub Actions, and the latest release seems to have broken some of our builds 😅
The cause seems to be that google/cloud-sdk
does not have a tag help-alpine
(at least, not visible in the tag list on Docker Hub), which seems to be making your own CI fail as well:
Dockerfile for action: '/home/runner/work/gcloud/gcloud/./Dockerfile'.
/usr/bin/docker build -t 5588e4:65f5068b272d5bc3bbd5d4621223c059 -f "/home/runner/work/gcloud/gcloud/./Dockerfile" "/home/runner/work/gcloud/gcloud"
manifest for google/cloud-sdk:help-alpine not found: manifest unknown: manifest unknown
Sending build context to Docker daemon 95.23kB
Step 1/6 : FROM google/cloud-sdk:help-alpine
The above is from your latest Actions build in master: https://github.com/actions-hub/gcloud/actions/runs/637630888
We are seeing a failure that looks very similar, and it happens prior to our build actually starting:
When I try to run airflow command in Composer environment, like this one
- name: Import Variable
uses: actions-hub/gcloud@master
with:
args: composer environments run my-env --location=europe-west1 variables -- import /home/airflow/gcs/data/vars.json
I got this error:
WARNING: Accessing a Kubernetes Engine cluster requires the kubernetes commandline
client [kubectl]. To install, run
$ gcloud components install kubectl
kubeconfig entry generated for europe-west1-d6-dwh-dev-d1ca4d08-gke.
ERROR: (gcloud.composer.environments.run) Accessing a Cloud Composer environment requires the kubernetes commandline
client [kubectl]. To install, run
$ gcloud components install kubectl
So is it possible to include this component gcloud components install kubectl
?
Hi @exelban,
I just discovered your Action and encountered the following error when trying it out for the first time:
ERROR: (gcloud.app.deploy) [/github/workspace/app.yaml] does not exist.
As you can see in my workflow file, I'm using your Action in order to deploy my application to Google App Engine.
Here's the log of the job which failed: click
Unfortunately, I don't really have an idea what all the docker stuff means, but if I would need to guess, it might have something to do with the files from the repository not being synced to the docker container correctly.
Do you have any idea what the issue might be?
I'm wondering whether this is a bug in your Action or just me failing to use it correctly.
Thank you in advance and best regards,
@jr-cologne
I am getting an error if using windows containers in place of ubuntu.
So please assist me in how can I use gsutil for windows containers.
Getting this error on jobs beginning today. I ran some jobs yesterday so it's interesting that this wasn't picked up then- not sure if it's on GitHub's end or not.
Here's the full logs from the "Set up Job" task:
Current runner version: '2.278.0'
Operating System
Virtual Environment
GITHUB_TOKEN Permissions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@master'
Download action repository 'actions-hub/gcloud@master'
Error: 'ghcr.io/actions-hub/actions-hub-gcloud:343.0.0' should be either '[path]/Dockerfile' or 'docker://image[:tag]'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.