Skip to content

Commit b67b7f8

Browse files
darrentuDarren Tu
andauthored
Az.Tools.Predictor in PowerShell (#266)
* Add Predictor * update az tools predictor * Change color of InLinePrediction * update CI name and checkout version Co-authored-by: Darren Tu <[email protected]>
1 parent 5425970 commit b67b7f8

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

.github/workflows/blank.yml renamed to .github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
# Steps represent a sequence of tasks that will be executed as part of the job
2626
steps:
2727
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
28-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v3
2929

3030
# Build base dockerfile
3131
- name: Build the base.Dockerfile

linux/powershell/PSCloudShellStartup.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ $script:CloudEnvironmentMap = @{
2121
dogfood = 'dogfood'
2222
}
2323

24+
# For the Az.Tools.Predictor
25+
PSReadline\Set-PSReadLineOption -Colors @{ InLinePrediction = '#8d8d8d'}
26+
Microsoft.PowerShell.Core\Import-Module Az.Tools.Predictor -Force
27+
2428
# Using the new set of az cmdlets
2529
Microsoft.PowerShell.Core\Import-Module Az.Accounts
2630
Az.Accounts\Enable-AzureRmAlias

linux/powershell/setupPowerShell.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ try {
137137
PowerShellGet\Install-Module -Name AzurePSDrive @prodAllUsers
138138
PowerShellGet\Install-Module -Name GuestConfiguration -MaximumVersion $script:dockerfileDataObject.GuestConfigurationMaxVersion -ErrorAction SilentlyContinue @prodAllUsers
139139
PowerShellGet\Install-Module -Name Microsoft.PowerShell.UnixCompleters @prodAllUsers
140-
PowerShellGet\Install-Module -AllowPreRelease -Force PSReadLine -Repository PSGallery # get psreadline beta
141-
PowerShellGet\Install-Module -Name Az.Tools.Predictor -Repository PSGallery
140+
PowerShellGet\Install-Module -Force PSReadLine @prodAllUsers
141+
PowerShellGet\Install-Module -Name Az.Tools.Predictor @prodAllUsers
142142
PowerShellGet\Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.5 -Force
143143
PowerShellGet\Install-Module -Name Microsoft.PowerShell.SecretManagement @prodAllUsers
144144
PowerShellGet\Install-Module -Name Microsoft.PowerShell.SecretStore @prodAllUsers

linux/tools.Dockerfile

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ RUN bash ./tdnfinstall.sh gh
3737
RUN mkdir -p /usr/cloudshell
3838
WORKDIR /usr/cloudshell
3939

40+
# Install Office 365 CLI templates
41+
RUN npm install -q -g @pnp/cli-microsoft365
42+
43+
# Install Bicep CLI
44+
RUN curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 \
45+
&& chmod +x ./bicep \
46+
&& mv ./bicep /usr/local/bin/bicep \
47+
&& bicep --help
48+
49+
# Temp: fix ansible modules. Proper fix is to update base layer to use regular python for Ansible.
50+
RUN wget -nv -q https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt \
51+
&& /opt/ansible/bin/python -m pip install -r /usr/share/ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt
52+
4053
# Copy and run script to Install powershell modules and setup Powershell machine profile
4154
COPY ./linux/powershell/PSCloudShellUtility/ /usr/local/share/powershell/Modules/PSCloudShellUtility/
4255
COPY ./linux/powershell/ powershell
@@ -45,21 +58,12 @@ RUN /usr/bin/pwsh -File ./powershell/setupPowerShell.ps1 -image Top && rm -rf ./
4558
# install powershell warmup script
4659
COPY ./linux/powershell/Invoke-PreparePowerShell.ps1 linux/powershell/Invoke-PreparePowerShell.ps1
4760

48-
# Install Office 365 CLI templates
49-
RUN npm install -q -g @pnp/cli-microsoft365
5061

51-
# Install Bicep CLI
52-
RUN curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 \
53-
&& chmod +x ./bicep \
54-
&& mv ./bicep /usr/local/bin/bicep \
55-
&& bicep --help
5662

5763
# Remove su so users don't have su access by default.
5864
RUN rm -f ./linux/Dockerfile && rm -f /bin/su
5965

60-
# Temp: fix ansible modules. Proper fix is to update base layer to use regular python for Ansible.
61-
RUN wget -nv -q https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt \
62-
&& /opt/ansible/bin/python -m pip install -r /usr/share/ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt
66+
6367

6468
#Add soft links
6569
RUN ln -s /usr/bin/python3 /usr/bin/python

0 commit comments

Comments
 (0)