Skip to content
This repository was archived by the owner on Jul 11, 2024. It is now read-only.

Commit ce29ba0

Browse files
authored
Curio 155 (#168)
* Cleanup packagejson * Fix food = 0 not working and try migrating to createRef. * Update web dependencies and fix eggworld ref. * Update dependencies * Update dependencies. * Fix guava compatibility. * Fix eggworld bugs. * Update cloud build generation * Regenerate cloudbuild. * Remove unused cloudbuild files. * Fix gcloudLoginToCluster * Remove deprecated tasks. * Remove some boilerplate * Import truth proto for migration to assertj. * assertj-protobuf compiles. * Licenses * Finish assertj-proto * Wire protoassert into testing framework. * Spotless * Prepare for publishing assertj-protobuf. * Add README * Add publications * Add jib building of images. * Clean * Set DockerContextTask path * Use proto assert with listenable future. * Update web dependencies. * v0.0.7 * Publish web * Update dependencies. * Downgrade ts-jest again * Bump package.json * Fix jest * Spotless
1 parent 8eb1630 commit ce29ba0

File tree

71 files changed

+9034
-2010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+9034
-2010
lines changed

cloudbuild-bootstrap.yaml

Lines changed: 0 additions & 56 deletions
This file was deleted.

cloudbuild.yaml

Lines changed: 159 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
1-
#
2-
# MIT License
3-
#
4-
# Copyright (c) 2017 Choko (choko@curioswitch.org)
5-
#
6-
# Permission is hereby granted, free of charge, to any person obtaining a copy
7-
# of this software and associated documentation files (the "Software"), to deal
8-
# in the Software without restriction, including without limitation the rights
9-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
# copies of the Software, and to permit persons to whom the Software is
11-
# furnished to do so, subject to the following conditions:
12-
#
13-
# The above copyright notice and this permission notice shall be included in all
14-
# copies or substantial portions of the Software.
15-
#
16-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-
# SOFTWARE.
23-
#
241
---
252
steps:
263
- id: curio-generated-deepen-git-repo
@@ -34,34 +11,183 @@ steps:
3411
- --depth=10
3512
env:
3613
- CI=true
37-
- id: curio-generated-fetch-build-cache
14+
- id: curio-generated-fetch-uncompressed-build-cache
3815
waitFor:
3916
- '-'
4017
name: gcr.io/cloud-builders/gsutil
18+
entrypoint: bash
4119
args:
42-
- cp
43-
- gs://curioswitch-gradle-build-cache/cloudbuild-cache.tar.gz
44-
- .gradle/cloudbuild-cache.tar
20+
- -c
21+
- gsutil cp gs://curioswitch-gradle-build-cache/cloudbuild-cache-uncompressed.tar .gradle/cloudbuild-cache-uncompressed.tar && tar -xpPf .gradle/cloudbuild-cache-uncompressed.tar || echo Could not fetch uncompressed build cache...
22+
env:
23+
- CI=true
24+
- id: curio-generated-fetch-compressed-build-cache
25+
waitFor:
26+
- '-'
27+
name: gcr.io/cloud-builders/gsutil
28+
entrypoint: bash
29+
args:
30+
- -c
31+
- gsutil cp gs://curioswitch-gradle-build-cache/cloudbuild-cache-compressed.tar.gz .gradle/cloudbuild-cache-compressed.tar.gz && tar -xpPf .gradle/cloudbuild-cache-compressed.tar.gz || echo Could not fetch compressed build cache...
32+
env:
33+
- CI=true
4534
- id: curio-generated-build-all
4635
waitFor:
4736
- curio-generated-deepen-git-repo
48-
- curio-generated-fetch-build-cache
37+
- curio-generated-fetch-uncompressed-build-cache
38+
- curio-generated-fetch-compressed-build-cache
4939
name: openjdk:10-jdk-slim
5040
entrypoint: bash
5141
args:
5242
- -c
53-
- "(test -e .gradle/cloudbuild-cache.tar && tar -xpPf .gradle/cloudbuild-cache.tar || echo No build cache yet.) && ./gradlew continuousBuild --stacktrace --no-daemon && tar -cpPf .gradle/cloudbuild-cache.tar /root/.gradle/wrapper /usr/local/share/.cache /root/.gradle/caches /root/.gradle/curiostack"
43+
- (test -e .gradle/cloudbuild-cache-uncompressed.tar && tar -xpPf .gradle/cloudbuild-cache-uncompressed.tar && tar -xpPf .gradle/cloudbuild-cache-compressed.tar.gz || echo No build cache yet.) && ./gradlew continuousBuild --stacktrace --no-daemon && tar -cpPf .gradle/cloudbuild-cache-uncompressed.tar /root/.gradle/wrapper /root/.gradle/caches /root/.gradle/curiostack && tar -cpPzf .gradle/cloudbuild-cache-compressed.tar.gz /usr/local/share/.cache /root/.gradle/go
5444
env:
5545
- CI=true
5646
- CI_MASTER=true
57-
- id: curio-generated-update-build-cache
47+
- id: curio-generated-push-uncompressed-build-cache
48+
waitFor:
49+
- curio-generated-build-all
50+
name: gcr.io/cloud-builders/gsutil
51+
args:
52+
- -o
53+
- GSUtil:parallel_composite_upload_threshold=150M
54+
- cp
55+
- .gradle/cloudbuild-cache-uncompressed.tar
56+
- gs://curioswitch-gradle-build-cache/cloudbuild-cache-uncompressed.tar
57+
env:
58+
- CI=true
59+
- id: curio-generated-push-compressed-build-cache
5860
waitFor:
5961
- curio-generated-build-all
6062
name: gcr.io/cloud-builders/gsutil
6163
args:
6264
- -o
6365
- GSUtil:parallel_composite_upload_threshold=150M
6466
- cp
65-
- .gradle/cloudbuild-cache.tar
66-
- gs://curioswitch-gradle-build-cache/cloudbuild-cache.tar.gz
67-
timeout: 60m
67+
- .gradle/cloudbuild-cache-compressed.tar.gz
68+
- gs://curioswitch-gradle-build-cache/cloudbuild-cache-compressed.tar.gz
69+
env:
70+
- CI=true
71+
- id: curio-generated-build-curio-auth-server-image
72+
waitFor:
73+
- curio-generated-build-all
74+
name: gcr.io/cloud-builders/docker
75+
entrypoint: /bin/bash
76+
args:
77+
- -c
78+
- test -e auth/server/build/docker && docker build --tag=asia.gcr.io/$PROJECT_ID/curio-auth-server --tag=asia.gcr.io/$PROJECT_ID/curio-auth-server:$REVISION_ID auth/server/build/docker || echo Skipping...
79+
env:
80+
- CI=true
81+
- id: curio-generated-push-curio-auth-server-latest
82+
waitFor:
83+
- curio-generated-build-curio-auth-server-image
84+
name: gcr.io/cloud-builders/docker
85+
entrypoint: /bin/bash
86+
args:
87+
- -c
88+
- test -e auth/server/build/docker && docker push asia.gcr.io/$PROJECT_ID/curio-auth-server || echo Skipping...
89+
env:
90+
- CI=true
91+
- id: curio-generated-push-curio-auth-server-revision
92+
waitFor:
93+
- curio-generated-build-curio-auth-server-image
94+
name: gcr.io/cloud-builders/docker
95+
entrypoint: /bin/bash
96+
args:
97+
- -c
98+
- test -e auth/server/build/docker && docker push asia.gcr.io/$PROJECT_ID/curio-auth-server:$REVISION_ID || echo Skipping...
99+
env:
100+
- CI=true
101+
- id: curio-generated-deploy-curio-auth-server
102+
waitFor:
103+
- curio-generated-push-curio-auth-server-latest
104+
name: gcr.io/cloud-builders/kubectl
105+
entrypoint: /bin/bash
106+
args:
107+
- -c
108+
- 'test -e auth/server/build/docker && /builder/kubectl.bash --namespace=auth-dev patch deployment/curio-auth-server-alpha -p ''{"spec": {"template": {"metadata": {"labels": {"revision": "$REVISION_ID" }}}}}'' || echo Skipping...'
109+
env:
110+
- CLOUDSDK_COMPUTE_ZONE=asia-northeast1-a
111+
- CLOUDSDK_CONTAINER_CLUSTER=curioswitch-cluster
112+
- id: curio-generated-build-eggworld-server-image
113+
waitFor:
114+
- curio-generated-build-all
115+
name: gcr.io/cloud-builders/docker
116+
entrypoint: /bin/bash
117+
args:
118+
- -c
119+
- test -e eggworld/server/build/docker && docker build --tag=asia.gcr.io/$PROJECT_ID/eggworld-server --tag=asia.gcr.io/$PROJECT_ID/eggworld-server:$REVISION_ID eggworld/server/build/docker || echo Skipping...
120+
env:
121+
- CI=true
122+
- id: curio-generated-push-eggworld-server-latest
123+
waitFor:
124+
- curio-generated-build-eggworld-server-image
125+
name: gcr.io/cloud-builders/docker
126+
entrypoint: /bin/bash
127+
args:
128+
- -c
129+
- test -e eggworld/server/build/docker && docker push asia.gcr.io/$PROJECT_ID/eggworld-server || echo Skipping...
130+
env:
131+
- CI=true
132+
- id: curio-generated-push-eggworld-server-revision
133+
waitFor:
134+
- curio-generated-build-eggworld-server-image
135+
name: gcr.io/cloud-builders/docker
136+
entrypoint: /bin/bash
137+
args:
138+
- -c
139+
- test -e eggworld/server/build/docker && docker push asia.gcr.io/$PROJECT_ID/eggworld-server:$REVISION_ID || echo Skipping...
140+
env:
141+
- CI=true
142+
- id: curio-generated-deploy-eggworld-server
143+
waitFor:
144+
- curio-generated-push-eggworld-server-latest
145+
name: gcr.io/cloud-builders/kubectl
146+
entrypoint: /bin/bash
147+
args:
148+
- -c
149+
- 'test -e eggworld/server/build/docker && /builder/kubectl.bash --namespace=eggworld-server-dev patch deployment/eggworld-server-alpha -p ''{"spec": {"template": {"metadata": {"labels": {"revision": "$REVISION_ID" }}}}}'' || echo Skipping...'
150+
env:
151+
- CLOUDSDK_COMPUTE_ZONE=asia-northeast1-a
152+
- CLOUDSDK_CONTAINER_CLUSTER=curioswitch-cluster
153+
- id: curio-generated-build-curio-gateway-server-image
154+
waitFor:
155+
- curio-generated-build-all
156+
name: gcr.io/cloud-builders/docker
157+
entrypoint: /bin/bash
158+
args:
159+
- -c
160+
- test -e gateway/server/build/docker && docker build --tag=asia.gcr.io/$PROJECT_ID/curio-gateway-server --tag=asia.gcr.io/$PROJECT_ID/curio-gateway-server:$REVISION_ID gateway/server/build/docker || echo Skipping...
161+
env:
162+
- CI=true
163+
- id: curio-generated-push-curio-gateway-server-latest
164+
waitFor:
165+
- curio-generated-build-curio-gateway-server-image
166+
name: gcr.io/cloud-builders/docker
167+
entrypoint: /bin/bash
168+
args:
169+
- -c
170+
- test -e gateway/server/build/docker && docker push asia.gcr.io/$PROJECT_ID/curio-gateway-server || echo Skipping...
171+
env:
172+
- CI=true
173+
- id: curio-generated-push-curio-gateway-server-revision
174+
waitFor:
175+
- curio-generated-build-curio-gateway-server-image
176+
name: gcr.io/cloud-builders/docker
177+
entrypoint: /bin/bash
178+
args:
179+
- -c
180+
- test -e gateway/server/build/docker && docker push asia.gcr.io/$PROJECT_ID/curio-gateway-server:$REVISION_ID || echo Skipping...
181+
env:
182+
- CI=true
183+
- id: curio-generated-deploy-curio-gateway-server
184+
waitFor:
185+
- curio-generated-push-curio-gateway-server-latest
186+
name: gcr.io/cloud-builders/kubectl
187+
entrypoint: /bin/bash
188+
args:
189+
- -c
190+
- 'test -e gateway/server/build/docker && /builder/kubectl.bash --namespace=curio-gateway-server-dev patch deployment/curio-gateway-server-alpha -p ''{"spec": {"template": {"metadata": {"labels": {"revision": "$REVISION_ID" }}}}}'' || echo Skipping...'
191+
env:
192+
- CLOUDSDK_COMPUTE_ZONE=asia-northeast1-a
193+
- CLOUDSDK_CONTAINER_CLUSTER=curioswitch-cluster

common/google-cloud/core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ sourceCompatibility = '1.8'
3232
targetCompatibility = '1.8'
3333

3434
dependencies {
35-
api 'com.google.api-client:google-api-client:1.23.0'
35+
api 'com.google.api-client:google-api-client:1.24.1'
3636
api 'com.google.guava:guava'
3737
api 'com.linecorp.armeria:armeria'
3838
api 'com.linecorp.armeria:armeria-retrofit2'

common/server/framework/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
# SOFTWARE.
2323
#
2424

25-
version = 0.0.85
25+
version = 0.0.86

common/server/framework/src/main/java/org/curioswitch/common/server/framework/grpc/GrpcGraphUtil.java

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@
2323
*/
2424
package org.curioswitch.common.server.framework.grpc;
2525

26+
import com.google.common.util.concurrent.FutureCallback;
27+
import com.google.common.util.concurrent.Futures;
2628
import com.google.common.util.concurrent.ListenableFuture;
27-
import com.spotify.futures.FuturesExtra;
29+
import com.google.common.util.concurrent.MoreExecutors;
30+
import com.google.protobuf.Message;
2831
import io.grpc.stub.StreamObserver;
32+
import javax.inject.Provider;
33+
import org.checkerframework.checker.nullness.qual.Nullable;
34+
import org.curioswitch.common.server.framework.grpc.GrpcProductionComponent.GrpcProductionComponentBuilder;
2935

3036
/** A utility for using gRPC with producer graphs. */
3137
public final class GrpcGraphUtil {
@@ -35,13 +41,47 @@ public final class GrpcGraphUtil {
3541
* StreamObserver}.
3642
*/
3743
public static <T> void unary(ListenableFuture<T> graphFuture, StreamObserver<T> observer) {
38-
FuturesExtra.addCallback(
44+
Futures.addCallback(
3945
graphFuture,
40-
response -> {
41-
observer.onNext(response);
42-
observer.onCompleted();
46+
new FutureCallback<T>() {
47+
@Override
48+
public void onSuccess(@Nullable T result) {
49+
observer.onNext(result);
50+
observer.onCompleted();
51+
}
52+
53+
@Override
54+
public void onFailure(Throwable t) {
55+
observer.onError(t);
56+
}
57+
},
58+
MoreExecutors.directExecutor());
59+
}
60+
61+
/**
62+
* Invokes a unary {@link GrpcProductionComponent} with the provided request and graph factory.
63+
*/
64+
public static <
65+
G,
66+
Resp extends Message,
67+
C extends GrpcProductionComponent<Resp>,
68+
B extends GrpcProductionComponentBuilder<G, C, B>>
69+
void unary(G graph, StreamObserver<Resp> observer, Provider<B> componentBuilder) {
70+
Futures.addCallback(
71+
componentBuilder.get().graph(graph).build().execute(),
72+
new FutureCallback<Resp>() {
73+
@Override
74+
public void onSuccess(@Nullable Resp result) {
75+
observer.onNext(result);
76+
observer.onCompleted();
77+
}
78+
79+
@Override
80+
public void onFailure(Throwable t) {
81+
observer.onError(t);
82+
}
4383
},
44-
observer::onError);
84+
MoreExecutors.directExecutor());
4585
}
4686

4787
private GrpcGraphUtil() {}

0 commit comments

Comments
 (0)