Skip to content

Commit c145b64

Browse files
authored
Add presubmit tests and fix the cloud run annotation (#92)
* add presubmtit tests * fix cloud run annotation * use the latest tagged release * fix headers * fix integration tests * increase timeout * actually build the runner image * fix tests
1 parent 6a3f87f commit c145b64

8 files changed

Lines changed: 406 additions & 1 deletion
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright 2026 Google LLC
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+
15+
steps:
16+
# Wait for the images to exist
17+
- name: docker:28
18+
id: wait-for-images
19+
entrypoint: "sh"
20+
timeout: 15m
21+
env:
22+
- "_TEST_SERVER_IMAGE=${_TEST_SERVER_IMAGE}"
23+
- "_TEST_RUNNER_IMAGE=${_TEST_RUNNER_IMAGE}"
24+
args:
25+
- -c
26+
- |
27+
while true; do
28+
if docker manifest inspect ${_TEST_SERVER_IMAGE} > /dev/null && docker manifest inspect ${_TEST_RUNNER_IMAGE} > /dev/null; then
29+
echo "Images are available, continuing onto test"
30+
break
31+
else
32+
echo "Images not available yet, will continue to retry"
33+
fi
34+
sleep 5
35+
done
36+
37+
# Clone repo and zip code
38+
- name: gcr.io/cloud-builders/git
39+
entrypoint: 'bash'
40+
args:
41+
- '-c'
42+
- |
43+
git clone https://github.com/GoogleCloudPlatform/opentelemetry-operations-go.git
44+
cd opentelemetry-operations-go
45+
LATEST_TAG=$$(git describe --tags $$(git rev-list --tags --max-count=1))
46+
git checkout $$LATEST_TAG
47+
- name: golang:1.25.5
48+
id: zip-code
49+
entrypoint: /bin/bash
50+
args:
51+
- '-c'
52+
- |
53+
apt-get update && \
54+
apt-get install zip --assume-yes && \
55+
cd opentelemetry-operations-go/e2e-test-server/cloud_functions/ && \
56+
go mod vendor && \
57+
zip -r function-source *
58+
59+
# Run the test
60+
- name: $_TEST_RUNNER_IMAGE
61+
id: run-tests-cloudfunctions
62+
dir: /
63+
timeout: 1800s
64+
env: ["PROJECT_ID=$PROJECT_ID"]
65+
args:
66+
- cloud-functions-gen2
67+
- --runtime=go125
68+
- --functionsource=/workspace/opentelemetry-operations-go/e2e-test-server/cloud_functions/function-source.zip
69+
- --entrypoint=HandleCloudFunction
70+
71+
logsBucket: gs://opentelemetry-ops-e2e-cloud-build-logs
72+
substitutions:
73+
_TEST_RUNNER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-e2e-testing:${SHORT_SHA}
74+
_TEST_SERVER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-go-e2e-test-server:${SHORT_SHA}

cloudbuild-e2e-cloud-run.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2026 Google LLC
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+
15+
steps:
16+
# Wait for the images to exist
17+
- name: docker:28
18+
id: wait-for-images
19+
entrypoint: "sh"
20+
timeout: 15m
21+
env:
22+
- "_TEST_SERVER_IMAGE=${_TEST_SERVER_IMAGE}"
23+
- "_TEST_RUNNER_IMAGE=${_TEST_RUNNER_IMAGE}"
24+
args:
25+
- -c
26+
- |
27+
while true; do
28+
if docker manifest inspect ${_TEST_SERVER_IMAGE} > /dev/null && docker manifest inspect ${_TEST_RUNNER_IMAGE} > /dev/null; then
29+
echo "Images are available, continuing onto test"
30+
break
31+
else
32+
echo "Images not available yet, will continue to retry"
33+
fi
34+
sleep 5
35+
done
36+
37+
# Run the test
38+
- name: $_TEST_RUNNER_IMAGE
39+
id: run-tests-cloudrun
40+
dir: /
41+
timeout: 10m
42+
env: ["PROJECT_ID=$PROJECT_ID"]
43+
args:
44+
- cloud-run
45+
- --image=$_TEST_SERVER_IMAGE
46+
47+
logsBucket: gs://opentelemetry-ops-e2e-cloud-build-logs
48+
substitutions:
49+
_TEST_RUNNER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-e2e-testing:${SHORT_SHA}
50+
_TEST_SERVER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-go-e2e-test-server:${SHORT_SHA}

cloudbuild-e2e-gae-standard.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Copyright 2026 Google LLC
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+
15+
steps:
16+
# Wait for the images to exist
17+
- name: docker:28
18+
id: wait-for-images
19+
entrypoint: "sh"
20+
timeout: 15m
21+
env:
22+
- "_TEST_SERVER_IMAGE=${_TEST_SERVER_IMAGE}"
23+
- "_TEST_RUNNER_IMAGE=${_TEST_RUNNER_IMAGE}"
24+
args:
25+
- -c
26+
- |
27+
while true; do
28+
if docker manifest inspect ${_TEST_SERVER_IMAGE} > /dev/null && docker manifest inspect ${_TEST_RUNNER_IMAGE} > /dev/null; then
29+
echo "Images are available, continuing onto test"
30+
break
31+
else
32+
echo "Images not available yet, will continue to retry"
33+
fi
34+
sleep 5
35+
done
36+
37+
# Clone repo and zip code
38+
- name: gcr.io/cloud-builders/git
39+
entrypoint: 'bash'
40+
args:
41+
- '-c'
42+
- |
43+
git clone https://github.com/GoogleCloudPlatform/opentelemetry-operations-go.git
44+
cd opentelemetry-operations-go
45+
LATEST_TAG=$$(git describe --tags $$(git rev-list --tags --max-count=1))
46+
git checkout $$LATEST_TAG
47+
- name: golang:1.24.2
48+
id: zip-code
49+
entrypoint: /bin/bash
50+
args:
51+
- '-c'
52+
- |
53+
apt-get update && \
54+
apt-get install zip --assume-yes && \
55+
cd opentelemetry-operations-go/e2e-test-server/ && \
56+
go mod vendor && \
57+
zip -r appsource *
58+
59+
# Run the test
60+
- name: $_TEST_RUNNER_IMAGE
61+
id: run-tests-gae-standard
62+
dir: /
63+
timeout: 10m
64+
env: ["PROJECT_ID=$PROJECT_ID"]
65+
args:
66+
- gae-standard
67+
- --runtime=go124
68+
- --appsource=/workspace/opentelemetry-operations-go/e2e-test-server/appsource.zip
69+
70+
logsBucket: gs://opentelemetry-ops-e2e-cloud-build-logs
71+
substitutions:
72+
_TEST_RUNNER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-e2e-testing:${SHORT_SHA}
73+
_TEST_SERVER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-go-e2e-test-server:${SHORT_SHA}

cloudbuild-e2e-gae.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2026 Google LLC
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+
15+
steps:
16+
# Wait for the images to exist
17+
- name: docker:28
18+
id: wait-for-images
19+
entrypoint: "sh"
20+
timeout: 15m
21+
env:
22+
- "_TEST_SERVER_IMAGE=${_TEST_SERVER_IMAGE}"
23+
- "_TEST_RUNNER_IMAGE=${_TEST_RUNNER_IMAGE}"
24+
args:
25+
- -c
26+
- |
27+
while true; do
28+
if docker manifest inspect ${_TEST_SERVER_IMAGE} > /dev/null && docker manifest inspect ${_TEST_RUNNER_IMAGE} > /dev/null; then
29+
echo "Images are available, continuing onto test"
30+
break
31+
else
32+
echo "Images not available yet, will continue to retry"
33+
fi
34+
sleep 5
35+
done
36+
37+
# Run the test
38+
- name: $_TEST_RUNNER_IMAGE
39+
id: run-tests-gae
40+
dir: /
41+
timeout: 10m
42+
env: ["PROJECT_ID=$PROJECT_ID"]
43+
args:
44+
- gae
45+
- --image=$_TEST_SERVER_IMAGE
46+
- --runtime=go125
47+
48+
logsBucket: gs://opentelemetry-ops-e2e-cloud-build-logs
49+
substitutions:
50+
_TEST_RUNNER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-e2e-testing:${SHORT_SHA}
51+
_TEST_SERVER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-go-e2e-test-server:${SHORT_SHA}

cloudbuild-e2e-gce.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2026 Google LLC
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+
15+
steps:
16+
# Wait for the images to exist
17+
- name: docker:28
18+
id: wait-for-images
19+
entrypoint: "sh"
20+
timeout: 15m
21+
env:
22+
- "_TEST_SERVER_IMAGE=${_TEST_SERVER_IMAGE}"
23+
- "_TEST_RUNNER_IMAGE=${_TEST_RUNNER_IMAGE}"
24+
args:
25+
- -c
26+
- |
27+
while true; do
28+
if docker manifest inspect ${_TEST_SERVER_IMAGE} > /dev/null && docker manifest inspect ${_TEST_RUNNER_IMAGE} > /dev/null; then
29+
echo "Images are available, continuing onto test"
30+
break
31+
else
32+
echo "Images not available yet, will continue to retry"
33+
fi
34+
sleep 5
35+
done
36+
37+
# Run the test
38+
- name: $_TEST_RUNNER_IMAGE
39+
id: run-tests-gce
40+
dir: /
41+
timeout: 10m
42+
env: ["PROJECT_ID=$PROJECT_ID"]
43+
args:
44+
- gce
45+
- --image=$_TEST_SERVER_IMAGE
46+
47+
logsBucket: gs://opentelemetry-ops-e2e-cloud-build-logs
48+
substitutions:
49+
_TEST_RUNNER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-e2e-testing:${SHORT_SHA}
50+
_TEST_SERVER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-go-e2e-test-server:${SHORT_SHA}

cloudbuild-e2e-gke.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2026 Google LLC
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+
15+
steps:
16+
# Wait for the images to exist
17+
- name: docker:28
18+
id: wait-for-images
19+
entrypoint: "sh"
20+
timeout: 15m
21+
env:
22+
- "_TEST_SERVER_IMAGE=${_TEST_SERVER_IMAGE}"
23+
- "_TEST_RUNNER_IMAGE=${_TEST_RUNNER_IMAGE}"
24+
args:
25+
- -c
26+
- |
27+
while true; do
28+
if docker manifest inspect ${_TEST_SERVER_IMAGE} > /dev/null && docker manifest inspect ${_TEST_RUNNER_IMAGE} > /dev/null; then
29+
echo "Images are available, continuing onto test"
30+
break
31+
else
32+
echo "Images not available yet, will continue to retry"
33+
fi
34+
sleep 5
35+
done
36+
37+
# Run the test
38+
- name: $_TEST_RUNNER_IMAGE
39+
id: run-tests-gke
40+
dir: /
41+
timeout: 10m
42+
env: ["PROJECT_ID=$PROJECT_ID"]
43+
args:
44+
- gke
45+
- --image=$_TEST_SERVER_IMAGE
46+
47+
logsBucket: gs://opentelemetry-ops-e2e-cloud-build-logs
48+
substitutions:
49+
_TEST_RUNNER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-e2e-testing:${SHORT_SHA}
50+
_TEST_SERVER_IMAGE: us-central1-docker.pkg.dev/${PROJECT_ID}/e2e-testing/opentelemetry-operations-go-e2e-test-server:${SHORT_SHA}

0 commit comments

Comments
 (0)