Skip to content

Error: failed with error code [object Object] #241

@sirdarckcat

Description

@sirdarckcat

TL;DR

Action fails intermittently with obscure error (Error: google-github-actions/upload-cloud-storage failed with error code [object Object]), recently more often than before.

Expected behavior

It shouldn't fail

Observed behavior

Upload just fails with Error: google-github-actions/upload-cloud-storage failed with error code [object Object]

Action YAML

name: Sync

on:
  schedule:
    - cron: '17/30 * * * *'
  workflow_dispatch:

jobs:
  sync:
    runs-on: ubuntu-latest

    permissions:
      contents: 'write'
      id-token: 'write'

    env:
      BUCKET_NAME: linux-mirror-db
      DB_NAME: mirror.sl3
      URL_PREFIX: mirror-chunk-
      # 10MB = 10 * 1024 * 1024 = 10485760
      SERVER_CHUNK_SIZE: 10485760
      SUFFIX_LENGTH: 3

    steps:
      - uses: actions/checkout@v2

      - name: Download CSVs
        run: |
          wget https://${BUCKET_NAME}.storage.googleapis.com/fixes.csv
          wget https://${BUCKET_NAME}.storage.googleapis.com/reported_by.csv
          wget https://${BUCKET_NAME}.storage.googleapis.com/tags.csv
          wget https://${BUCKET_NAME}.storage.googleapis.com/upstream.csv
          wget https://${BUCKET_NAME}.storage.googleapis.com/cve.csv

      - name: Recreate SQLite3 DB
        run: |
          sudo apt update && sudo apt install sqlite3
          rm -f mirror.sl3
          sqlite3 mirror.sl3 '.mode csv' '.import fixes.csv fixes'
          sqlite3 mirror.sl3 '.mode csv' '.import reported_by.csv reported_by'
          sqlite3 mirror.sl3 '.mode csv' '.import tags.csv tags'
          sqlite3 mirror.sl3 '.mode csv' '.import upstream.csv upstream'
          sqlite3 mirror.sl3 '.mode csv' '.import cve.csv cve'
          sqlite3 mirror.sl3 'CREATE INDEX fixes_commit ON fixes (`commit`,`fixes`);'
          sqlite3 mirror.sl3 'CREATE INDEX fixes_fixes ON fixes (`fixes`,`commit`);'
          sqlite3 mirror.sl3 'CREATE INDEX reported_by_commit ON reported_by (`commit`,`reported_by`);'
          sqlite3 mirror.sl3 'CREATE INDEX tags_commit ON tags (`commit`,`tags`);'
          sqlite3 mirror.sl3 'CREATE INDEX upstream_commit ON upstream (`commit`,`upstream`);'
          sqlite3 mirror.sl3 'CREATE INDEX upstream_upstream ON upstream (`upstream`,`commit`);'
          sqlite3 mirror.sl3 'CREATE INDEX cve_commit ON cve (`commit`,`cve`);'
          sqlite3 mirror.sl3 'CREATE INDEX cve_cve ON cve (`cve`,`commit`);'
          sqlite3 mirror.sl3 'pragma journal_mode = delete; pragma page_size = 1024; vacuum;'
          echo "::set-output name=databaseChecksum::$(sha1sum mirror.sl3 | cut -f1 -d' ')"

      - id: 'split-db'
        run: |
          databaseLengthBytes="$(stat --printf="%s" "${DB_NAME}")"
          requestChunkSize="$(sqlite3 "${DB_NAME}" 'pragma page_size')"
          rm -f ${URL_PREFIX}*
          split "${DB_NAME}" --bytes=${SERVER_CHUNK_SIZE} --suffix-length=${SUFFIX_LENGTH} --numeric-suffixes ${URL_PREFIX}
          echo "::set-output name=requestChunkSize::${requestChunkSize}"
          echo "::set-output name=databaseLengthBytes::${databaseLengthBytes}"

      - uses: 'google-github-actions/auth@v0'
        with:
          workload_identity_provider: 'projects/799795028847/locations/global/workloadIdentityPools/github-pool/providers/github-provider'
          service_account: '[email protected]'

      - id: 'upload-db'
        uses: 'google-github-actions/upload-cloud-storage@v0'
        with:
          parent: false
          path: '${{ env.DB_NAME }}'
          destination: '${{ env.BUCKET_NAME }}'

      - id: 'upload-db-chunks'
        uses: 'google-github-actions/upload-cloud-storage@v0'
        with:
          destination: '${{ env.BUCKET_NAME }}/'
          glob: '${{ env.URL_PREFIX }}*'
          path: ./
          gzip: false
          headers: |-
            cache-control: max-age=30, must-revalidate

      - name: "Update config"
        env:
          requestChunkSize: '${{ steps.split-db.outputs.requestChunkSize }}'
          databaseLengthBytes: '${{ steps.split-db.outputs.databaseLengthBytes }}'
          databaseChecksum: '${{ steps.split-db.outputs.databaseChecksum }}'
          uploadedPath: 'https://storage.googleapis.com/${{ env.BUCKET_NAME }}/${{ env.URL_PREFIX }}'
        run: |
          echo '{
              "serverMode": "chunked",
              "requestChunkSize": '${requestChunkSize}',
              "databaseLengthBytes": '${databaseLengthBytes}',
              "serverChunkSize": '${SERVER_CHUNK_SIZE}',
              "urlPrefix": "'${uploadedPath}'",
              "suffixLength": '${SUFFIX_LENGTH}'
          }' | tee "config.json"

      - id: 'upload-config'
        uses: 'google-github-actions/upload-cloud-storage@v0'
        with:
          parent: false
          path: 'config.json'
          destination: '${{ env.BUCKET_NAME }}'
          headers: |-
            cache-control: max-age=3, must-revalidate

Log output

https://github.com/sirdarckcat/linux-1/runs/5812581320?check_suite_focus=true

https://github.com/sirdarckcat/linux-mirror/runs/5812493690?check_suite_focus=true

Additional information

This happens across different projects, with different workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions