Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions import-automation/executor/app/executor/import_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,16 @@ def _upload_import_inputs(self, import_dir: str, output_dir: str,
src=manifest_file,
dest=dest,
)
# Copy import-specific validation config file if specified
validation_config_file = import_spec.get('validation_config_file')
if validation_config_file:
val_cfg_src = os.path.join(import_dir, validation_config_file)
if os.path.exists(val_cfg_src):
self._upload_file_helper(
src=val_cfg_src,
dest=
f'{output_dir}/{version}/{os.path.basename(validation_config_file)}',
)
import_inputs = import_spec.get('import_inputs', [])
errors = []
data_size = 0
Expand Down
35 changes: 35 additions & 0 deletions import-automation/validator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2026 Google LLC
#
# 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.

FROM python:3.12-slim

WORKDIR /app

# Install fast uv package installer and dependencies
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY import-automation/validator/requirements.txt /app/requirements.txt
RUN uv pip install --system --no-cache -r /app/requirements.txt

# Copy required tools and utilities directly from the data repo
COPY util/ /app/util/
COPY tools/statvar_importer/ /app/tools/statvar_importer/
COPY tools/import_differ/ /app/tools/import_differ/
COPY tools/import_validation/ /app/tools/import_validation/
COPY import-automation/validator/main.py /app/main.py
COPY import-automation/validator/validator_test.py /app/validator_test.py

ENV PYTHONPATH="/app:/app/util:/app/tools/import_differ:/app/tools/import_validation:/app/tools/statvar_importer"
ENV PYTHONUNBUFFERED=1

ENTRYPOINT ["python", "/app/main.py"]
67 changes: 67 additions & 0 deletions import-automation/validator/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright 2026 Google LLC
#
# 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.
#
# Builds the docker image of import validator, verifies using unit tests,
# and pushes it to artifact registry.
#
# Run it from the data repo root using:
# gcloud builds submit --config=import-automation/validator/cloudbuild.yaml \
# --substitutions=_DOCKER_IMAGE="us-docker.pkg.dev/datcom-ci/gcr.io/dc-import-validator" .

steps:
# Docker Build from data repo root
- name: 'gcr.io/cloud-builders/docker'
id: 'build'
entrypoint: 'bash'
args:
- '-c'
- |
docker build -f import-automation/validator/Dockerfile \
-t ${_DOCKER_IMAGE}:${_TAG} \
-t ${_DOCKER_IMAGE}:latest .
env: ['DOCKER_BUILDKIT=1']

# Docker push to Google Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
id: 'push'
args: ['push', '${_DOCKER_IMAGE}', '--all-tags']

# Run unit tests inside built container
- name: '${_DOCKER_IMAGE}:${_TAG}'
id: 'unit-test'
entrypoint: 'pytest'
args:
- '/app/validator_test.py'
- '/app/tools/import_differ/bigquery_differ_test.py'
- '/app/tools/import_validation/runner_test.py'
waitFor: ['push']

# Tag image as stable and push
- name: 'gcr.io/cloud-builders/docker'
id: 'tag'
entrypoint: 'bash'
waitFor: ['unit-test']
args:
- '-c'
- |
docker tag ${_DOCKER_IMAGE}:${_TAG} ${_DOCKER_IMAGE}:stable \
&& docker push ${_DOCKER_IMAGE}:stable

substitutions:
_DOCKER_IMAGE: 'us-docker.pkg.dev/datcom-ci/gcr.io/dc-import-validator'
_TAG: 'latest'

options:
logging: CLOUD_LOGGING_ONLY
dynamicSubstitutions: true
Loading
Loading