Skip to content

Support cvdr create --num_instances=N with local source flags #277

Support cvdr create --num_instances=N with local source flags

Support cvdr create --num_instances=N with local source flags #277

Workflow file for this run

name: Presubmit
on:
pull_request:
push:
branches-ignore:
- main # push events to main branch occur after PRs are merged, when the same checks were run
jobs:
build-test:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Install dependencies
uses: actions/setup-go@v3
with:
go-version: 1.23.4
- run: go version
- name: Build
run: go build ./...
- name: Test
run: go test -v -coverprofile=coverage.out ./...
- name: Check format
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
- name: Vet
run: go vet ./...
- name: Staticcheck
uses: dominikh/staticcheck-action@v1.3.1
with:
version: "latest"
install-go: false
build-cuttlefish-cvdremote-amd64-debian-package:
runs-on: ubuntu-24.04
container:
image: debian@sha256:9258a75a7e4323c9e5562b361effc84ee747920116d8adfc98a465a5cdc9150e # debian:bookworm-20250407 (amd64)
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Build debian package cuttlefish-cvdremote
uses: ./.github/actions/build-cuttlefish-cvdremote-debian-package
- name: Upload debian package
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # aka v4.0.0
with:
name: cuttlefish-cvdremote-amd64
path: cuttlefish-cvdremote_*.deb
build-cuttlefish-cvdremote-arm64-debian-package:
runs-on: ubuntu-24.04-arm
container:
image: debian@sha256:00cd074b40c4d99ff0c24540bdde0533ca3791edcdac0de36d6b9fb3260d89e2 # debian:bookworm-20250407 (arm64/v8)
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Build debian package cuttlefish-cvdremote
uses: ./.github/actions/build-cuttlefish-cvdremote-debian-package
- name: Upload debian package
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # aka v4.0.0
with:
name: cuttlefish-cvdremote-arm64
path: cuttlefish-cvdremote_*.deb
build-cuttlefish-cloud-orchestrator-amd64-docker-image:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Build docker image
run: docker build -t cuttlefish-cloud-orchestrator .
- name: Save docker image
run: docker save --output cuttlefish-cloud-orchestrator.tar cuttlefish-cloud-orchestrator
- name: Publish docker image
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # aka v4.0.0
with:
name: cuttlefish-cloud-orchestrator-amd64
path: cuttlefish-cloud-orchestrator.tar
build-cuttlefish-cloud-orchestrator-arm64-docker-image:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Build docker image
run: docker build -t cuttlefish-cloud-orchestrator .
- name: Save docker image
run: docker save --output cuttlefish-cloud-orchestrator.tar cuttlefish-cloud-orchestrator
- name: Publish docker image
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # aka v4.0.0
with:
name: cuttlefish-cloud-orchestrator-arm64
path: cuttlefish-cloud-orchestrator.tar
e2e-test-cvdr-with-on-premise-cloud-orchestrator:
runs-on: ubuntu-24.04
needs: [build-cuttlefish-cloud-orchestrator-amd64-docker-image, build-cuttlefish-cvdremote-amd64-debian-package]
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Download cuttlefish-orchestration
run: |
IMAGE_TAG="us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration:nightly"
docker pull ${IMAGE_TAG}
echo "orchestration_image_tag=${IMAGE_TAG}" >> $GITHUB_ENV
- name: Download cuttlefish-cloud-orchestrator
uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # aka v4.0.0
with:
name: cuttlefish-cloud-orchestrator-amd64
- name: Load and run cuttlefish-cloud-orchestrator
run: |
docker load --input cuttlefish-cloud-orchestrator.tar
sed -i "s|DockerImageName = .*|DockerImageName = \"${{ env.orchestration_image_tag }}\"|g" \
scripts/on-premises/single-server/conf.toml
docker run -d \
-p 8080:8080 \
-e CONFIG_FILE="/conf.toml" \
-v $PWD/scripts/on-premises/single-server/conf.toml:/conf.toml \
-v /var/run/docker.sock:/var/run/docker.sock \
-t cuttlefish-cloud-orchestrator
- name: Download cuttlefish-cvdremote
uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # aka v4.0.0
with:
name: cuttlefish-cvdremote-amd64
- name: Install cuttlefish-cvdremote
run: sudo apt-get install -y ./cuttlefish-cvdremote_*.deb
- name: Install bazel
run: |
sudo apt-get update && sudo apt-get install -y apt-transport-https curl gnupg
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
mv bazel-archive-keyring.gpg /usr/share/keyrings
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt-get update && sudo apt-get install -y bazel zip unzip
- name: Install adb
run: |
sudo apt-get install adb
adb devices
- name: Run E2E tests
id: run_e2e_tests
continue-on-error: true
run: |
cd e2etests
# TODO(b/383428636): Running E2E tests in parallel requires enabling
# vhost-user-vsock. Though we enabled vhost-user-vsock on ARM64, nested
# virtualization is not supported on any ARM64 Github runners.
bazel test //cvdr/... \
--local_test_jobs=1 \
--show_timestamps \
--test_env=CVDR_PATH=$(which cvdr) \
--test_env=CVDR_CONFIG_PATH=$(realpath -s ../scripts/on-premises/single-server/cvdr.toml) \
--test_output=errors
- name: Log of cloud orchestrator with error
if: ${{ steps.run_e2e_tests.outcome == 'failure' }}
run: |
docker logs $(docker ps -q --filter ancestor=cuttlefish-cloud-orchestrator)
# Make this job as failure, when this job executes this step. This step
# exists for printing error logs of Cloud Orchestrator when E2E tests
# are failed.
exit 1