Skip to content

Instantly share code, notes, and snippets.

@KengoTODA
Created September 23, 2022 06:37
Show Gist options
  • Save KengoTODA/dd7af19a51e4ea1a15b3ae5e8b23a610 to your computer and use it in GitHub Desktop.
Save KengoTODA/dd7af19a51e4ea1a15b3ae5e8b23a610 to your computer and use it in GitHub Desktop.
OIDCでGCSにファイルをアップロードするサンプル
# .circleci/config.yml
orbs:
jq: circleci/jq@2.2.0
jobs:
upload_coverage_report:
docker:
- image: google/cloud-sdk
steps:
- attach_workspace:
at: /tmp/workspace
- jq/install
- run:
name: Google Authentication
command: |
echo $CIRCLE_OIDC_TOKEN > oidc_token_file.txt
gcloud iam workload-identity-pools create-cred-config \
"projects/<< GCP project number >>/locations/global/workloadIdentityPools/circleci/providers/circleci" \
--output-file="gcp_cred_config_file.txt" \
--service-account="<< email of service account >>" \
--credential-source-file="oidc_token_file.txt"
gcloud auth login --brief --cred-file "gcp_cred_config_file.txt"
- run: gsutil -m rsync -j html,js,css -r /tmp/workspace/jacoco/testCodeCoverageReport/html gs://path/to/target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment