Skip to content

Commit 8a3a6d6

Browse files
feat: [google-cloud-build] Add GoModule to Artifact and Results messages and new GO_MODULE_H1 hash type (#13416)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 713355615 Source-Link: googleapis/googleapis@16db802 Source-Link: googleapis/googleapis-gen@9983231 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJ1aWxkLy5Pd2xCb3QueWFtbCIsImgiOiI5OTgzMjMxMzE0NTZlYzBlYWU1MTMxZWU2NzNhOTY0Y2FjNjk3MDhiIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
1 parent c74b5b5 commit 8a3a6d6

File tree

10 files changed

+166
-5
lines changed

10 files changed

+166
-5
lines changed

packages/google-cloud-build/google/cloud/devtools/cloudbuild/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
UpdateBuildTriggerRequest,
8686
UpdateWorkerPoolOperationMetadata,
8787
UpdateWorkerPoolRequest,
88+
UploadedGoModule,
8889
UploadedMavenArtifact,
8990
UploadedNpmPackage,
9091
UploadedPythonPackage,
@@ -156,6 +157,7 @@
156157
"UpdateBuildTriggerRequest",
157158
"UpdateWorkerPoolOperationMetadata",
158159
"UpdateWorkerPoolRequest",
160+
"UploadedGoModule",
159161
"UploadedMavenArtifact",
160162
"UploadedNpmPackage",
161163
"UploadedPythonPackage",

packages/google-cloud-build/google/cloud/devtools/cloudbuild/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "3.28.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
UpdateBuildTriggerRequest,
8181
UpdateWorkerPoolOperationMetadata,
8282
UpdateWorkerPoolRequest,
83+
UploadedGoModule,
8384
UploadedMavenArtifact,
8485
UploadedNpmPackage,
8586
UploadedPythonPackage,
@@ -151,6 +152,7 @@
151152
"UpdateBuildTriggerRequest",
152153
"UpdateWorkerPoolOperationMetadata",
153154
"UpdateWorkerPoolRequest",
155+
"UploadedGoModule",
154156
"UploadedMavenArtifact",
155157
"UploadedNpmPackage",
156158
"UploadedPythonPackage",

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "3.28.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
UpdateBuildTriggerRequest,
7575
UpdateWorkerPoolOperationMetadata,
7676
UpdateWorkerPoolRequest,
77+
UploadedGoModule,
7778
UploadedMavenArtifact,
7879
UploadedNpmPackage,
7980
UploadedPythonPackage,
@@ -143,6 +144,7 @@
143144
"UpdateBuildTriggerRequest",
144145
"UpdateWorkerPoolOperationMetadata",
145146
"UpdateWorkerPoolRequest",
147+
"UploadedGoModule",
146148
"UploadedMavenArtifact",
147149
"UploadedNpmPackage",
148150
"UploadedPythonPackage",

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"BuiltImage",
3737
"UploadedPythonPackage",
3838
"UploadedMavenArtifact",
39+
"UploadedGoModule",
3940
"UploadedNpmPackage",
4041
"BuildStep",
4142
"Volume",
@@ -530,6 +531,37 @@ class UploadedMavenArtifact(proto.Message):
530531
)
531532

532533

534+
class UploadedGoModule(proto.Message):
535+
r"""A Go module artifact uploaded to Artifact Registry using the
536+
GoModule directive.
537+
538+
Attributes:
539+
uri (str):
540+
URI of the uploaded artifact.
541+
file_hashes (google.cloud.devtools.cloudbuild_v1.types.FileHashes):
542+
Hash types and values of the Go Module
543+
Artifact.
544+
push_timing (google.cloud.devtools.cloudbuild_v1.types.TimeSpan):
545+
Output only. Stores timing information for
546+
pushing the specified artifact.
547+
"""
548+
549+
uri: str = proto.Field(
550+
proto.STRING,
551+
number=1,
552+
)
553+
file_hashes: "FileHashes" = proto.Field(
554+
proto.MESSAGE,
555+
number=2,
556+
message="FileHashes",
557+
)
558+
push_timing: "TimeSpan" = proto.Field(
559+
proto.MESSAGE,
560+
number=3,
561+
message="TimeSpan",
562+
)
563+
564+
533565
class UploadedNpmPackage(proto.Message):
534566
r"""An npm package uploaded to Artifact Registry using the
535567
NpmPackage directive.
@@ -835,6 +867,9 @@ class Results(proto.Message):
835867
maven_artifacts (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.UploadedMavenArtifact]):
836868
Maven artifacts uploaded to Artifact Registry
837869
at the end of the build.
870+
go_modules (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.UploadedGoModule]):
871+
Optional. Go module artifacts uploaded to
872+
Artifact Registry at the end of the build.
838873
npm_packages (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.UploadedNpmPackage]):
839874
Npm packages uploaded to Artifact Registry at
840875
the end of the build.
@@ -876,6 +911,11 @@ class Results(proto.Message):
876911
number=9,
877912
message="UploadedMavenArtifact",
878913
)
914+
go_modules: MutableSequence["UploadedGoModule"] = proto.RepeatedField(
915+
proto.MESSAGE,
916+
number=10,
917+
message="UploadedGoModule",
918+
)
879919
npm_packages: MutableSequence["UploadedNpmPackage"] = proto.RepeatedField(
880920
proto.MESSAGE,
881921
number=12,
@@ -1368,6 +1408,13 @@ class Artifacts(proto.Message):
13681408
13691409
If any artifacts fail to be pushed, the build is
13701410
marked FAILURE.
1411+
go_modules (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.Artifacts.GoModule]):
1412+
Optional. A list of Go modules to be uploaded
1413+
to Artifact Registry upon successful completion
1414+
of all build steps.
1415+
1416+
If any objects fail to be pushed, the build is
1417+
marked FAILURE.
13711418
python_packages (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.Artifacts.PythonPackage]):
13721419
A list of Python packages to be uploaded to
13731420
Artifact Registry upon successful completion of
@@ -1478,6 +1525,68 @@ class MavenArtifact(proto.Message):
14781525
number=5,
14791526
)
14801527

1528+
class GoModule(proto.Message):
1529+
r"""Go module to upload to Artifact Registry upon successful
1530+
completion of all build steps. A module refers to all
1531+
dependencies in a go.mod file.
1532+
1533+
Attributes:
1534+
repository_name (str):
1535+
Optional. Artifact Registry repository name.
1536+
1537+
Specified Go modules will be zipped and uploaded
1538+
to Artifact Registry with this location as a
1539+
prefix.
1540+
e.g. my-go-repo
1541+
repository_location (str):
1542+
Optional. Location of the Artifact Registry
1543+
repository. i.e. us-east1 Defaults to the
1544+
build’s location.
1545+
repository_project_id (str):
1546+
Optional. Project ID of the Artifact Registry
1547+
repository. Defaults to the build project.
1548+
source_path (str):
1549+
Optional. Source path of the go.mod file in
1550+
the build's workspace. If not specified, this
1551+
will default to the current directory. e.g.
1552+
~/code/go/mypackage
1553+
module_path (str):
1554+
Optional. The Go module's "module path".
1555+
e.g. example.com/foo/v2
1556+
module_version (str):
1557+
Optional. The Go module's semantic version in
1558+
the form vX.Y.Z. e.g. v0.1.1 Pre-release
1559+
identifiers can also be added by appending a
1560+
dash and dot separated ASCII alphanumeric
1561+
characters and hyphens. e.g.
1562+
v0.2.3-alpha.x.12m.5
1563+
"""
1564+
1565+
repository_name: str = proto.Field(
1566+
proto.STRING,
1567+
number=1,
1568+
)
1569+
repository_location: str = proto.Field(
1570+
proto.STRING,
1571+
number=2,
1572+
)
1573+
repository_project_id: str = proto.Field(
1574+
proto.STRING,
1575+
number=3,
1576+
)
1577+
source_path: str = proto.Field(
1578+
proto.STRING,
1579+
number=4,
1580+
)
1581+
module_path: str = proto.Field(
1582+
proto.STRING,
1583+
number=5,
1584+
)
1585+
module_version: str = proto.Field(
1586+
proto.STRING,
1587+
number=6,
1588+
)
1589+
14811590
class PythonPackage(proto.Message):
14821591
r"""Python package to upload to Artifact Registry upon successful
14831592
completion of all build steps. A package can encapsulate
@@ -1546,6 +1655,11 @@ class NpmPackage(proto.Message):
15461655
number=3,
15471656
message=MavenArtifact,
15481657
)
1658+
go_modules: MutableSequence[GoModule] = proto.RepeatedField(
1659+
proto.MESSAGE,
1660+
number=4,
1661+
message=GoModule,
1662+
)
15491663
python_packages: MutableSequence[PythonPackage] = proto.RepeatedField(
15501664
proto.MESSAGE,
15511665
number=5,
@@ -1685,12 +1799,16 @@ class HashType(proto.Enum):
16851799
Use a sha256 hash.
16861800
MD5 (2):
16871801
Use a md5 hash.
1802+
GO_MODULE_H1 (3):
1803+
Dirhash of a Go module's source code which is
1804+
then hex-encoded.
16881805
SHA512 (4):
16891806
Use a sha512 hash.
16901807
"""
16911808
NONE = 0
16921809
SHA256 = 1
16931810
MD5 = 2
1811+
GO_MODULE_H1 = 3
16941812
SHA512 = 4
16951813

16961814
type_: HashType = proto.Field(

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "3.28.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-build",
11-
"version": "3.28.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-build",
11-
"version": "3.28.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12776,6 +12776,7 @@ def test_create_build_rest_call_success(request_type):
1277612776
"maven_artifacts": [
1277712777
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
1277812778
],
12779+
"go_modules": [{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}],
1277912780
"npm_packages": [
1278012781
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
1278112782
],
@@ -12802,6 +12803,16 @@ def test_create_build_rest_call_success(request_type):
1280212803
"version": "version_value",
1280312804
}
1280412805
],
12806+
"go_modules": [
12807+
{
12808+
"repository_name": "repository_name_value",
12809+
"repository_location": "repository_location_value",
12810+
"repository_project_id": "repository_project_id_value",
12811+
"source_path": "source_path_value",
12812+
"module_path": "module_path_value",
12813+
"module_version": "module_version_value",
12814+
}
12815+
],
1280512816
"python_packages": [
1280612817
{
1280712818
"repository": "repository_value",
@@ -13786,6 +13797,9 @@ def test_create_build_trigger_rest_call_success(request_type):
1378613797
"maven_artifacts": [
1378713798
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
1378813799
],
13800+
"go_modules": [
13801+
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
13802+
],
1378913803
"npm_packages": [
1379013804
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
1379113805
],
@@ -13812,6 +13826,16 @@ def test_create_build_trigger_rest_call_success(request_type):
1381213826
"version": "version_value",
1381313827
}
1381413828
],
13829+
"go_modules": [
13830+
{
13831+
"repository_name": "repository_name_value",
13832+
"repository_location": "repository_location_value",
13833+
"repository_project_id": "repository_project_id_value",
13834+
"source_path": "source_path_value",
13835+
"module_path": "module_path_value",
13836+
"module_version": "module_version_value",
13837+
}
13838+
],
1381513839
"python_packages": [
1381613840
{
1381713841
"repository": "repository_value",
@@ -14604,6 +14628,9 @@ def test_update_build_trigger_rest_call_success(request_type):
1460414628
"maven_artifacts": [
1460514629
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
1460614630
],
14631+
"go_modules": [
14632+
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
14633+
],
1460714634
"npm_packages": [
1460814635
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
1460914636
],
@@ -14630,6 +14657,16 @@ def test_update_build_trigger_rest_call_success(request_type):
1463014657
"version": "version_value",
1463114658
}
1463214659
],
14660+
"go_modules": [
14661+
{
14662+
"repository_name": "repository_name_value",
14663+
"repository_location": "repository_location_value",
14664+
"repository_project_id": "repository_project_id_value",
14665+
"source_path": "source_path_value",
14666+
"module_path": "module_path_value",
14667+
"module_version": "module_version_value",
14668+
}
14669+
],
1463314670
"python_packages": [
1463414671
{
1463514672
"repository": "repository_value",

0 commit comments

Comments
 (0)