Skip to content

feat: Publish Local Build Container to Azure Container Registry - [dev to main]#487

Merged
Pavan-Microsoft merged 16 commits into
mainfrom
dev
Jun 12, 2025
Merged

feat: Publish Local Build Container to Azure Container Registry - [dev to main]#487
Pavan-Microsoft merged 16 commits into
mainfrom
dev

Conversation

@Pavan-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces several changes across multiple files to support local builds with Docker, streamline infrastructure deployment, and enhance configuration flexibility. The most significant updates include adding support for a "use local build" flag, refactoring container registry management, and removing unused resources from the infrastructure definition.

Support for Local Builds

  • Added a useLocalBuild parameter to multiple Bicep files (infra/main.bicep, infra/deploy_app_service.bicep, infra/deploy_backend_docker.bicep, infra/deploy_frontend_docker.bicep) to conditionally configure deployments for local Docker builds. This includes setting up role assignments for pulling images from a local Azure Container Registry (ACR). [1] [2] [3]

Container Registry Management

  • Refactored container registry handling by introducing a new deploy_container_registry.bicep file to define the ACR resource. This replaces inline definitions in other files and centralizes ACR creation logic.
  • Updated image references in backend and frontend deployment files to dynamically use either a local or default ACR based on the useLocalBuild flag. [1] [2]

Removal of Unused Resources

  • Removed definitions for unused resources, such as storage accounts, container registries, and role assignments, from infra/deploy_ai_foundry.bicep. This simplifies the infrastructure and eliminates unnecessary components. [1] [2] [3]

Preprovision Hooks

  • Added preprovision hooks in azure.yaml to handle Docker build scripts for both Windows (docker-build.ps1) and POSIX (docker-build.sh) environments. These scripts are executed during deployment to prepare the environment.

Devcontainer Updates

  • Updated the .devcontainer/devcontainer.json file to include the docker-in-docker feature, enabling Docker builds within the development container.

These changes enhance the flexibility and maintainability of the deployment pipeline while improving support for local development workflows.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify docker image pointing to your local image when use_Local_Build environment variable is set to true
image

@Pavan-Microsoft Pavan-Microsoft changed the title feat: Publish Local Build Container to Azure Container Registry feat: Publish Local Build Container to Azure Container Registry - [dev to main] Jun 12, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for local Docker builds via a new useLocalBuild flag, centralizes ACR creation, removes unused infra resources, enhances E2E test reporting, and updates the devcontainer for Docker-in-Docker.

  • Introduce useLocalBuild param in Bicep modules to switch ACR references and role assignments
  • Extract ACR resource into deploy_container_registry.bicep and update build scripts (docker-build.sh/ps1)
  • Enhance pytest HTML reporting in conftest.py and enable Docker DIND in .devcontainer

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/e2e-test/tests/conftest.py Capture per-test logs, rename Duration column, and customize node IDs
tests/e2e-test/testdata/prompts.json Added a new prompt entry
tests/e2e-test/sample_dotenv_file.txt Fixed mismatched quotes
tests/e2e-test/requirements.txt Added beautifulsoup4 dependency
tests/e2e-test/pytest.ini Enabled short tracebacks
tests/e2e-test/pages/HomePage.py Extended page object with citation link methods
infra/scripts/docker-build.sh/.ps1 Added local-build toggle, ACR deploy/login, build & push logic
infra/*.bicep & infra/main.json Added useLocalBuild, dynamic acrName, removed unused resources
infra/deploy_container_registry.bicep New module for ACR creation
azure.yaml Added preprovision hooks to run Docker build scripts
.devcontainer/devcontainer.json Enabled Docker-in-Docker feature

Comment thread infra/main.bicep Outdated
@pytest.hookimpl(tryfirst=True)
def pytest_html_report_title(report):
report.title = "Automation_KM_Generic"
def pytest_runtest_setup(item):

Copilot AI Jun 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Attaching a handler to the root logger may capture unrelated logs. Consider using a dedicated logger instance scoped to this fixture to avoid noise from other modules.

Copilot uses AI. Check for mistakes.
else:
report.description = ""

def pytest_collection_modifyitems(items):

Copilot AI Jun 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Modifying the private attribute item._nodeid can be brittle across Pytest versions. Consider using the public item.name or a reporting hook to adjust the display name.

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +82
def rename_duration_column():
report_path = os.path.abspath("report.html") # or your report filename

Copilot AI Jun 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Hardcoding the report filename may break if the --html option changes; consider retrieving the path from Pytest config or an environment variable.

Suggested change
def rename_duration_column():
report_path = os.path.abspath("report.html") # or your report filename
report_filename = None # Global variable to store the report filename
def pytest_configure(config):
global report_filename
report_filename = config.getoption("--html") # Retrieve the --html option value
def rename_duration_column():
if not report_filename:
print("Report filename not set, skipping column rename.")
return
report_path = os.path.abspath(report_filename)

Copilot uses AI. Check for mistakes.
@Pavan-Microsoft Pavan-Microsoft merged commit e5bb003 into main Jun 12, 2025
10 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.6.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants