gcpug / nouhau

Google Cloud Platformのノウハウを共有するRepository
https://gcpug.jp
MIT License
655 stars 21 forks source link

複数ImageをPushした場合、最初のImageにContainer Analysisのmetadataがすべて入る #110

Closed sinmetal closed 4 years ago

sinmetal commented 5 years ago

WHAT

Google Cloud Buildで複数のImageをpushした場合、Container Analysisのmetadataが最初のImageにすべて入って、他のImageは空っぽになる。

試した cloudbuild.yaml

steps:
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '--tag=gcr.io/$PROJECT_ID/build-playground/sample:1', '-f', '1.Dockerfile', '.']
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '--tag=gcr.io/$PROJECT_ID/build-playground/sample:2', '-f', '2.Dockerfile', '.']
images: ['gcr.io/$PROJECT_ID/build-playground/sample:1', 'gcr.io/$PROJECT_ID/build-playground/sample:2']

Refs : https://github.com/sinmetal/build-playground

1つ目のImageのmetadata

gcloud beta container images describe gcr.io/sinmetal-lab/build-playground/sample:1 --show-all-metadata
build_details_summary:
  build_details:
  - buildDetails:
      provenance:
        buildOptions:
          VerifyOption: NOT_VERIFIED
        builderVersion: '272370366'
        builtArtifacts:
        - checksum: sha256:3c6bde414e1674c081ba5266f609c540837171ddb53231ce5f9fd0962783564c
          id: gcr.io/sinmetal-lab/build-playground/sample@sha256:3c6bde414e1674c081ba5266f609c540837171ddb53231ce5f9fd0962783564c
          names:
          - gcr.io/sinmetal-lab/build-playground/sample:1
        - checksum: sha256:541e334e4428adac4bdd5a0c7fa8da23d6499d70c12a5bde52b39d53b2b57455
          id: gcr.io/sinmetal-lab/build-playground/sample@sha256:541e334e4428adac4bdd5a0c7fa8da23d6499d70c12a5bde52b39d53b2b57455
          names:
          - gcr.io/sinmetal-lab/build-playground/sample:2
        commands:
        - args:
          - build
          - --tag=gcr.io/sinmetal-lab/build-playground/sample:1
          - -f
          - 1.Dockerfile
          - .
          name: gcr.io/cloud-builders/docker
        - args:
          - build
          - --tag=gcr.io/sinmetal-lab/build-playground/sample:2
          - -f
          - 2.Dockerfile
          - .
          name: gcr.io/cloud-builders/docker
        createTime: '2019-10-07T09:07:03.623948739Z'
        creator: metal.tie@gmail.com
        finishTime: '2019-10-07T09:07:34.244507Z'
        id: 58802b77-0d97-4240-9a20-848a540669e9
        logsBucket: gs://692077117237.cloudbuild-logs.googleusercontent.com
        projectId: sinmetal-lab
        sourceProvenance:
          fileHashes:
            gs://sinmetal-lab_cloudbuild/source/1570439216.6-34c84cf1329f4d348a6ecad12ce8a20a.tgz#1570439222210237:
              fileHash:
              - value: JrppMZVBvy_YWMpCQDwOdQ==
        startTime: '2019-10-07T09:07:05.020830669Z'
      provenanceBytes: eyJpZCI6IjU4ODAyYjc3LTBkOTctNDI0MC05YTIwLTg0OGE1NDA2NjllOSIsInByb2plY3RJZCI6InNpbm1ldGFsLWxhYiIsImNvbW1hbmRzIjpbeyJuYW1lIjoiZ2NyLmlvL2Nsb3VkLWJ1aWxkZXJzL2RvY2tlciIsImFyZ3MiOlsiYnVpbGQiLCItLXRhZz1nY3IuaW8vc2lubWV0YWwtbGFiL2J1aWxkLXBsYXlncm91bmQvc2FtcGxlOjEiLCItZiIsIjEuRG9ja2VyZmlsZSIsIi4iXX0seyJuYW1lIjoiZ2NyLmlvL2Nsb3VkLWJ1aWxkZXJzL2RvY2tlciIsImFyZ3MiOlsiYnVpbGQiLCItLXRhZz1nY3IuaW8vc2lubWV0YWwtbGFiL2J1aWxkLXBsYXlncm91bmQvc2FtcGxlOjIiLCItZiIsIjIuRG9ja2VyZmlsZSIsIi4iXX1dLCJidWlsdEFydGlmYWN0cyI6W3siY2hlY2tzdW0iOiJzaGEyNTY6M2M2YmRlNDE0ZTE2NzRjMDgxYmE1MjY2ZjYwOWM1NDA4MzcxNzFkZGI1MzIzMWNlNWY5ZmQwOTYyNzgzNTY0YyIsImlkIjoiZ2NyLmlvL3Npbm1ldGFsLWxhYi9idWlsZC1wbGF5Z3JvdW5kL3NhbXBsZUBzaGEyNTY6M2M2YmRlNDE0ZTE2NzRjM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hbC1sYWJfY2xvdWRidWlsZC9zb3VyY2UvMTU3MDQzOTIxNi42LTM0Yzg0Y2YxMzI5ZjRkMzQ4YTZlY2FkMTJjZThhMjBhLnRneiMxNTcwNDM5MjIyMjEwMjM3Ijp7ImZpbGVIYXNoIjpbeyJ0eXBlIjoiTUQ1IiwidmFsdWUiOiJKcnBwTVpWQnZ5L1lXTXBDUUR3T2RRPT0ifV19fX0sImJ1aWxkT3B0aW9ucyI6eyJWZXJpZnlPcHRpb24iOiJOT1RfVkVSSUZJRUQifSwiYnVpbGRlclZlcnNpb24iOiIyNzIzNzAzNjYifQ==
    createTime: '2019-10-07T09:07:35.450390Z'
    kind: BUILD_DETAILS
    name: projects/sinmetal-lab/occurrences/48293fd3-9a5e-40ac-9d3e-238756f60dd6
    noteName: projects/verified-builder/notes/58802b77-0d97-4240-9a20-848a540669e9
    resource:
      uri: https://gcr.io/sinmetal-lab/build-playground/sample@sha256:3c6bde414e1674c081ba5266f609c540837171ddb53231ce5f9fd0962783564c
    resourceUrl: https://gcr.io/sinmetal-lab/build-playground/sample@sha256:3c6bde414e1674c081ba5266f609c540837171ddb53231ce5f9fd0962783564c
    updateTime: '2019-10-07T09:07:35.450390Z'
deployment_summary:
  deployments: []
discovery_summary:
  discovery: []
image_basis_summary:
  base_images: []
image_summary:
  digest: sha256:3c6bde414e1674c081ba5266f609c540837171ddb53231ce5f9fd0962783564c
  fully_qualified_digest: gcr.io/sinmetal-lab/build-playground/sample@sha256:3c6bde414e1674c081ba5266f609c540837171ddb53231ce5f9fd0962783564c
  registry: gcr.io
  repository: sinmetal-lab/build-playground/sample
package_vulnerability_summary:
  not_fixed_vulnerability_count: 0
  total_vulnerability_found: 0
  vulnerabilities: {}

2つ目のImageのmetadata

gcloud beta container images describe gcr.io/sinmetal-lab/build-playground/sample:2 --show-all-metadata
build_details_summary:
  build_details: []
deployment_summary:
  deployments: []
discovery_summary:
  discovery: []
image_basis_summary:
  base_images: []
image_summary:
  digest: sha256:541e334e4428adac4bdd5a0c7fa8da23d6499d70c12a5bde52b39d53b2b57455
  fully_qualified_digest: gcr.io/sinmetal-lab/build-playground/sample@sha256:541e334e4428adac4bdd5a0c7fa8da23d6499d70c12a5bde52b39d53b2b57455
  registry: gcr.io
  repository: sinmetal-lab/build-playground/sample
package_vulnerability_summary:
  not_fixed_vulnerability_count: 0
  total_vulnerability_found: 0
  vulnerabilities: {}
sinmetal commented 5 years ago

https://issuetracker.google.com/issues/143990998

sinmetal commented 4 years ago

https://issuetracker.google.com/issues/143990998 で解決したぞーって言ってた。