Skip to content

Commit 14b538c

Browse files
authoredJan 21, 2023
Add Startup Script of Compute Engine (project-chip#24562)
1 parent cfde7c6 commit 14b538c

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
 

‎integrations/compute_engine/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Startup Script of Compute Engine
2+
3+
A startup script is a file that contains commands that run when a virtual
4+
machine instance boots. Compute Engine provides support for running startup
5+
scripts on Linux and Windows virtual machines.
6+
7+
### Create a virtual machine instance using startup script
8+
9+
The `startup-script.sh` could be used as the startup script of a virtual machine
10+
instance which run Matter coverage report and publish the result via an App
11+
Engine service.
12+
13+
You can create a virtual machine instance by using the gcloud compute instances
14+
create command with the `--metadata-from-file` flag.
15+
16+
```
17+
gcloud compute instances create VM_NAME \
18+
--image-project=PROJECT_NAME \
19+
--image-family=ubuntu-22.04 \
20+
--metadata-from-file=startup-script=FILE_PATH
21+
```
22+
23+
Replace the following:
24+
25+
`PROJECT_NAME`: the name of the project host the virtual machine instance
26+
27+
`VM_NAME`: the name of the virtual machine instance
28+
29+
`FILE_PATH`: the relative path to the startup script file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright (c) 2023 Project CHIP Authors
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
cd /tmp
20+
rm -rf connectedhomeip
21+
git clone --recurse-submodules https://github.com/project-chip/connectedhomeip.git
22+
cd connectedhomeip
23+
./scripts/build_coverage.sh 2>&1 | tee /tmp/matter_build.log
24+
cd out/coverage/coverage
25+
gcloud app deploy webapp_config.yaml 2>&1 | tee /tmp/matter_publish.log
26+
versions=$(gcloud app versions list \
27+
--service default \
28+
--sort-by '~VERSION.ID' \
29+
--format 'value(VERSION.ID)' | sed 1,5d)
30+
for version in "$versions"; do
31+
gcloud app versions delete "$version" \
32+
--service default \
33+
--quiet
34+
done

0 commit comments

Comments
 (0)
Please sign in to comment.