xref: /aosp_15_r20/external/googleapis/google/devtools/containeranalysis/v1beta1/image/image.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2018 The Grafeas Authors. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package grafeas.v1beta1.image;
18
19option go_package = "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb;containeranalysispb";
20option java_multiple_files = true;
21option java_package = "io.grafeas.v1beta1.image";
22option objc_class_prefix = "GRA";
23
24// Layer holds metadata specific to a layer of a Docker image.
25message Layer {
26  // Instructions from Dockerfile.
27  enum Directive {
28    // Default value for unsupported/missing directive.
29    DIRECTIVE_UNSPECIFIED = 0;
30
31    // https://docs.docker.com/engine/reference/builder/
32    MAINTAINER = 1;
33
34    // https://docs.docker.com/engine/reference/builder/
35    RUN = 2;
36
37    // https://docs.docker.com/engine/reference/builder/
38    CMD = 3;
39
40    // https://docs.docker.com/engine/reference/builder/
41    LABEL = 4;
42
43    // https://docs.docker.com/engine/reference/builder/
44    EXPOSE = 5;
45
46    // https://docs.docker.com/engine/reference/builder/
47    ENV = 6;
48
49    // https://docs.docker.com/engine/reference/builder/
50    ADD = 7;
51
52    // https://docs.docker.com/engine/reference/builder/
53    COPY = 8;
54
55    // https://docs.docker.com/engine/reference/builder/
56    ENTRYPOINT = 9;
57
58    // https://docs.docker.com/engine/reference/builder/
59    VOLUME = 10;
60
61    // https://docs.docker.com/engine/reference/builder/
62    USER = 11;
63
64    // https://docs.docker.com/engine/reference/builder/
65    WORKDIR = 12;
66
67    // https://docs.docker.com/engine/reference/builder/
68    ARG = 13;
69
70    // https://docs.docker.com/engine/reference/builder/
71    ONBUILD = 14;
72
73    // https://docs.docker.com/engine/reference/builder/
74    STOPSIGNAL = 15;
75
76    // https://docs.docker.com/engine/reference/builder/
77    HEALTHCHECK = 16;
78
79    // https://docs.docker.com/engine/reference/builder/
80    SHELL = 17;
81  }
82
83  // Required. The recovered Dockerfile directive used to construct this layer.
84  Directive directive = 1;
85
86  // The recovered arguments to the Dockerfile directive.
87  string arguments = 2;
88}
89
90// A set of properties that uniquely identify a given Docker image.
91message Fingerprint {
92  // Required. The layer ID of the final layer in the Docker image's v1
93  // representation.
94  string v1_name = 1;
95
96  // Required. The ordered list of v2 blobs that represent a given image.
97  repeated string v2_blob = 2;
98
99  // Output only. The name of the image's v2 blobs computed via:
100  //   [bottom] := v2_blob[bottom]
101  //   [N] := sha256(v2_blob[N] + " " + v2_name[N+1])
102  // Only the name of the final blob is kept.
103  string v2_name = 3;
104}
105
106// Basis describes the base image portion (Note) of the DockerImage
107// relationship. Linked occurrences are derived from this or an
108// equivalent image via:
109//   FROM <Basis.resource_url>
110// Or an equivalent reference, e.g. a tag of the resource_url.
111message Basis {
112  // Required. Immutable. The resource_url for the resource representing the
113  // basis of associated occurrence images.
114  string resource_url = 1;
115
116  // Required. Immutable. The fingerprint of the base image.
117  Fingerprint fingerprint = 2;
118}
119
120// Details of an image occurrence.
121message Details {
122  // Required. Immutable. The child image derived from the base image.
123  Derived derived_image = 1;
124}
125
126// Derived describes the derived image portion (Occurrence) of the DockerImage
127// relationship. This image would be produced from a Dockerfile with FROM
128// <DockerImage.Basis in attached Note>.
129message Derived {
130  // Required. The fingerprint of the derived image.
131  Fingerprint fingerprint = 1;
132
133  // Output only. The number of layers by which this image differs from the
134  // associated image basis.
135  int32 distance = 2;
136
137  // This contains layer-specific metadata, if populated it has length
138  // "distance" and is ordered with [distance] being the layer immediately
139  // following the base image and [1] being the final layer.
140  repeated Layer layer_info = 3;
141
142  // Output only. This contains the base image URL for the derived image
143  // occurrence.
144  string base_resource_url = 4;
145}
146