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
20 changes: 20 additions & 0 deletions .github/workflows/run-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,26 @@ jobs:
echo "${YQ_SHA256} yq.exe" | sha256sum --check
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"

- name: Install the buildx plugin
# Without buildx, the docker CLI of the Windows runner image builds with the legacy builder. With the
# containerd image store of Docker Engine 29, that builder skips downloading a base image layer whose
# content another image already unpacked, and `docker push` then fails with "content digest ...: not
# found": the emulator image holds the Debian layer of python:3.13-slim under another digest. BuildKit,
# which Docker Desktop and the Linux runner build with, downloads every layer of the image it stores.
# The release and its SHA-256 are pinned.
if: matrix.os == 'windows'
env:
BUILDX_VERSION: v0.38.2
BUILDX_SHA256: 9a6aca9c84adda0391d1d98d8b74b49359cad1bcdadd196a0a5d7d5dc4cf15e0
run: |
plugins="${DOCKER_CONFIG:-$HOME/.docker}/cli-plugins"
mkdir -p "$plugins"
cd "$plugins"
curl --silent --show-error --fail --location --retry 3 --output docker-buildx.exe \
"https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.windows-amd64.exe"
echo "${BUILDX_SHA256} docker-buildx.exe" | sha256sum --check
docker buildx version

- name: Put psql on the PATH
# The PostgreSQL and App Configuration samples seed their databases with psql, which comes with the
# PostgreSQL the Windows runner image installs off the PATH; the Linux runner image has it on the PATH
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ A name or an ID read from `az ... --output tsv` then carries an invisible `\r`,
`set -o igncr` makes these shells drop carriage returns from `$(...)` and `read`, and `export SHELLOPTS` passes the option on to the scripts you start.
`mapfile` keeps them even then, so the scripts that fill an array from the Azure CLI strip them with `tr -d '\r'`.

Build the sample images with BuildKit, the builder Docker Desktop uses by default.
A Windows `docker` CLI without the buildx plugin, for example one that drives a Docker Engine in WSL, falls back to the legacy builder.
With the containerd image store of Docker Engine 29, that builder does not download a base image layer whose content another image, such as the emulator's, already unpacked, and `04-push-docker-image.sh` then fails with `content digest sha256:...: not found`.
Install the [buildx plugin](https://github.com/docker/buildx#installing) and build the image again.

Tips:

- To apply these settings in every new Git Bash window, add the three lines to `~/.bash_profile`, or to `~/.bashrc` if your `.bash_profile` sources it.
Expand Down
2 changes: 1 addition & 1 deletion terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The Terraform configuration uses two providers: [azurerm](https://registry.terra

| Variable | Value |
| -------- | ----- |
| `metadata_host` | `localhost.localstack.cloud:4566`, from which azurerm discovers every endpoint |
| `metadata_host` | The host and port of the Resource Manager endpoint the Azure CLI targets (`azure.localhost.localstack.cloud:4566` with lstk), from which azurerm discovers every endpoint |
| `resource_manager_endpoint` | `az cloud show --query endpoints.resourceManager`, for AzAPI, which has no metadata discovery |
| `subscription_id`, `tenant_id`, `client_id`, `client_secret` | The emulator's placeholder credentials |
| `gateway_api_enabled` | `false`, see [LocalStack emulator notes](#localstack-emulator-notes) |
Expand Down
5 changes: 4 additions & 1 deletion terraform/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ SSH_PUBLIC_KEY_FILE="${SSH_PUBLIC_KEY_FILE:-$HOME/.ssh/id_rsa.pub}"
# The windows_admin_password variable reads it from the environment
export TF_VAR_windows_admin_password="${WINDOWS_ADMIN_PASSWORD:-Trustno123456!}"
EMULATOR_GUID="00000000-0000-0000-0000-000000000000"
EMULATOR_METADATA_HOST="localhost.localstack.cloud:4566"
CURRENT_DIR="$(cd "$(dirname "$0")" && pwd)"

# Check prerequisites
Expand All @@ -44,6 +43,10 @@ cd "$CURRENT_DIR" || exit
RESOURCE_MANAGER_ENDPOINT=$(az cloud show --query endpoints.resourceManager --output tsv --only-show-errors | tr -d '\r')
if [[ $RESOURCE_MANAGER_ENDPOINT == *localhost* || $RESOURCE_MANAGER_ENDPOINT == *localstack* ]]; then
IS_EMULATOR=1
# azurerm discovers every endpoint from the metadata host: the host and port of this endpoint, because the emulator
# serves Azure only on its own Azure host (azure.localhost.localstack.cloud:4566 with lstk), not on localhost.localstack.cloud
EMULATOR_METADATA_HOST=${RESOURCE_MANAGER_ENDPOINT#*://}
EMULATOR_METADATA_HOST=${EMULATOR_METADATA_HOST%%/*}
echo "The Azure CLI targets the LocalStack for Azure emulator at [$RESOURCE_MANAGER_ENDPOINT]"
else
IS_EMULATOR=0
Expand Down
5 changes: 3 additions & 2 deletions terraform/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ terraform {

# Dual-target configuration: every identity field defaults to null (Azure CLI auth
# against real Azure). deploy.sh passes the LocalStack values when targeting the
# emulator: metadata_host=localhost.localstack.cloud:4566, all-zero GUIDs for
# subscription/tenant/client, and the placeholder client secret.
# emulator: metadata_host=azure.localhost.localstack.cloud:4566 (the host of the
# Azure CLI's Resource Manager endpoint), all-zero GUIDs for subscription/tenant/
# client, and the placeholder client secret.
provider "azurerm" {
features {
resource_group {
Expand Down
5 changes: 4 additions & 1 deletion tutorials/terraform/tags-labels-taints/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ GATEWAY_API_ENABLED=1
# the emulator has no global vault-name uniqueness so it keeps the short one.
REAL_KEY_VAULT_NAME='local-kv-ciao-local'
EMULATOR_KEY_VAULT_NAME='local-kv-test'
EMULATOR_METADATA_HOST='localhost.localstack.cloud:4566'
EMULATOR_GUID='00000000-0000-0000-0000-000000000000'
AKS_FEATURES=("ManagedGatewayAPIPreview")
SSH_KEY_FILE="$HOME/.ssh/id_rsa.pub"
Expand All @@ -38,6 +37,10 @@ RESOURCE_MANAGER_ENDPOINT=$(az cloud show --query endpoints.resourceManager --ou
IS_EMULATOR=0
if [[ "$RESOURCE_MANAGER_ENDPOINT" == *localhost* || "$RESOURCE_MANAGER_ENDPOINT" == *localstack* ]]; then
IS_EMULATOR=1
# azurerm discovers every endpoint from the metadata host: the host and port of this endpoint, because the emulator
# serves Azure only on its own Azure host (azure.localhost.localstack.cloud:4566 with lstk), not on localhost.localstack.cloud
EMULATOR_METADATA_HOST=${RESOURCE_MANAGER_ENDPOINT#*://}
EMULATOR_METADATA_HOST=${EMULATOR_METADATA_HOST%%/*}
echo "Detected LocalStack Azure emulator at [$RESOURCE_MANAGER_ENDPOINT]"
else
echo "Detected real Azure ([$RESOURCE_MANAGER_ENDPOINT])"
Expand Down
5 changes: 3 additions & 2 deletions tutorials/terraform/tags-labels-taints/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ terraform {

# Dual-target configuration: every identity field defaults to null (Azure CLI auth
# against real Azure). deploy.sh passes the LocalStack values when targeting the
# emulator: metadata_host=localhost.localstack.cloud:4566, all-zero GUIDs for
# subscription/tenant/client, and the placeholder client secret.
# emulator: metadata_host=azure.localhost.localstack.cloud:4566 (the host of the
# Azure CLI's Resource Manager endpoint), all-zero GUIDs for subscription/tenant/
# client, and the placeholder client secret.
provider "azurerm" {
features {
resource_group {
Expand Down
2 changes: 1 addition & 1 deletion tutorials/terraform/tags-labels-taints/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# --- Provider / target selection --------------------------------------------------

variable "metadata_host" {
description = "(Optional) Specifies the Azure metadata host. Set to localhost.localstack.cloud:4566 to target the LocalStack emulator; leave null for real Azure."
description = "(Optional) Specifies the Azure metadata host. Set to azure.localhost.localstack.cloud:4566 to target the LocalStack emulator; leave null for real Azure."
type = string
default = null
}
Expand Down