Skip to content

Commit 3a7656d

Browse files
authored
Run tests in 1ES Hosted Confidential ACI Pool (#6653)
1 parent 0e57987 commit 3a7656d

File tree

5 files changed

+70
-6
lines changed

5 files changed

+70
-6
lines changed

.github/workflows/ci.yml

+46
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,49 @@ jobs:
167167
# All other acceptably fast tests, which are now supported on Azure Linux.
168168
./tests.sh --timeout 360 --output-on-failure -LE "benchmark|suite|unit"
169169
shell: bash
170+
171+
build_caci:
172+
name: "Confidential Container (ACI) CI"
173+
runs-on: [self-hosted, 1ES.Pool=gha-caci-ne]
174+
needs: checks
175+
176+
steps:
177+
- uses: actions/checkout@v4
178+
with:
179+
fetch-depth: 0
180+
181+
- name: "Build Debug"
182+
run: |
183+
set -ex
184+
git config --global --add safe.directory /__w/CCF/CCF
185+
mkdir build
186+
cd build
187+
cmake -GNinja -DCOMPILE_TARGET=snp -DCMAKE_BUILD_TYPE=Debug ..
188+
ninja
189+
shell: bash
190+
191+
- name: "Tests"
192+
run: |
193+
set -ex
194+
cd build
195+
rm -rf /github/home/.cache
196+
mkdir -p /github/home/.cache
197+
export ASAN_SYMBOLIZER_PATH=$(realpath /usr/bin/llvm-symbolizer-15)
198+
# Unit tests, minus indexing that is sometimes timing out with this few cores
199+
./tests.sh --output-on-failure -L unit -j$(nproc --all) -E indexing
200+
# Minimal end to end test that exercises SNP attestation verification
201+
# but works within the current 4 core budget
202+
./tests.sh --timeout 360 --output-on-failure -R code_update
203+
shell: bash
204+
205+
- name: "Upload logs"
206+
uses: actions/upload-artifact@v4
207+
with:
208+
name: logs-caci-snp
209+
path: |
210+
build/workspace/*/*.config.json
211+
build/workspace/*/out
212+
build/workspace/*/err
213+
build/workspace/*.ledger/*
214+
if-no-files-found: ignore
215+
if: success() || failure()

.snpcc_canary

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
(. =) Y (0 0) (x X) Y (___)
33
O \ o | / |
44
/-xXx--//-----x=x--/-xXx--/---x-/--->>>--/
5-
....
5+
......

docker/ccf_caci_ci

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM mcr.microsoft.com/azurelinux/base/core:3.0
2+
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
3+
RUN gpg --import /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY
4+
RUN tdnf -y update
5+
RUN tdnf -y install ca-certificates git
6+
RUN tdnf -y install wget tar dotnet-sdk-8.0
7+
ENV RUNNER_ALLOW_RUNASROOT=true
8+
9+
COPY scripts/setup-ci.sh /tmp/setup-ci.sh
10+
RUN chmod +x /tmp/setup-ci.sh
11+
RUN /tmp/setup-ci.sh

src/ds/test/work_beacon.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ size_t run_jobs(size_t n_senders, size_t n_receivers)
158158

159159
TEST_CASE("WorkBeacon" * doctest::test_suite("workbeacon"))
160160
{
161-
std::vector<size_t> test_vals{1, 5, 8};
161+
std::vector<size_t> test_vals{1, 5};
162162
for (auto n_senders : test_vals)
163163
{
164164
for (auto n_receivers : test_vals)

tests/infra/snp.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os
55
import base64
6+
import glob
67
from hashlib import sha256
78

89
# Path to the SEV guest device on patched 5.x kernels
@@ -45,10 +46,16 @@ def is_snp():
4546

4647
def get_aci_env():
4748
env = {}
48-
with open(WELL_KNOWN_ACI_ENVIRONMENT_FILE_PATH, "r", encoding="utf-8") as f:
49-
for line in f.read().splitlines():
50-
env_key, env_value = line.partition("=")[::2]
51-
env[env_key] = env_value
49+
# If the well-known file exists, read the environment variables from it
50+
# Otherwise, try to discover the security context directory
51+
if os.path.exists(WELL_KNOWN_ACI_ENVIRONMENT_FILE_PATH):
52+
with open(WELL_KNOWN_ACI_ENVIRONMENT_FILE_PATH, "r", encoding="utf-8") as f:
53+
for line in f.read().splitlines():
54+
env_key, env_value = line.partition("=")[::2]
55+
env[env_key] = env_value
56+
else:
57+
(security_context_dir,) = glob.glob("/security-context-*")
58+
env[ACI_SEV_SNP_ENVVAR_UVM_SECURITY_CONTEXT_DIR] = security_context_dir
5259
return env
5360

5461

0 commit comments

Comments
 (0)