I get an error: google-github-actions/upload-cloud-storage failed with: invalid header key "Cache-Control" - custom header keys must be prefixed with "x-goog-meta-"
Expected behavior
I expected my files to be uploaded with the Cache-Control header set.
(I think that for this header I shouldn't need x-goog-meta, since it is not a "custom header". The documentation also seems to indicate that Cache-Control is supposed to be supported, without the addition of x-goog-meta.)
Observed behavior
The action failed, with the error message google-github-actions/upload-cloud-storage failed with: invalid header key "Cache-Control" - custom header keys must be prefixed with "x-goog-meta-"
The error occurs only with recent versions of upload-cloud-storage. If I use upload-cloud-storage@v0.5, then the header is set correctly and no error is raised.
Action YAML
name: compile and deploy test paper
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
# Check out the repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v3
- name: Authenticate to Google
uses: 'google-github-actions/auth@v0'
with:
# provider created using the info at https://github.com/google-github-actions/auth#setup
workload_identity_provider: 'XXX'
# service account also created using info at https://github.com/google-github-actions/auth#setup
# to give this service account access to a repo, can use CLI as follows:
# gcloud auth login
# export PROJECT_ID="XXX"
# export WORKLOAD_IDENTITY_POOL_ID="XXX"
# export REPO="neitzke/actions-test"
# gcloud iam service-accounts add-iam-policy-binding "my-service-account@${PROJECT_ID}.iam.gserviceaccount.com" --project="${PROJECT_ID}" --role="roles/iam.workloadIdentityUser" --member="principalSet://iam.googleapis.com/${WORKLOAD_IDENTITY_POOL_ID}/attribute.repository/${REPO}"
service_account: 'XXX'
- name: Upload all .tex files to Google Cloud bucket XXX
uses: 'google-github-actions/upload-cloud-storage@v1.0.2'
with:
path: '.'
glob: '*.tex'
destination: 'XXX'
# headers: expire object after 2 minutes, to avoid serving stale files
headers: |-
Cache-Control:public, max-age=120
Log output
2023-04-16T13:29:40.4881982Z Requested labels: ubuntu-latest
2023-04-16T13:29:40.4882289Z Job defined at: neitzke/actions-test/.github/workflows/latex.yml@refs/heads/master
2023-04-16T13:29:40.4882395Z Waiting for a runner to pick up this job...
2023-04-16T13:29:40.7209931Z Job is waiting for a hosted runner to come online.
2023-04-16T13:29:42.9986226Z Job is about to start running on the hosted runner: GitHub Actions 2 (hosted)
2023-04-16T13:29:45.5824875Z Current runner version: '2.303.0'
2023-04-16T13:29:45.5857598Z ##[group]Operating System
2023-04-16T13:29:45.5858320Z Ubuntu
2023-04-16T13:29:45.5858627Z 22.04.2
2023-04-16T13:29:45.5858970Z LTS
2023-04-16T13:29:45.5859453Z ##[endgroup]
2023-04-16T13:29:45.5859812Z ##[group]Runner Image
2023-04-16T13:29:45.5860246Z Image: ubuntu-22.04
2023-04-16T13:29:45.5860657Z Version: 20230409.1
2023-04-16T13:29:45.5861348Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20230409.1/images/linux/Ubuntu2204-Readme.md
2023-04-16T13:29:45.5862117Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230409.1
2023-04-16T13:29:45.5862691Z ##[endgroup]
2023-04-16T13:29:45.5863125Z ##[group]Runner Image Provisioner
2023-04-16T13:29:45.5863492Z 2.0.139.1
2023-04-16T13:29:45.5863901Z ##[endgroup]
2023-04-16T13:29:45.5864687Z ##[group]GITHUB_TOKEN Permissions
2023-04-16T13:29:45.5865359Z Contents: read
2023-04-16T13:29:45.5865788Z Metadata: read
2023-04-16T13:29:45.5866473Z ##[endgroup]
2023-04-16T13:29:45.5871131Z Secret source: Actions
2023-04-16T13:29:45.5871727Z Prepare workflow directory
2023-04-16T13:29:45.6749689Z Prepare all required actions
2023-04-16T13:29:45.6973908Z Getting action download info
2023-04-16T13:29:45.9469899Z Download action repository 'actions/checkout@v3' (SHA:8e5e7e5ab8b370d6c329ec480221332ada57f0ab)
2023-04-16T13:29:46.2925046Z Download action repository 'google-github-actions/auth@v0' (SHA:c4799db9111fba4461e9f9da8732e5057b394f72)
2023-04-16T13:29:46.4506108Z Download action repository 'google-github-actions/upload-cloud-storage@v1.0.2' (SHA:cdef1ca4b97d61c7312ca2e742b7b6421862c71a)
2023-04-16T13:29:46.8680551Z Complete job name: build
2023-04-16T13:29:46.9782253Z ##[group]Run actions/checkout@v3
2023-04-16T13:29:46.9782679Z with:
2023-04-16T13:29:46.9782995Z repository: neitzke/actions-test
2023-04-16T13:29:46.9783727Z token: ***
2023-04-16T13:29:46.9784025Z ssh-strict: true
2023-04-16T13:29:46.9784360Z persist-credentials: true
2023-04-16T13:29:46.9784702Z clean: true
2023-04-16T13:29:46.9784995Z fetch-depth: 1
2023-04-16T13:29:46.9785274Z lfs: false
2023-04-16T13:29:46.9785540Z submodules: false
2023-04-16T13:29:46.9785864Z set-safe-directory: true
2023-04-16T13:29:46.9786183Z ##[endgroup]
2023-04-16T13:29:47.2913132Z Syncing repository: neitzke/actions-test
2023-04-16T13:29:47.2915399Z ##[group]Getting Git version info
2023-04-16T13:29:47.2916142Z Working directory is '/home/runner/work/actions-test/actions-test'
2023-04-16T13:29:47.2916950Z [command]/usr/bin/git version
2023-04-16T13:29:47.3001801Z git version 2.40.0
2023-04-16T13:29:47.3040165Z ##[endgroup]
2023-04-16T13:29:47.3066372Z Temporarily overriding HOME='/home/runner/work/_temp/1d6f36fb-e244-4830-a949-ac5679124dd6' before making global git config changes
2023-04-16T13:29:47.3067115Z Adding repository directory to the temporary git global config as a safe directory
2023-04-16T13:29:47.3067875Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/actions-test/actions-test
2023-04-16T13:29:47.3124199Z Deleting the contents of '/home/runner/work/actions-test/actions-test'
2023-04-16T13:29:47.3130812Z ##[group]Initializing the repository
2023-04-16T13:29:47.3135342Z [command]/usr/bin/git init /home/runner/work/actions-test/actions-test
2023-04-16T13:29:47.3231517Z hint: Using 'master' as the name for the initial branch. This default branch name
2023-04-16T13:29:47.3233425Z hint: is subject to change. To configure the initial branch name to use in all
2023-04-16T13:29:47.3234301Z hint: of your new repositories, which will suppress this warning, call:
2023-04-16T13:29:47.3235011Z hint:
2023-04-16T13:29:47.3236673Z hint: git config --global init.defaultBranch <name>
2023-04-16T13:29:47.3237197Z hint:
2023-04-16T13:29:47.3269327Z hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
2023-04-16T13:29:47.3270382Z hint: 'development'. The just-created branch can be renamed via this command:
2023-04-16T13:29:47.3271403Z hint:
2023-04-16T13:29:47.3272432Z hint: git branch -m <name>
2023-04-16T13:29:47.3273246Z Initialized empty Git repository in /home/runner/work/actions-test/actions-test/.git/
2023-04-16T13:29:47.3274871Z [command]/usr/bin/git remote add origin https://github.com/neitzke/actions-test
2023-04-16T13:29:47.3325543Z ##[endgroup]
2023-04-16T13:29:47.3328710Z ##[group]Disabling automatic garbage collection
2023-04-16T13:29:47.3329478Z [command]/usr/bin/git config --local gc.auto 0
2023-04-16T13:29:47.3369953Z ##[endgroup]
2023-04-16T13:29:47.3372084Z ##[group]Setting up auth
2023-04-16T13:29:47.3375610Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2023-04-16T13:29:47.3417238Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2023-04-16T13:29:47.3893314Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2023-04-16T13:29:47.3932809Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2023-04-16T13:29:47.4203568Z [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
2023-04-16T13:29:47.4259123Z ##[endgroup]
2023-04-16T13:29:47.4260098Z ##[group]Fetching the repository
2023-04-16T13:29:47.4278421Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +f7fc5d53fff6b6d9c3165441f8db7f35dc4420fd:refs/remotes/origin/master
2023-04-16T13:29:47.8016814Z remote: Enumerating objects: 16, done.
2023-04-16T13:29:47.8017905Z remote: Counting objects: 6% (1/16)
2023-04-16T13:29:47.8019284Z remote: Counting objects: 12% (2/16)
2023-04-16T13:29:47.8021861Z remote: Counting objects: 18% (3/16)
2023-04-16T13:29:47.8023483Z remote: Counting objects: 25% (4/16)
2023-04-16T13:29:47.8024826Z remote: Counting objects: 31% (5/16)
2023-04-16T13:29:47.8026140Z remote: Counting objects: 37% (6/16)
2023-04-16T13:29:47.8027355Z remote: Counting objects: 43% (7/16)
2023-04-16T13:29:47.8028455Z remote: Counting objects: 50% (8/16)
2023-04-16T13:29:47.8029413Z remote: Counting objects: 56% (9/16)
2023-04-16T13:29:47.8031396Z remote: Counting objects: 62% (10/16)
2023-04-16T13:29:47.8032370Z remote: Counting objects: 68% (11/16)
2023-04-16T13:29:47.8033536Z remote: Counting objects: 75% (12/16)
2023-04-16T13:29:47.8035214Z remote: Counting objects: 81% (13/16)
2023-04-16T13:29:47.8036071Z remote: Counting objects: 87% (14/16)
2023-04-16T13:29:47.8036789Z remote: Counting objects: 93% (15/16)
2023-04-16T13:29:47.8037645Z remote: Counting objects: 100% (16/16)
2023-04-16T13:29:47.8037970Z remote: Counting objects: 100% (16/16), done.
2023-04-16T13:29:47.8042057Z remote: Compressing objects: 8% (1/12)
2023-04-16T13:29:47.8042847Z remote: Compressing objects: 16% (2/12)
2023-04-16T13:29:47.8043570Z remote: Compressing objects: 25% (3/12)
2023-04-16T13:29:47.8046697Z remote: Compressing objects: 33% (4/12)
2023-04-16T13:29:47.8048214Z remote: Compressing objects: 41% (5/12)
2023-04-16T13:29:47.8049090Z remote: Compressing objects: 50% (6/12)
2023-04-16T13:29:47.8049567Z remote: Compressing objects: 58% (7/12)
2023-04-16T13:29:47.8050301Z remote: Compressing objects: 66% (8/12)
2023-04-16T13:29:47.8052742Z remote: Compressing objects: 75% (9/12)
2023-04-16T13:29:47.8053589Z remote: Compressing objects: 83% (10/12)
2023-04-16T13:29:47.8070941Z remote: Compressing objects: 91% (11/12)
2023-04-16T13:29:47.8071875Z remote: Compressing objects: 100% (12/12)
2023-04-16T13:29:47.8072390Z remote: Compressing objects: 100% (12/12), done.
2023-04-16T13:29:47.8074497Z remote: Total 16 (delta 3), reused 9 (delta 2), pack-reused 0
2023-04-16T13:29:47.8217434Z From https://github.com/neitzke/actions-test
2023-04-16T13:29:47.8218693Z * [new ref] f7fc5d53fff6b6d9c3165441f8db7f35dc4420fd -> origin/master
2023-04-16T13:29:47.8251668Z ##[endgroup]
2023-04-16T13:29:47.8254829Z ##[group]Determining the checkout info
2023-04-16T13:29:47.8306530Z ##[endgroup]
2023-04-16T13:29:47.8307050Z ##[group]Checking out the ref
2023-04-16T13:29:47.8307801Z [command]/usr/bin/git checkout --progress --force -B master refs/remotes/origin/master
2023-04-16T13:29:47.8333462Z Reset branch 'master'
2023-04-16T13:29:47.8335015Z branch 'master' set up to track 'origin/master'.
2023-04-16T13:29:47.8344626Z ##[endgroup]
2023-04-16T13:29:47.8392528Z [command]/usr/bin/git log -1 --format='%H'
2023-04-16T13:29:47.8427947Z 'f7fc5d53fff6b6d9c3165441f8db7f35dc4420fd'
2023-04-16T13:29:47.8843705Z ##[group]Run google-github-actions/auth@v0
2023-04-16T13:29:47.8844079Z with:
2023-04-16T13:29:47.8844510Z workload_identity_provider: XXX
2023-04-16T13:29:47.8845077Z service_account: XXX
2023-04-16T13:29:47.8845504Z create_credentials_file: true
2023-04-16T13:29:47.8845818Z export_environment_variables: true
2023-04-16T13:29:47.8846120Z cleanup_credentials: true
2023-04-16T13:29:47.8846398Z access_token_lifetime: 3600s
2023-04-16T13:29:47.8846792Z access_token_scopes: https://www.googleapis.com/auth/cloud-platform
2023-04-16T13:29:47.8847146Z retries: 0
2023-04-16T13:29:47.8847395Z id_token_include_email: false
2023-04-16T13:29:47.8847665Z ##[endgroup]
2023-04-16T13:29:48.0608155Z Created credentials file at "/home/runner/work/actions-test/actions-test/gha-creds-aee3acdada8b4e4a.json"
2023-04-16T13:29:48.0741009Z ##[group]Run google-github-actions/upload-cloud-storage@v1.0.2
2023-04-16T13:29:48.0741413Z with:
2023-04-16T13:29:48.0741678Z path: .
2023-04-16T13:29:48.0741910Z glob: *.tex
2023-04-16T13:29:48.0742222Z destination: XXX
2023-04-16T13:29:48.0742604Z headers: Cache-Control:public, max-age=120
2023-04-16T13:29:48.0742904Z gzip: true
2023-04-16T13:29:48.0743137Z resumable: true
2023-04-16T13:29:48.0743386Z parent: true
2023-04-16T13:29:48.0743635Z concurrency: 100
2023-04-16T13:29:48.0743906Z process_gcloudignore: true
2023-04-16T13:29:48.0744167Z env:
2023-04-16T13:29:48.0744599Z CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: /home/runner/work/actions-test/actions-test/gha-creds-aee3acdada8b4e4a.json
2023-04-16T13:29:48.0745204Z GOOGLE_APPLICATION_CREDENTIALS: /home/runner/work/actions-test/actions-test/gha-creds-aee3acdada8b4e4a.json
2023-04-16T13:29:48.0745836Z GOOGLE_GHA_CREDS_PATH: /home/runner/work/actions-test/actions-test/gha-creds-aee3acdada8b4e4a.json
2023-04-16T13:29:48.0746275Z CLOUDSDK_CORE_PROJECT: XXX
2023-04-16T13:29:48.0746634Z CLOUDSDK_PROJECT: XXX
2023-04-16T13:29:48.0746969Z GCLOUD_PROJECT: XXX
2023-04-16T13:29:48.0747299Z GCP_PROJECT: XXX
2023-04-16T13:29:48.0747622Z GOOGLE_CLOUD_PROJECT: XXX
2023-04-16T13:29:48.0747917Z ##[endgroup]
2023-04-16T13:29:48.2711285Z ##[error]google-github-actions/upload-cloud-storage failed with: invalid header key "Cache-Control" - custom header keys must be prefixed with "x-goog-meta-"
2023-04-16T13:29:48.2831344Z Post job cleanup.
2023-04-16T13:29:48.3729750Z Removed exported credentials at "/home/runner/work/actions-test/actions-test/gha-creds-aee3acdada8b4e4a.json".
2023-04-16T13:29:48.3856919Z Post job cleanup.
2023-04-16T13:29:48.5243984Z [command]/usr/bin/git version
2023-04-16T13:29:48.5335668Z git version 2.40.0
2023-04-16T13:29:48.5424245Z Temporarily overriding HOME='/home/runner/work/_temp/c4a21aeb-db54-4528-8f56-f396fb74f05b' before making global git config changes
2023-04-16T13:29:48.5425712Z Adding repository directory to the temporary git global config as a safe directory
2023-04-16T13:29:48.5433467Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/actions-test/actions-test
2023-04-16T13:29:48.5489251Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2023-04-16T13:29:48.5539133Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2023-04-16T13:29:48.5852771Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2023-04-16T13:29:48.5893977Z http.https://github.com/.extraheader
2023-04-16T13:29:48.5908841Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2023-04-16T13:29:48.5958594Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2023-04-16T13:29:48.6481920Z Cleaning up orphan processes
Oops, now I realize this was recently addressed in a doc update, #312 -- indeed changing from Cache-Control to cache-control fixes the problem. Sorry for the noise.
TL;DR
If I set
I get an error:
google-github-actions/upload-cloud-storage failed with: invalid header key "Cache-Control" - custom header keys must be prefixed with "x-goog-meta-"
Expected behavior
I expected my files to be uploaded with the Cache-Control header set.
(I think that for this header I shouldn't need x-goog-meta, since it is not a "custom header". The documentation also seems to indicate that Cache-Control is supposed to be supported, without the addition of x-goog-meta.)
Observed behavior
The action failed, with the error message
google-github-actions/upload-cloud-storage failed with: invalid header key "Cache-Control" - custom header keys must be prefixed with "x-goog-meta-"
The error occurs only with recent versions of
upload-cloud-storage
. If I useupload-cloud-storage@v0.5
, then the header is set correctly and no error is raised.Action YAML
Log output
Additional information
No response