Skip to content

s4heid/bosh-azure-stemcell-mirror

Repository files navigation

bosh-azure-stemcell-mirror

Tests Open in Dev Containers

This repository contains an Azure Function that mirrors BOSH stemcells from bosh.io to an Azure Compute Gallery of your choice.

Architecture

sequenceDiagram
    participant User
    participant StemcellMirror as StemcellMirror.run()
    participant BoshIO as bosh.io
    participant Storage as Azure Storage Account
    participant Gallery as Azure Compute Gallery

    User->>StemcellMirror: Invoke
    StemcellMirror->>Gallery: gallery_image_version_exists?
    alt VersionExists
        StemcellMirror->>User: No new stemcell required
    else NoVersionFound
        StemcellMirror->>BoshIO: Download latest stemcell (tgz)
        StemcellMirror->>StemcellMirror: Extract .vhd from tgz
        StemcellMirror->>Storage: Upload root.vhd
        StemcellMirror->>Gallery: check_or_create_gallery_image
        StemcellMirror->>Gallery: create_gallery_image_version
    end
    StemcellMirror->>User: Completed stemcell check
Loading

Deployment

  1. Get an Azure Subscription
  2. Log-in to your Azure subscription using azd auth login.
  3. Run azd up to provision your infrastructure and deploy to Azure (or run azd provision then azd deploy to accomplish the tasks separately).

Development

  1. Configure a Python virtual environment using venv or your tool of choice.

    python -m venv .venv
    source ./.venv/bin/activate
  2. Install the required Python packages:

    python -m pip install -r requirements.txt
  3. Run the unit tests:

    python -m unittest discover tests

Related Topics