Skip to content

Commit e3237a2

Browse files
authored
[3.0] Passed Azure config to toolkit build env. (#14526)
We're adding support for anonymous Azure blob stores in #14494. This change is to help with that work by making the Azure configuration (including login info) exposed during build-time. Since the toolkit requires to be run as root, the user's Azure config is not visible by default, because it's saved under $HOME/.azure and since we're running as root, the home directory is different from the running user's home directory.
1 parent 577658d commit e3237a2

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

toolkit/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ all: toolchain go-tools chroot-tools
201201
# its help will be displayed at the top of the help output.
202202
include $(SCRIPTS_DIR)/help.mk
203203

204+
# Set-up the Azure configuration for the build
205+
include $(SCRIPTS_DIR)/azure_config.mk
206+
204207
# Set up for the timestamp feature
205208
include $(SCRIPTS_DIR)/timestamp.mk
206209

toolkit/scripts/azure_config.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# By default pass original user's Azure configuration if running as root.
5+
# Running as root is required by how the toolkit operates while
6+
# in most cases the user expects to still use their Azure configuration, thus the default.
7+
ifneq ($(SUDO_USER),)
8+
export AZURE_CONFIG_DIR ?= $(shell sudo -u "$(SUDO_USER)" bash -c 'echo $${AZURE_CONFIG_DIR:-$${HOME}/.azure}')
9+
endif

0 commit comments

Comments
 (0)