Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CBWP update with ETag #2012

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

yuwenma
Copy link
Collaborator

@yuwenma yuwenma commented Jun 14, 2024

Add Etag to CloudBuildWorkerPool resource status.ObservedState.
When updating, we should pass in the etag to the CloudBuild server and expect a different etag from the response body.

Right now, the mockgcp replaces the ETag, so we can only see the diff from the golden object.

@@ -88,6 +88,8 @@ type CloudBuildWorkerPoolObservedState struct {
// +required
WorkerConfig *WorkerConfig `json:"workerConfig,omitempty"`
NetworkConfig *NetworkConfigState `json:"networkConfig,omitempty"`

ETag *string `json:"eTag,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still alpha, so not a blocker but ... I don't know how we should capitalize etag. I think it might just be etag. I don't think I've seen eTag anywhere else (?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! You are right. It's interesting that the camel case format is etag with lower case e where the capitalized format is ETag.

Updated.

@@ -77,6 +77,7 @@ func (s *CloudBuildV1) CreateWorkerPool(ctx context.Context, req *pb.CreateWorke
result.CreateTime = now
result.UpdateTime = now
result.State = pb.WorkerPool_RUNNING
result.Etag = "W/11111111111111111111111111111111"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I have some helper functions computeEtag that I typically put in utils.go in each mock directory. (And note that there are two versions, some which return strings, some which return []byte, because some services need string and some []byte)

Would be great to figure out a better place for them, but it's pretty easy to have more realistic etags :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the computeEtag! Make some further changes (with weak indicator), please take a look at the latest commit. If the common computeEtag looks good, I can update the mockgcp

@justinsb
Copy link
Collaborator

A few nits but lgtm.

I'll hold in case you want to address them here.

/hold
/approve
/lgtm

@google-oss-prow google-oss-prow bot removed the lgtm label Jun 17, 2024
@yuwenma yuwenma force-pushed the cbwp-etag branch 2 times, most recently from 46641a1 to 0c2cdf3 Compare June 17, 2024 22:10
@yuwenma
Copy link
Collaborator Author

yuwenma commented Jun 18, 2024

/hold cancel

@justinsb
Copy link
Collaborator

Thanks @yuwenma

/approve
/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Jun 18, 2024
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 6944199 into GoogleCloudPlatform:master Jun 18, 2024
13 checks passed
@yuwenma yuwenma added this to the 1.120 milestone Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants