deploy-cloudrun icon indicating copy to clipboard operation
deploy-cloudrun copied to clipboard

Allow overwriting image name from the commandline with metadata

Open lgeiger opened this issue 4 years ago • 0 comments

TL;DR

When working with metadata customizations it is required to set the image name in the YAML file. This can cause problems since it is not easily possible to uniquely tag the image with the git commit hash as recommended in the docs.

It would be great if the image name could be overwritten via the command line even if a metadata YAML file is used

Design

It would be great if in the following action the image name of the yaml file would be overwritten instead of silently ignored which can cause quite some frustration since only a hard to miss warning is printed in the logs.

Action YAML

- name: Deploy to Cloud Run
  uses: google-github-actions/deploy-cloudrun@main
  with:
    image: gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{  github.sha }}
    metadata: ./service.yaml

My current ugly workaround for this is:

- name: Set Image Name
  run: sed -i 's!REPLACE_IMAGE_NAME!gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{  github.sha }}!g' service.yaml

- name: Deploy to Cloud Run
  uses: google-github-actions/deploy-cloudrun@main
  with:
    metadata: ./service.yaml

lgeiger avatar Jul 21 '21 13:07 lgeiger