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

When using unchanged metadata.yaml no deployment is triggered

Open cnpatric opened this issue 11 months ago • 1 comments

TL;DR

We use the :latest tag in our metadata.yaml, when creating a new image and pushing it to gcr and retrigger a deployment with

  • name: Deploy to Cloud Run id: deploy uses: google-github-actions/deploy-cloudrun@v2 with: region: europe-west1 metadata: ${{ inputs.cloud_run_service_metadata }}

It seems to just skip the deployment process completely instead of force deploying. This causes no new revision to be created and cloud run using the old cached image

Expected behavior

Deployment should be triggered and new revision should be created independently if data changed or not

Observed behavior

Deployment reports success but no new revision is created

Action YAML

name: deploy
on:
  workflow_call:
    inputs:
      ref:
        description: 'The git ref to deploy'
        type: string
        required: true
      environment:
        description: 'The deployment environment (e.g. development, production)'
        type: string
        required: true
      cloud_run_service_name:
        description: 'The name of the service in cloud run'
        type: string
        required: true
      cloud_run_service_metadata:
        description: 'The metadata of the service in cloud run'
        type: string
        required: false
      project_id:
        description: 'The Google Cloud project ID'
        type: string
        required: true

    secrets:
      deploy_key:
        description: 'The Google service account key used for deployment'
        required: true
      slack_webhook_url:
        description: 'The slack incoming webhook URL'
        required: true


jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
        with:
          persist-credentials: false
          ref: ${{ inputs.ref }}

      - name: Setup Node
        uses: actions/setup-node@master
        with:
          node-version: 18
          cache: npm
          cache-dependency-path: ./package-lock.json

      - name: Install
        run: npm ci

      - name: Build
        run: npm run build

      - name: Authenticate to Google Cloud
        uses: google-github-actions/auth@v1
        with:
          credentials_json: ${{ secrets.deploy_key }}

      - name: Push to GCR GitHub Action
        uses: RafikFarhad/push-to-gcr-github-action@v5-rc1
        with:
          registry: gcr.io
          project_id: ${{ inputs.project_id }}
          image_name: ${{ inputs.cloud_run_service_name }}
          image_tag: latest
          dockerfile: ./Dockerfile-${{ inputs.environment }}
          context: .


      - name: Deploy to Cloud Run
        id: deploy
        uses: google-github-actions/deploy-cloudrun@v2
        with:
          region: europe-west1
          metadata: ${{ inputs.cloud_run_service_metadata }}

      - name: Show Output
        run: echo ${{ steps.deploy.outputs.url }}

  slack_notification:
    uses: ./.github/workflows/slack_notification.yml
    if: ${{ always() }}
    needs: [ deploy ]
    with:
      service_name: ${{ inputs.cloud_run_service_name }}
      environment: ${{ inputs.environment }}
      job_status: ${{ needs.deploy.result }}
      run_id: ${{ github.run_id }}
      actor: ${{ github.actor }}
    secrets:
      slack_webhook_url: ${{ secrets.slack_webhook_url }}

Log output

Run google-github-actions/deploy-cloudrun@v2
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/5303231e-ed70-44d3-a65d-0f3b2267b53e -f /home/runner/work/_temp/4b3ba27b-4398-4760-88df-8a0a4dfbbfd0
Successfully authenticated
Running: gcloud run services replace ./cloud-run-metadata-development.yml --platform managed --format json --region europe-west1

Additional information

No response

cnpatric avatar Mar 05 '24 10:03 cnpatric

How does gcloud run services replace behave?

sethvargo avatar Mar 05 '24 15:03 sethvargo

Closing due to lack of response. If this is still happening, please open a new issue. Thanks!

sethvargo avatar Mar 28 '24 14:03 sethvargo