# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
TFCI_DOCKER_ENABLE=1
TFCI_DOCKER_PULL_ENABLE=1
TFCI_DOCKER_IMAGE="gcr.io/tensorflow-testing/tf-win2022@sha256:915cb093630432c38b028f56bd31116a5559ebbc688d427b6092d86828ae03bc"
TFCI_BAZEL_BAZELRC_ARGS="--output_user_root=C:/t"
TFCI_BAZEL_COMMON_ARGS="--repo_env=HERMETIC_PYTHON_VERSION=$TFCI_PYTHON_VERSION --repo_env=USE_PYWRAP_RULES=True --config=windows_x86_cpu_2022"
TFCI_BAZEL_TARGET_SELECTING_CONFIG_PREFIX=windows_x86_cpu_2022
TFCI_BUILD_PIP_PACKAGE_WHEEL_NAME_ARG="--repo_env=WHEEL_NAME=tensorflow"
TFCI_BUILD_PIP_PACKAGE_ADDITIONAL_WHEEL_NAMES="tensorflow_cpu"
TFCI_OUTPUT_DIR=build_output
TFCI_FIND_BIN=C:/tools/msys64/usr/bin/find.exe
TFCI_LIB_SUFFIX="-cpu-windows-x86_64"
# auditwheel is not supported for Windows
TFCI_WHL_AUDIT_ENABLE=0
TFCI_WHL_AUDIT_PLAT=0
# Tests are extremely slow at the moment
TFCI_WHL_BAZEL_TEST_ENABLE=0
TFCI_WHL_SIZE_LIMIT=450M
TFCI_WHL_SIZE_LIMIT_ENABLE=1
TFCI_WHL_IMPORT_TEST_ENABLE=1
TFCI_PYTHON_VERIFY_PIP_INSTALL_ARGS=""

# Used to simulate a T:\ drive within the container, to a limited extent,
# via a symlink.
# Helpful since the internal CI utilizes a T:\ drive, part of which is mounted
# to the container, and would result in C:\<path> != T:\<path> mismatches,
# when using variables like `TFCI_OUTPUT_DIR` in `docker exec commands,
# requiring conditional path adjustments throughout the CI scripts.
# Note: This does not work for `docker cp` commands.
# For a little more detail, see:
# https://github.com/tensorflow/tensorflow/blob/cc3006af6fea8d2a1360b3b5e65f9d14bbdb7094/ci/devinfra/docker/windows2022/Dockerfile#L196
TFCI_OUTPUT_WIN_DOCKER_DIR='C:/drive_t'

# Docker on Windows doesn't support the `host` networking mode, and so
# port-forwarding is required for the container to detect it's running on GCE.
export IP_ADDR=$(powershell -command "(Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias 'vEthernet (nat)').IPAddress")
netsh interface portproxy add v4tov4 listenaddress=$IP_ADDR listenport=80 connectaddress=169.254.169.254 connectport=80
# A local firewall rule for the container is added in
# ci/official/utilities/setup_docker.sh.
