Commit 74206d8
refactor(compile): detect az at pipeline time so missing azure-cli no longer crashes 1ES
Reviewer-requested fix: static AWF bind-mounts for /opt/az and /usr/bin/az
would break `docker run` on runners without azure-cli pre-installed (notably
some 1ES self-hosted pools), failing the pipeline before the agent ever
started.
Replace the static mounts with a runtime detection prepare step that sets
the ADO pipeline variable AW_AZ_MOUNTS via `##vso[task.setvariable]` when
both /usr/bin/az and /opt/az exist on the host, or emits a `task.logissue`
warning and leaves the variable unset otherwise.
The AWF invocation in the compiled YAML now includes a single
`$(AW_AZ_MOUNTS) \` line in the --mount chain. ADO interpolates the variable
at step start: present -> the two --mount args appear; absent -> the line
collapses to whitespace. No new trait method is added; only the existing
`prepare_steps` hook is used.
- AzureCliExtension: required_awf_mounts() now returns []; prepare_steps()
emits the detection bash step
- generate_awf_mounts: appends `$(AW_AZ_MOUNTS) \` when AzureCli is present
- Tests: rewrite static-mount assertions to assert the detection step + the
pipeline variable injection, plus a regression guard that no static az
mount is emitted
- Docs: docs/network.md and docs/tools.md updated with the runtime-detection
design and operator implications
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 1b641ee commit 74206d8
6 files changed
Lines changed: 356 additions & 96 deletions
File tree
- docs
- src/compile
- extensions
- tests
- safe-outputs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
66 | 102 | | |
67 | 103 | | |
68 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
103 | 122 | | |
104 | 123 | | |
105 | 124 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
109 | 128 | | |
110 | 129 | | |
111 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2909 | 2909 | | |
2910 | 2910 | | |
2911 | 2911 | | |
2912 | | - | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
2913 | 2925 | | |
2914 | 2926 | | |
2915 | 2927 | | |
2916 | | - | |
| 2928 | + | |
2917 | 2929 | | |
2918 | 2930 | | |
2919 | | - | |
2920 | | - | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
2921 | 2939 | | |
2922 | 2940 | | |
2923 | 2941 | | |
| |||
6779 | 6797 | | |
6780 | 6798 | | |
6781 | 6799 | | |
6782 | | - | |
6783 | | - | |
6784 | | - | |
| 6800 | + | |
| 6801 | + | |
| 6802 | + | |
| 6803 | + | |
| 6804 | + | |
6785 | 6805 | | |
6786 | 6806 | | |
6787 | 6807 | | |
6788 | 6808 | | |
6789 | 6809 | | |
6790 | | - | |
6791 | | - | |
| 6810 | + | |
| 6811 | + | |
| 6812 | + | |
6792 | 6813 | | |
6793 | 6814 | | |
6794 | | - | |
6795 | | - | |
| 6815 | + | |
| 6816 | + | |
| 6817 | + | |
6796 | 6818 | | |
6797 | 6819 | | |
6798 | 6820 | | |
| |||
0 commit comments