google-github-actions / create-cloud-deploy-release Goto Github PK
View Code? Open in Web Editor NEWA GitHub Action for creating releases via Cloud Deploy.
Home Page: https://cloud.google.com/deploy
License: Apache License 2.0
A GitHub Action for creating releases via Cloud Deploy.
Home Page: https://cloud.google.com/deploy
License: Apache License 2.0
--deploy_parameters
option is present when no deploy parameters are set. The gcloud
fails because there is no argument provided to it
When no deploy parameters are provided, there should be no --deploy_parameters
in the output command
When no deploy parameters are provided, --deploy_parameters
is present in the output command but without an argument passed to it. This causes the gcloud
to fail.
The cause is https://github.com/google-github-actions/actions-utils/blob/9c1562ded0e506d4d957f6e3a56fb1dbfa6cb59b/src/kv.ts#L89 which returns an empty object if there are no arguments provided which evaluates truthy here
create-cloud-deploy-release/src/main.ts
Line 93 in fd4cd11
name: Build app and create a release in Cloud Deploy
on:
push:
branches:
- $default_branch
env:
PROJECT_ID: nifty-might-418012
GAR_LOCATION: europe-west2
REGION: europe-west2
APP: app
jobs:
deploy:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'
- name: 'Google auth'
id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}' # Replace with the name of your GitHub Actions secret
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
with:
project_id: '${{ env.PROJECT_ID }}'
- name: 'Docker auth'
run: |-
gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev
- name: 'Build and push container'
run: |-
docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.APP }}/${{ env.APP }}:${{ github.sha }}" .
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.APP }}/${{ env.APP }}:${{ github.sha }}"
- name: 'Render templatised config manifests'
run: |-
export PROJECT_ID="${{ env.PROJECT_ID }}"
export REGION="${{ env.REGION }}"
for template in $(ls config/*.template.yaml); do envsubst < ${template} > ${template%%.*}.yaml ; done
- name: 'Create Cloud Deploy delivery pipeline'
run: |-
gcloud deploy apply --file config/clouddeploy.yaml --region ${{ env.GAR_LOCATION }}
- name: 'Create release name'
run: |-
echo "RELEASE_NAME=${{ env.APP }}-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}" >> ${GITHUB_ENV}
- name: 'Create Cloud Deploy release'
id: 'release'
uses: 'google-github-actions/create-cloud-deploy-release@v0'
with:
delivery_pipeline: '${{ env.APP }}'
name: '${{ env.RELEASE_NAME }}'
region: '${{ env.REGION }}'
description: '${{ env.GITHUB_COMMIT_MSG }}'
skaffold_file: 'config/skaffold.yaml'
images: 'app=${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.APP }}/${{ env.APP }}:${{ github.sha }}'
- name: 'Report Cloud Deploy release'
run: |-
echo "Created release ${{ steps.release.outputs.name }} "
echo "Release link ${{ steps.release.outputs.link }} "
Error: create-cloud-deploy-release failed with: failed to execute gcloud command `gcloud deploy releases create medi-quiz-92cb7cd-18 --delivery-pipeline medi-quiz --region europe-west2 --images app=europe-west2-docker.pkg.dev/nifty-might-418012/medi-quiz/medi-quiz:92cb7cd0342c1a956538d1b799eb8bc1009be6a2 --skaffold-file config/skaffold.yaml --deploy-parameters --annotations commit=https://github.com/lukebarge/medi-quiz/commit/92cb7cd0342c1a956538d1b799eb8bc1009be6a2,git-sha=92cb7cd0342c1a956538d1b799eb8bc1009be6a2 --labels managed-by=github-actions --format json`: Creating temporary tarball archive of 45 file(s) totalling 539.6 KiB before compression.
No response
When creating a new Cloud Deploy release with this GH action and setting some flags
input, the action fails and results in an unrecognized argument error instead of using the specified flag.
A successful Cloud Deploy release was created using the skaffold_preview
version that was specified through the --skaffold-version
flag.
The GH action fails to create a Cloud Deploy release because it results in an unrecognized argument error.
name: Create a release in Cloud Deploy
on:
push:
branches:
- main
env:
PIPELINE: deploy-test
REGION: us-east4
jobs:
deploy-test:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/[email protected]
- name: 'Google auth'
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'
- name: 'Create release name'
run: |-
echo "RELEASE_NAME=release-${GITHUB_SHA::7}" >> ${GITHUB_ENV}
- name: 'Create Cloud Deploy release'
id: 'release'
uses: 'google-github-actions/[email protected]'
with:
delivery_pipeline: ${{ env.PIPELINE }}
name: ${{ env.RELEASE_NAME }}
region: ${{ env.REGION }}
description: Test-Deployment
skaffold_file: 'config/skaffold.yaml'
flags: '--skaffold-version=skaffold_preview'
- name: 'Report Cloud Deploy release'
run: |-
echo "Created release ${{ steps.release.outputs.name }} "
echo "Release link ${{ steps.release.outputs.link }} "
Run google-github-actions/[email protected]
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/10d2e040 -f /home/runner/work/_temp/0dbbe185
Successfully authenticated
Running: gcloud deploy releases create Release-18ff0ee --delivery-pipeline deploy-test --region us-east4 --skaffold-file config/skaffold.yaml --annotations commit=https://github.com/org/repo/commit/18ff0ee18ff0ee18ff0ee18ff0ee18ff0ee18ff0ee,git-sha= ecdeca633a230bfade4cc8195ae23af030922319 --labels managed-by=github-actions --flags --skaffold-version skaffold_preview --format json
Error: create-cloud-deploy-release failed with: failed to execute gcloud command `gcloud deploy releases create Release-18ff0ee --delivery-pipeline deploy-test --region us-east4 --skaffold-file config/skaffold.yaml --annotations commit=https://github.com/org/repo/commit/18ff0ee18ff0ee18ff0ee18ff0ee18ff0ee18ff0ee,git-sha= ecdeca633a230bfade4cc8195ae23af030922319 --labels managed-by=github-actions --flags --skaffold-version skaffold_preview --format json`: ERROR: (gcloud.deploy.releases.create) unrecognized arguments:
--flags (did you mean '--flags-file'?)
To search the help text of gcloud commands, run:
gcloud help -- SEARCH_TERMS
This might be happening here: https://github.com/google-github-actions/create-cloud-deploy-release/blob/main/src/main.ts#L156-L157
where the --flags
string is getting pushed into the gcloud command before appending the actual flags that have been passed in. It also seems like the flags might be getting parsed weirdly, since the input was originally --skaffold-version=skaffold_preview
but the final command that was executed contains --skaffold-version skaffold_preview
, which changed the =
to a space.
Per the documentation, it seemed that I can omit a skaffold.yml
if providing images
, however am seeing the following (and have confirmed the value for images
is being properly passed to the CLI call):
ERROR: (gcloud.deploy.releases.create) Could not find skaffold file. File [./skaffold.yaml] does not exist
gcloud deploy releases create --help
insinuates images
should be enough?
No response
with:
delivery_pipeline: ...
name: ...
region: ...
description: ...
images: ...
No response
No response
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.