deploy-cloud-functions
                                
                                 deploy-cloud-functions copied to clipboard
                                
                                    deploy-cloud-functions copied to clipboard
                            
                            
                            
                        Properly set allTrafficOnLatestRevision on Patch
TL;DR
Setting all_traffic_on_latest_revision to false does not reflect update in remote revision.
Expected behavior
In order to test tagged revisions I had a pre-existing revision serving 100% of traffic. After pushing changes to my branch that uses all_traffic_on_latest_revision: false I expected that the latest revision would not serve any traffic. Instead, I noticed all traffic got switched to the latest revision.
Observed behavior
Despite the option being sent as a boolean false in the patch, it seems as if it's ignored or skipped over.
Action YAML
    - id: 'deploy'
      uses: 'google-github-actions/deploy-cloud-functions@v3'
      timeout-minutes: 10
      with:
        name: '...'
        runtime: 'python312'
        source_dir: 'src'
        entry_point: 'chat'
        build_service_account: '...'
        service_account: '...'
        all_traffic_on_latest_revision: false
        environment_variables: |-
          ...
        secrets: |-
          ...
Log output
##[debug]Evaluating condition for step: 'Run google-github-actions/deploy-cloud-functions@v3'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run google-github-actions/deploy-cloud-functions@v3
##[debug]Loading inputs
##[debug]Evaluating: env.ALL_TRAFFIC_ON_LATEST_REVISION
##[debug]Evaluating Index:
##[debug]..Evaluating env:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'ALL_TRAFFIC_ON_LATEST_REVISION'
##[debug]=> 'false'
##[debug]Result: 'false'
##[debug]Evaluating: format('STICKY_USERS_ENABLED={0}
##[debug]SERVICE_SUFFIX_URL={1}
##[debug]AUDIENCE=...', env.STICKY_USERS_ENABLED, env.SERVICE_SUFFIX_URL)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> 'STICKY_USERS_ENABLED={0}
##[debug]SERVICE_SUFFIX_URL={1}
##[debug]AUDIENCE=...'
##[debug]..Evaluating Index:
##[debug]....Evaluating env:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'STICKY_USERS_ENABLED'
##[debug]..=> 'false'
##[debug]..Evaluating Index:
##[debug]....Evaluating env:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'SERVICE_SUFFIX_URL'
##[debug]..=> 'unknown'
##[debug]=> 'STICKY_USERS_ENABLED=false
##[debug]SERVICE_SUFFIX_URL=unknown
##[debug]AUDIENCE=...'
##[debug]Result: 'STICKY_USERS_ENABLED=false
##[debug]SERVICE_SUFFIX_URL=unknown
##[debug]AUDIENCE=...'
...
Created zip file from 'src' at '/tmp/cfsrc-c568793c50506209b0613f22.zip'
Updating existing Cloud Functions deployment
##[debug]patch: computed Cloud Function:
##[debug]{
##[debug]  "name": "...",
##[debug]  "environment": "GEN_2",
##[debug]  "buildConfig": {
##[debug]    "runtime": "python312",
##[debug]    "entryPoint": "chat",
##[debug]    "serviceAccount": "...",
##[debug]    "source": {
##[debug]      "storageSource": {
##[debug]        "bucket": "...",
##[debug]        "object": "..."
##[debug]      }
##[debug]    }
##[debug]  },
##[debug]  "serviceConfig": {
##[debug]    "allTrafficOnLatestRevision": false,
##[debug]    "availableMemory": "256Mi",
##[debug]    "environmentVariables": {
##[debug]      ...
##[debug]    },
##[debug]    "ingressSettings": "ALLOW_ALL",
##[debug]    "secretEnvironmentVariables": [
##[debug]      ...
##[debug]    ],
##[debug]    "secretVolumes": [],
##[debug]    "serviceAccountEmail": "...",
##[debug]    "timeoutSeconds": 60
##[debug]  }
##[debug]}
##[debug]Computed updateMask: name,environment,buildConfig.runtime,buildConfig.entryPoint,buildConfig.source,buildConfig.serviceAccount,serviceConfig.allTrafficOnLatestRevision,serviceConfig.availableMemory,serviceConfig.environmentVariables,serviceConfig.ingressSettings,serviceConfig.secretEnvironmentVariables,serviceConfig.secretVolumes,serviceConfig.serviceAccountEmail,serviceConfig.timeoutSeconds
Additional information
Did a bit more testing:
If the revision serving 100% of traffic is the most recent one deployed and I deploy a new one with all_traffic_on_latest_revision: false it still sets 100% of traffic to the new one. If the instance serving 100% of traffic is not the most recent one it honors the setting and does not shift any traffic into the recently deployed all_traffic_on_latest_revision: false