Skip to content

Commit

Permalink
feat: [google-cloud-build] Add GoModule to Artifact and Results messa…
Browse files Browse the repository at this point in the history
…ges 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>
  • Loading branch information
3 people authored Jan 10, 2025
1 parent c74b5b5 commit 8a3a6d6
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
UpdateBuildTriggerRequest,
UpdateWorkerPoolOperationMetadata,
UpdateWorkerPoolRequest,
UploadedGoModule,
UploadedMavenArtifact,
UploadedNpmPackage,
UploadedPythonPackage,
Expand Down Expand Up @@ -156,6 +157,7 @@
"UpdateBuildTriggerRequest",
"UpdateWorkerPoolOperationMetadata",
"UpdateWorkerPoolRequest",
"UploadedGoModule",
"UploadedMavenArtifact",
"UploadedNpmPackage",
"UploadedPythonPackage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.28.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
UpdateBuildTriggerRequest,
UpdateWorkerPoolOperationMetadata,
UpdateWorkerPoolRequest,
UploadedGoModule,
UploadedMavenArtifact,
UploadedNpmPackage,
UploadedPythonPackage,
Expand Down Expand Up @@ -151,6 +152,7 @@
"UpdateBuildTriggerRequest",
"UpdateWorkerPoolOperationMetadata",
"UpdateWorkerPoolRequest",
"UploadedGoModule",
"UploadedMavenArtifact",
"UploadedNpmPackage",
"UploadedPythonPackage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.28.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
UpdateBuildTriggerRequest,
UpdateWorkerPoolOperationMetadata,
UpdateWorkerPoolRequest,
UploadedGoModule,
UploadedMavenArtifact,
UploadedNpmPackage,
UploadedPythonPackage,
Expand Down Expand Up @@ -143,6 +144,7 @@
"UpdateBuildTriggerRequest",
"UpdateWorkerPoolOperationMetadata",
"UpdateWorkerPoolRequest",
"UploadedGoModule",
"UploadedMavenArtifact",
"UploadedNpmPackage",
"UploadedPythonPackage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"BuiltImage",
"UploadedPythonPackage",
"UploadedMavenArtifact",
"UploadedGoModule",
"UploadedNpmPackage",
"BuildStep",
"Volume",
Expand Down Expand Up @@ -530,6 +531,37 @@ class UploadedMavenArtifact(proto.Message):
)


class UploadedGoModule(proto.Message):
r"""A Go module artifact uploaded to Artifact Registry using the
GoModule directive.
Attributes:
uri (str):
URI of the uploaded artifact.
file_hashes (google.cloud.devtools.cloudbuild_v1.types.FileHashes):
Hash types and values of the Go Module
Artifact.
push_timing (google.cloud.devtools.cloudbuild_v1.types.TimeSpan):
Output only. Stores timing information for
pushing the specified artifact.
"""

uri: str = proto.Field(
proto.STRING,
number=1,
)
file_hashes: "FileHashes" = proto.Field(
proto.MESSAGE,
number=2,
message="FileHashes",
)
push_timing: "TimeSpan" = proto.Field(
proto.MESSAGE,
number=3,
message="TimeSpan",
)


class UploadedNpmPackage(proto.Message):
r"""An npm package uploaded to Artifact Registry using the
NpmPackage directive.
Expand Down Expand Up @@ -835,6 +867,9 @@ class Results(proto.Message):
maven_artifacts (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.UploadedMavenArtifact]):
Maven artifacts uploaded to Artifact Registry
at the end of the build.
go_modules (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.UploadedGoModule]):
Optional. Go module artifacts uploaded to
Artifact Registry at the end of the build.
npm_packages (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.UploadedNpmPackage]):
Npm packages uploaded to Artifact Registry at
the end of the build.
Expand Down Expand Up @@ -876,6 +911,11 @@ class Results(proto.Message):
number=9,
message="UploadedMavenArtifact",
)
go_modules: MutableSequence["UploadedGoModule"] = proto.RepeatedField(
proto.MESSAGE,
number=10,
message="UploadedGoModule",
)
npm_packages: MutableSequence["UploadedNpmPackage"] = proto.RepeatedField(
proto.MESSAGE,
number=12,
Expand Down Expand Up @@ -1368,6 +1408,13 @@ class Artifacts(proto.Message):
If any artifacts fail to be pushed, the build is
marked FAILURE.
go_modules (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.Artifacts.GoModule]):
Optional. A list of Go modules to be uploaded
to Artifact Registry upon successful completion
of all build steps.
If any objects fail to be pushed, the build is
marked FAILURE.
python_packages (MutableSequence[google.cloud.devtools.cloudbuild_v1.types.Artifacts.PythonPackage]):
A list of Python packages to be uploaded to
Artifact Registry upon successful completion of
Expand Down Expand Up @@ -1478,6 +1525,68 @@ class MavenArtifact(proto.Message):
number=5,
)

class GoModule(proto.Message):
r"""Go module to upload to Artifact Registry upon successful
completion of all build steps. A module refers to all
dependencies in a go.mod file.
Attributes:
repository_name (str):
Optional. Artifact Registry repository name.
Specified Go modules will be zipped and uploaded
to Artifact Registry with this location as a
prefix.
e.g. my-go-repo
repository_location (str):
Optional. Location of the Artifact Registry
repository. i.e. us-east1 Defaults to the
build’s location.
repository_project_id (str):
Optional. Project ID of the Artifact Registry
repository. Defaults to the build project.
source_path (str):
Optional. Source path of the go.mod file in
the build's workspace. If not specified, this
will default to the current directory. e.g.
~/code/go/mypackage
module_path (str):
Optional. The Go module's "module path".
e.g. example.com/foo/v2
module_version (str):
Optional. The Go module's semantic version in
the form vX.Y.Z. e.g. v0.1.1 Pre-release
identifiers can also be added by appending a
dash and dot separated ASCII alphanumeric
characters and hyphens. e.g.
v0.2.3-alpha.x.12m.5
"""

repository_name: str = proto.Field(
proto.STRING,
number=1,
)
repository_location: str = proto.Field(
proto.STRING,
number=2,
)
repository_project_id: str = proto.Field(
proto.STRING,
number=3,
)
source_path: str = proto.Field(
proto.STRING,
number=4,
)
module_path: str = proto.Field(
proto.STRING,
number=5,
)
module_version: str = proto.Field(
proto.STRING,
number=6,
)

class PythonPackage(proto.Message):
r"""Python package to upload to Artifact Registry upon successful
completion of all build steps. A package can encapsulate
Expand Down Expand Up @@ -1546,6 +1655,11 @@ class NpmPackage(proto.Message):
number=3,
message=MavenArtifact,
)
go_modules: MutableSequence[GoModule] = proto.RepeatedField(
proto.MESSAGE,
number=4,
message=GoModule,
)
python_packages: MutableSequence[PythonPackage] = proto.RepeatedField(
proto.MESSAGE,
number=5,
Expand Down Expand Up @@ -1685,12 +1799,16 @@ class HashType(proto.Enum):
Use a sha256 hash.
MD5 (2):
Use a md5 hash.
GO_MODULE_H1 (3):
Dirhash of a Go module's source code which is
then hex-encoded.
SHA512 (4):
Use a sha512 hash.
"""
NONE = 0
SHA256 = 1
MD5 = 2
GO_MODULE_H1 = 3
SHA512 = 4

type_: HashType = proto.Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.28.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-build",
"version": "3.28.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-build",
"version": "3.28.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12776,6 +12776,7 @@ def test_create_build_rest_call_success(request_type):
"maven_artifacts": [
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
],
"go_modules": [{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}],
"npm_packages": [
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
],
Expand All @@ -12802,6 +12803,16 @@ def test_create_build_rest_call_success(request_type):
"version": "version_value",
}
],
"go_modules": [
{
"repository_name": "repository_name_value",
"repository_location": "repository_location_value",
"repository_project_id": "repository_project_id_value",
"source_path": "source_path_value",
"module_path": "module_path_value",
"module_version": "module_version_value",
}
],
"python_packages": [
{
"repository": "repository_value",
Expand Down Expand Up @@ -13786,6 +13797,9 @@ def test_create_build_trigger_rest_call_success(request_type):
"maven_artifacts": [
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
],
"go_modules": [
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
],
"npm_packages": [
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
],
Expand All @@ -13812,6 +13826,16 @@ def test_create_build_trigger_rest_call_success(request_type):
"version": "version_value",
}
],
"go_modules": [
{
"repository_name": "repository_name_value",
"repository_location": "repository_location_value",
"repository_project_id": "repository_project_id_value",
"source_path": "source_path_value",
"module_path": "module_path_value",
"module_version": "module_version_value",
}
],
"python_packages": [
{
"repository": "repository_value",
Expand Down Expand Up @@ -14604,6 +14628,9 @@ def test_update_build_trigger_rest_call_success(request_type):
"maven_artifacts": [
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
],
"go_modules": [
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
],
"npm_packages": [
{"uri": "uri_value", "file_hashes": {}, "push_timing": {}}
],
Expand All @@ -14630,6 +14657,16 @@ def test_update_build_trigger_rest_call_success(request_type):
"version": "version_value",
}
],
"go_modules": [
{
"repository_name": "repository_name_value",
"repository_location": "repository_location_value",
"repository_project_id": "repository_project_id_value",
"source_path": "source_path_value",
"module_path": "module_path_value",
"module_version": "module_version_value",
}
],
"python_packages": [
{
"repository": "repository_value",
Expand Down

0 comments on commit 8a3a6d6

Please sign in to comment.