From 20160e6d1069ccb7099c1ca6e726b5bd48db589b Mon Sep 17 00:00:00 2001 From: NanxiangLiu <33285578+Nickcandy@users.noreply.github.com> Date: Tue, 24 May 2022 10:42:24 +0800 Subject: [PATCH] Revise smoke test and change Docker files (#18263) * upgrade get-azlocation cmd(upgrade subcriptionclient version, add extend location peremeter, and expose more info * update test for azlocation * add changlog * revise changlog.md:delete new title * revise changlog.md * add dockerfiles for debian10,debian11,mairin1,ubuntu2204 * revise docker file name * change parameter to singular noun * revise session record json file * revise docker file * revise docker file * revise session record json file * revise session record json file * revise session record json file * revise session record json file * revise session record json file * revise session record json file * revise session record json file * add parameter(failOnStandardError: true) for smoketest * add parameter(failOnStandardError: true) for smoketest * change testcase in smoke test.getazadgroup -> get-azaduser * change testcase in smoke test.getazadgroup -> get-azaduser * change testcase in smoke test.getazadgroup -> get-azaduser * change docker file --- .azure-pipelines/util/smoke-test-steps.yml | 8 +++ docker/Dockerfile-alpine-3.13 | 17 +++++-- docker/Dockerfile-alpine-3.14 | 17 +++++-- docker/Dockerfile-centos-7 | 18 +++++-- ...ckerfile-debian-9 => Dockerfile-debian-10} | 23 ++++++--- docker/Dockerfile-debian-11 | 49 ++++++++++++++++++ docker/Dockerfile-mariner-1 | 49 ++++++++++++++++++ docker/Dockerfile-ubuntu-18.04 | 19 +++++-- docker/Dockerfile-ubuntu-20.04 | 17 +++++-- docker/Dockerfile-ubuntu-22.04 | 50 +++++++++++++++++++ tools/Test/SmokeTest/RmCoreSmokeTests.ps1 | 2 +- 11 files changed, 239 insertions(+), 30 deletions(-) rename docker/{Dockerfile-debian-9 => Dockerfile-debian-10} (63%) create mode 100644 docker/Dockerfile-debian-11 create mode 100644 docker/Dockerfile-mariner-1 create mode 100644 docker/Dockerfile-ubuntu-22.04 diff --git a/.azure-pipelines/util/smoke-test-steps.yml b/.azure-pipelines/util/smoke-test-steps.yml index 3b92449d8d20..5da01617cb13 100644 --- a/.azure-pipelines/util/smoke-test-steps.yml +++ b/.azure-pipelines/util/smoke-test-steps.yml @@ -102,12 +102,16 @@ jobs: inputs: filePath: 'tools/Test/SmokeTest/ScriptsCaller.ps1' arguments: '-RequiredPsVersion ${{ parameters.psVersion }} -Script "./tools/Test/SmokeTest/RmCoreSmokeTests.ps1 "' + failOnStderr: true + - task: PowerShell@2 displayName: 'Run Smoke Test Reversely' inputs: filePath: 'tools/Test/SmokeTest/ScriptsCaller.ps1' arguments: '-RequiredPsVersion ${{ parameters.psVersion }} -Script "./tools/Test/SmokeTest/RmCoreSmokeTests.ps1 -Reverse"' + failOnStderr: true + - task: PowerShell@2 displayName: Clean Az Modules @@ -126,12 +130,16 @@ jobs: inputs: filePath: 'tools/Test/SmokeTest/ScriptsCaller.ps1' arguments: '-RequiredPsVersion ${{ parameters.psVersion }} -Script "./tools/Test/SmokeTest/RmCoreSmokeTests.ps1 "' + failOnStderr: true + - task: PowerShell@2 displayName: 'Run Smoke Test Reversely' inputs: filePath: 'tools/Test/SmokeTest/ScriptsCaller.ps1' arguments: '-RequiredPsVersion ${{ parameters.psVersion }} -Script "./tools/Test/SmokeTest/RmCoreSmokeTests.ps1 -Reverse "' + failOnStderr: true + - task: PowerShell@2 displayName: Clean Az Modules diff --git a/docker/Dockerfile-alpine-3.13 b/docker/Dockerfile-alpine-3.13 index fe094c3b3aab..c5bb55457fb8 100644 --- a/docker/Dockerfile-alpine-3.13 +++ b/docker/Dockerfile-alpine-3.13 @@ -8,6 +8,7 @@ ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= ARG VERSION= +ARG LATEST= ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-alpine-3.13 ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-alpine-3.13" @@ -29,10 +30,18 @@ LABEL maintainer="Azure PowerShell Team " \ 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 +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi # create AzureRmContextSettings.json before it was generated COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} diff --git a/docker/Dockerfile-alpine-3.14 b/docker/Dockerfile-alpine-3.14 index 2bd10e1c3ade..a2bbf025e62e 100644 --- a/docker/Dockerfile-alpine-3.14 +++ b/docker/Dockerfile-alpine-3.14 @@ -8,6 +8,7 @@ ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= ARG VERSION= +ARG LATEST= ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-alpine-3.14 ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-alpine-3.14" @@ -29,10 +30,18 @@ LABEL maintainer="Azure PowerShell Team " \ 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 +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi # create AzureRmContextSettings.json before it was generated COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} diff --git a/docker/Dockerfile-centos-7 b/docker/Dockerfile-centos-7 index f258815b6a8c..21dba8e26a34 100644 --- a/docker/Dockerfile-centos-7 +++ b/docker/Dockerfile-centos-7 @@ -8,6 +8,7 @@ ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= ARG VERSION= +ARG LATEST= ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-centos-7 ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-centos-7" @@ -29,11 +30,18 @@ LABEL maintainer="Azure PowerShell Team " \ 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 - +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi # create AzureRmContextSettings.json before it was generated COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} diff --git a/docker/Dockerfile-debian-9 b/docker/Dockerfile-debian-10 similarity index 63% rename from docker/Dockerfile-debian-9 rename to docker/Dockerfile-debian-10 index da515ab13a02..ee4b2919efd8 100644 --- a/docker/Dockerfile-debian-9 +++ b/docker/Dockerfile-debian-10 @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/powershell:debian-9 +FROM mcr.microsoft.com/powershell:debian-10 ARG REPOSITORY=PSGallery ARG MODULE=Az @@ -8,9 +8,10 @@ ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= ARG VERSION= -ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-debian-9 +ARG LATEST= +ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-debian-10 -ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-debian-9" +ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-debian-10" LABEL maintainer="Azure PowerShell Team " \ readme.md="http://aka.ms/azpsdockerreadme" \ @@ -29,10 +30,18 @@ LABEL maintainer="Azure PowerShell Team " \ 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 +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi # create AzureRmContextSettings.json before it was generated COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} diff --git a/docker/Dockerfile-debian-11 b/docker/Dockerfile-debian-11 new file mode 100644 index 000000000000..a66d71271eb5 --- /dev/null +++ b/docker/Dockerfile-debian-11 @@ -0,0 +1,49 @@ +FROM mcr.microsoft.com/powershell:debian-11 + +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 LATEST= +ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-debian-11 + +ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-debian-11" + +LABEL maintainer="Azure PowerShell Team " \ + 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" + +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi + +# create AzureRmContextSettings.json before it was generated +COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} + +CMD [ "pwsh" ] \ No newline at end of file diff --git a/docker/Dockerfile-mariner-1 b/docker/Dockerfile-mariner-1 new file mode 100644 index 000000000000..c134aa609640 --- /dev/null +++ b/docker/Dockerfile-mariner-1 @@ -0,0 +1,49 @@ +FROM mcr.microsoft.com/powershell:preview-mariner-1.0 + +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 LATEST= +ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-mariner-1.0 + +ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-mariner-1.0" + +LABEL maintainer="Azure PowerShell Team " \ + 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" + +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi + +# create AzureRmContextSettings.json before it was generated +COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} + +CMD [ "pwsh" ] \ No newline at end of file diff --git a/docker/Dockerfile-ubuntu-18.04 b/docker/Dockerfile-ubuntu-18.04 index c158cf1d651a..62dc00c6dde1 100644 --- a/docker/Dockerfile-ubuntu-18.04 +++ b/docker/Dockerfile-ubuntu-18.04 @@ -8,6 +8,7 @@ ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= ARG VERSION= +ARG LATEST= ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-ubuntu-18.04 ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-ubuntu-18.04" @@ -28,11 +29,19 @@ LABEL maintainer="Azure PowerShell Team " \ 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 + +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi # create AzureRmContextSettings.json before it was generated COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} diff --git a/docker/Dockerfile-ubuntu-20.04 b/docker/Dockerfile-ubuntu-20.04 index da580a8ce868..03183df64111 100644 --- a/docker/Dockerfile-ubuntu-20.04 +++ b/docker/Dockerfile-ubuntu-20.04 @@ -8,6 +8,7 @@ ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= ARG VERSION= +ARG LATEST= ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-ubuntu-20.04 ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-ubuntu-20.04" @@ -29,10 +30,18 @@ LABEL maintainer="Azure PowerShell Team " \ 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 +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi # create AzureRmContextSettings.json before it was generated COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} diff --git a/docker/Dockerfile-ubuntu-22.04 b/docker/Dockerfile-ubuntu-22.04 new file mode 100644 index 000000000000..4f2dff879f45 --- /dev/null +++ b/docker/Dockerfile-ubuntu-22.04 @@ -0,0 +1,50 @@ +FROM mcr.microsoft.com/powershell:ubuntu-22.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 LATEST= +ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-ubuntu-22.04 + +ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-ubuntu-22.04" + +LABEL maintainer="Azure PowerShell Team " \ + 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" + +RUN if [ "${LATEST}" = True ] ; then \ + # install latest azure-powershell from BLOB + pwsh -Command Invoke-WebRequest -uri ${BLOB_URL} -OutFile latest.tar.gz && \ + mkdir latest && \ + tar -zxvf ./latest.tar.gz -C ./latest && \ + pwsh -Command ./latest/InstallModule.ps1 ;\ + else \ + # install old azure-powershell from PSGallery + 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 ;\ + fi + + +# create AzureRmContextSettings.json before it was generated +COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS} + +CMD [ "pwsh" ] \ No newline at end of file diff --git a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 index 9a076303df01..ae39415cfcdd 100644 --- a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 +++ b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 @@ -156,7 +156,7 @@ $resourceTestCommands = @( @{Name = "Az.StorageSync"; Command = {Get-AzStorageSyncService}}, @{Name = "Az.Support"; Command = {Get-AzSupportTicket}}, @{Name = "Az.Resources [Tags]"; Command = {Get-AzTag}}, - @{Name = "Az.Resources [MSGraph]"; Command = {Get-AzAdGroup -First 1}}, + @{Name = "Az.Resources [MSGraph]"; Command = {Get-AzADUser -First 1 -Select Id}}, @{Name = "Az.TrafficManager"; Command = {Get-AzTrafficManagerProfile}}, @{Name = "Az.Billing [UsageAggregates]"; Command = {Get-UsageAggregates -ReportedStartTime '1/1/2018' -ReportedEndTime '1/2/2018'}}, @{Name = "Az.Websites"; Command = {Get-AzWebApp -ResourceGroupName $resourceGroupName}}