Skip to content

Commit

Permalink
Use bazel ci config when CI env_var is set
Browse files Browse the repository at this point in the history
Change-Id: I9c6ae298d38ad71e4940093672021a4bddc6e7a5
  • Loading branch information
jblebrun committed May 20, 2024
1 parent 7a46943 commit 97dbcea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# - https://github.com/casey/just
# - https://just.systems/man/en/

export BAZEL_CONFIG_FLAG := if env_var_or_default('CI', '') == "" { "" } else { "--config=ci" }

key_xor_test_app: (build_enclave_app "key_xor_test_app")
oak_echo_enclave_app: (build_enclave_app "oak_echo_enclave_app")
oak_echo_raw_enclave_app: (build_enclave_app "oak_echo_raw_enclave_app")
Expand Down Expand Up @@ -87,6 +89,7 @@ oak_containers_kernel:
oak_containers_kernel/target/bzImage

oak_containers_system_image: oak_containers_orchestrator oak_containers_syslogd
echo "Using bazel config flag: $BAZEL_CONFIG_FLAG"
# Copy dependencies into bazel build.
mkdir --parents oak_containers_system_image/target/image_binaries
cp --preserve=timestamps \
Expand All @@ -96,7 +99,7 @@ oak_containers_system_image: oak_containers_orchestrator oak_containers_syslogd
oak_containers_syslogd/target/oak_containers_syslogd_patched \
oak_containers_system_image/target/image_binaries/oak_containers_syslogd
# Build and compress.
bazel build oak_containers_system_image
bazel build $BAZEL_CONFIG_FLAG oak_containers_system_image --build_tag_filters=+noci
cp --preserve=timestamps \
bazel-bin/oak_containers_system_image/oak_containers_system_image.tar \
oak_containers_system_image/target/image.tar
Expand Down Expand Up @@ -130,7 +133,8 @@ oak_containers_hello_world_container_bundle_tar:
env --chdir=oak_containers_hello_world_container DOCKER_BUILDKIT=0 bash build_container_bundle

cc_oak_containers_hello_world_container_bundle_tar:
env bazel build -c opt //cc/containers/hello_world_trusted_app:bundle.tar
echo "Using bazel config flag: $BAZEL_CONFIG_FLAG"
env bazel build $BAZEL_CONFIG_FLAG --compilation_mode opt //cc/containers/hello_world_trusted_app:bundle.tar

oak_containers_hello_world_untrusted_app:
env cargo build --release --package='oak_containers_hello_world_untrusted_app'
Expand Down Expand Up @@ -163,7 +167,7 @@ kokoro_run_tests: all_ensure_no_std
RUST_LOG="debug" cargo nextest run --all-targets --hide-progress-bar --workspace --exclude='oak_containers_hello_world_untrusted_app'

clang-tidy:
bazel build --config=clang-tidy //cc/...
bazel build $BAZEL_CONFIG_FLAG --config=clang-tidy //cc/...

bare_metal_crates := "//oak_linux_boot_params //oak_channel //oak_core //oak_virtio //third_party/rust-hypervisor-firmware-virtio"

Expand Down
2 changes: 2 additions & 0 deletions scripts/docker_run
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ mkdir -p './cargo-cache'
docker_run_flags=(
'--rm'
'--tty'
'--env=CI'
'--env=KOKORO_ARTIFACTS_DIR'
'--env=TERM=xterm-256color'
'--env=OAK_KVM_TESTS'
'--env=RUST_BACKTRACE'
Expand Down

0 comments on commit 97dbcea

Please sign in to comment.