Skip to content

Commit

Permalink
Merge pull request #17746 from Azure/main
Browse files Browse the repository at this point in the history
[Do not squash] sync network branch with main
  • Loading branch information
wyunchi-ms authored Apr 8, 2022
2 parents 2fc1680 + 0634860 commit 33bf3f0
Show file tree
Hide file tree
Showing 18,534 changed files with 2,765,623 additions and 998,103 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 5 additions & 2 deletions .azure-pipelines/SyncFromMainBranchConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
"tools",
".azure-pipelines",
"src/lib",
"build.proj"
"build.proj",
"src/Az.Test.props",
"src/Az.autorest.hybrid.props",
"src/psm1.props"
],
"UnSyncPath": [
".azure-pipelines/SyncFromMainBranchConfig.json"
]
}
}
20 changes: 5 additions & 15 deletions .azure-pipelines/daily-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Please don't use ADO UI defined scheduled triggers because it takes precedence over YAML scheduled triggers.
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/scheduled-triggers
variables:
today: $(Get-Date -Format yyyyMMddhhmmss)

schedules:
- cron: "0 18 * * *"
displayName: 2:00 AM (UTC + 8:00) China Daily Build
Expand Down Expand Up @@ -55,24 +58,11 @@ jobs:
targetType: 'inline'
script: |
$command = "`$PSVersionTable `
./tools/RunVersionController.ps1 -MonthName $(MonthName) -Year $(Year) `
Get-PSRepository `
./tools/RunVersionController.ps1 -Release 'Daily Build $(today)' `
Exit"
dotnet tool run pwsh -c $command
# - task: PowerShell@2
# displayName: 'Push to Branch internal/dailybuild'
# inputs:
# targetType: 'inline'
# script: |
# git config user.email "azuresdkci@microsoft.com"
# git config user.name "azuresdkci"
# git remote set-url origin https://$(Token)@github.com/Azure/azure-powershell.git
# git checkout -b internal/dailybuild
# git add .
# git commit -m "Bump Version"
# git status
# git push -u origin internal/dailybuild --force

- task: PowerShell@2
displayName: 'Clean artifacts folder'
inputs:
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/powershell-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variables:
LinuxImage: ubuntu-20.04
MacOSName: macOS
MacOSImage: macOS-11
TestFramework: netcoreapp2.1
TestFramework: netcoreapp3.1
TestTarget: Test
Configuration: Debug
DebugLocalBuildTasks: true
Expand Down
6 changes: 0 additions & 6 deletions .azure-pipelines/util/test-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ steps:
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
pwsh: true

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 2.1.x

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/windows-powershell.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variables:
WindowsName: windows
WindowsImage: windows-2019
TestFramework: netcoreapp2.1
TestFramework: netcoreapp3.1
TestTarget: Test
Configuration: Debug
DebugLocalBuildTasks: true
Expand Down
388 changes: 388 additions & 0 deletions ChangeLog.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<!-- Delete powershell runtime files -->
<PropertyGroup>
<RuntimeDllsIncludeList>Microsoft.Powershell.*.dll,System*.dll,Microsoft.VisualBasic.dll,Microsoft.CSharp.dll,Microsoft.CodeAnalysis.dll,Microsoft.CodeAnalysis.CSharp.dll</RuntimeDllsIncludeList>
<RuntimeDllsExcludeList>System.Security.Cryptography.ProtectedData.dll,System.Configuration.ConfigurationManager.dll,System.Runtime.CompilerServices.Unsafe.dll,System.IO.FileSystem.AccessControl.dll,System.Buffers.dll,System.Text.Encodings.Web.dll,System.CodeDom.dll,System.Management.dll,System.Text.Json.dll,System.Threading.Tasks.Extensions.dll</RuntimeDllsExcludeList>
<RuntimeDllsExcludeList>System.Security.Cryptography.ProtectedData.dll,System.Configuration.ConfigurationManager.dll,System.Runtime.CompilerServices.Unsafe.dll,System.IO.FileSystem.AccessControl.dll,System.Buffers.dll,System.Text.Encodings.Web.dll,System.CodeDom.dll,System.Management.dll,System.Text.Json.dll,System.Threading.Tasks.Extensions.dll,System.IO.Hashing.dll</RuntimeDllsExcludeList>
</PropertyGroup>
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Get-ChildItem -Path $(RepoArtifacts)/$(Configuration) -Recurse -Include $(RuntimeDllsIncludeList) -Exclude $(RuntimeDllsExcludeList) | Where-Object {$_.FullName -notlike '*PreloadAssemblies*' -and $_.FullName -notlike '*NetCoreAssemblies*' -and $_.FullName -notlike '*AzSharedAlcAssemblies*' -and $_.FullName -notlike '*ModuleAlcAssemblies*'} | Remove-Item -Force&quot;"/>
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Get-ChildItem -Path $(RepoArtifacts)/$(Configuration) -Recurse -Include 'runtimes' | Remove-Item -Recurse -Force&quot;" Condition="'$(CodeSign)' == 'true'" />
Expand Down Expand Up @@ -316,7 +316,7 @@
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(DockerTools)/CleanArtifacts.ps1 -Docker $(DockerRoot) &quot;" />
</Target>

<Target Name="Test" DependsOnTargets="FilterBuild">
<Target Name="Test" DependsOnTargets="FilterBuild" Condition="'$(IsGenerateBased)' == 'false'">
<Message Importance="high" Text="Running check in tests..." />
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
<!-- https://github.com/Microsoft/msbuild/issues/3157#issuecomment-378002971 -->
Expand Down
40 changes: 40 additions & 0 deletions docker/Dockerfile-alpine-3.14
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM mcr.microsoft.com/powershell:alpine-3.14

ARG REPOSITORY=PSGallery
ARG MODULE=Az
ARG CONFIG=config
ARG AZURERM_CONTEXT_SETTINGS=AzureRmContextSettings.json
ARG AZURE=/root/.Azure
ARG VCS_REF="none"
ARG BUILD_DATE=
ARG VERSION=
ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-alpine-3.14

ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-alpine-3.14"

LABEL maintainer="Azure PowerShell Team <azdevxps@microsoft.com>" \
readme.md="http://aka.ms/azpsdockerreadme" \
description="This Dockerfile will install the latest release of Azure PowerShell." \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.usage="http://aka.ms/azpsdocker" \
org.label-schema.url="http://aka.ms/azpsdockerreadme" \
org.label-schema.vcs-url="https://github.com/Azure/azure-powershell" \
org.label-schema.name="azure powershell" \
org.label-schema.vendor="Azure PowerShell" \
org.label-schema.version=${VERSION} \
org.label-schema.schema-version="1.0" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.docker.cmd="docker run --rm ${IMAGE_NAME} pwsh -c '\$PSVERSIONTABLE'" \
org.label-schema.docker.cmd.devel="docker run -it --rm -e 'DebugPreference=Continue' ${IMAGE_NAME} pwsh" \
org.label-schema.docker.cmd.test="currently not available" \
org.label-schema.docker.cmd.help="docker run --rm ${IMAGE_NAME} pwsh -c Get-Help"

# install azure-powershell from PSGallery
RUN pwsh -Command Set-PSRepository -Name ${REPOSITORY} -InstallationPolicy Trusted && \
pwsh -Command Install-Module -Name ${MODULE} -RequiredVersion ${VERSION} -Scope AllUsers -Repository ${REPOSITORY} && \
pwsh -Command Set-PSRepository -Name ${REPOSITORY} -InstallationPolicy Untrusted

# create AzureRmContextSettings.json before it was generated
COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS}

CMD [ "pwsh" ]
40 changes: 40 additions & 0 deletions docker/Dockerfile-ubuntu-20.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM mcr.microsoft.com/powershell:ubuntu-20.04

ARG REPOSITORY=PSGallery
ARG MODULE=Az
ARG CONFIG=config
ARG AZURERM_CONTEXT_SETTINGS=AzureRmContextSettings.json
ARG AZURE=/root/.Azure
ARG VCS_REF="none"
ARG BUILD_DATE=
ARG VERSION=
ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-ubuntu-20.04

ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-ubuntu-20.04"

LABEL maintainer="Azure PowerShell Team <azdevxps@microsoft.com>" \
readme.md="http://aka.ms/azpsdockerreadme" \
description="This Dockerfile will install the latest release of Azure PowerShell." \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.usage="http://aka.ms/azpsdocker" \
org.label-schema.url="http://aka.ms/azpsdockerreadme" \
org.label-schema.vcs-url="https://github.com/Azure/azure-powershell" \
org.label-schema.name="azure powershell" \
org.label-schema.vendor="Azure PowerShell" \
org.label-schema.version=${VERSION} \
org.label-schema.schema-version="1.0" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.docker.cmd="docker run --rm ${IMAGE_NAME} pwsh -c '\$PSVERSIONTABLE'" \
org.label-schema.docker.cmd.devel="docker run -it --rm -e 'DebugPreference=Continue' ${IMAGE_NAME} pwsh" \
org.label-schema.docker.cmd.test="currently not available" \
org.label-schema.docker.cmd.help="docker run --rm ${IMAGE_NAME} pwsh -c Get-Help"

# install azure-powershell from PSGallery
RUN pwsh -Command Set-PSRepository -Name ${REPOSITORY} -InstallationPolicy Trusted && \
pwsh -Command Install-Module -Name ${MODULE} -RequiredVersion ${VERSION} -Scope AllUsers -Repository ${REPOSITORY} && \
pwsh -Command Set-PSRepository -Name ${REPOSITORY} -InstallationPolicy Untrusted

# create AzureRmContextSettings.json before it was generated
COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS}

CMD [ "pwsh" ]
17 changes: 1 addition & 16 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,14 @@ Azure PowerShell [release notes](https://docs.microsoft.com/en-us/powershell/azu
docker pull mcr.microsoft.com/azure-powershell
```

### Run azure-powershell container
### Run azure-powershell container

- To run azure-powershell using a container in an interactive mode:

```sh
$ docker run -it mcr.microsoft.com/azure-powershell pwsh
```

- To run azure-powershell from using a container in an interactive mode using host authentication:

1- Make sure that `$HOME/.Azure` is present on the host (default location)
2- You may need to grant access this location for the docker process.

```sh
$ docker run -it -v ~/.Azure/AzureRmContext.json:/root/.Azure/AzureRmContext.json -v ~/.Azure/TokenCache.dat:/root/.Azure/TokenCache.dat mcr.microsoft.com/azure-powershell pwsh
```

Verify the host authentication:

```sh
docker run -it --rm -v ~/.Azure/AzureRmContext.json:/root/.Azure/AzureRmContext.json -v ~/.Azure/TokenCache.dat:/root/.Azure/TokenCache.dat mcr.microsoft.com/azure-powershell pwsh -c Get-AzContext
```

### Building image

Clone the azure-powershell repo, and in your local copy run the following commands:
Expand Down
Loading

0 comments on commit 33bf3f0

Please sign in to comment.