Skip to content

Commit

Permalink
Merge pull request #2070 from pnp/dev
Browse files Browse the repository at this point in the history
Release 1.11.0
  • Loading branch information
erwinvanhunen authored Jul 1, 2022
2 parents 21634c2 + b546901 commit 8fbb9f1
Show file tree
Hide file tree
Showing 562 changed files with 11,290 additions and 2,927 deletions.
49 changes: 48 additions & 1 deletion .github/workflows/nightlyrelease.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Nightly Release to PowerShell Gallery
name: Nightly Release to PowerShell Gallery and Docker Hub

on:
workflow_dispatch:
Expand Down Expand Up @@ -39,3 +39,50 @@ jobs:
push: true
branch: dev
token: ${{ secrets.PAT }}
publish-docker-windows-2022:
runs-on: windows-2022
needs: [ build ]
steps:
- uses: actions/checkout@v2
- name: Build an image
run: |
$VERSION="$(cat ./version.txt)-nightly"
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=nanoserver-ltsc2022" --build-arg "INSTALL_USER=ContainerAdministrator" --build-arg "SKIP_PUBLISHER_CHECK=True" ./docker -f ./docker/pnppowershell.dockerFile --tag "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-nanoserver-ltsc2022";
- name: Push the image
run: |
$VERSION="$(cat ./version.txt)-nightly"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-nanoserver-ltsc2022"
publish-docker-windows-2019:
runs-on: windows-2019
needs: [ build ]
steps:
- uses: actions/checkout@v2
- name: Build an image
run: |
$VERSION="$(cat ./version.txt)-nightly"
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=nanoserver-1809" --build-arg "INSTALL_USER=ContainerAdministrator" --build-arg "SKIP_PUBLISHER_CHECK=True" ./docker -f ./docker/pnppowershell.dockerFile --tag "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-nanoserver-1809";
- name: Push the image
run: |
$VERSION="$(cat ./version.txt)-nightly"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-nanoserver-1809"
publish-docker-linux:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- uses: actions/checkout@v2
- name: Build an image
run: |
VERSION=$(cat ./version.txt)-nightly
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=alpine-3.14" --build-arg "INSTALL_USER=root" --build-arg "SKIP_PUBLISHER_CHECK=False" ./docker -f ./docker/pnppowershell.dockerFile --tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-alpine-3.14;
- name: Tag the image
run: |
VERSION=$(cat ./version.txt)-nightly
docker image tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-alpine-3.14 ${{ secrets.DOCKER_ORG }}/powershell:nightly
- name: Push the image
run: |
VERSION=$(cat ./version.txt)-nightly
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-alpine-3.14
docker push ${{ secrets.DOCKER_ORG }}/powershell:nightly
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release to Docker Hub

on:
workflow_dispatch:
schedule:
- cron: '30 3 * * *'
jobs:
publish-docker-windows-2022:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- name: Build and Publish All
shell: pwsh
run: |
$securedPassword = ConvertTo-SecureString "${{ secrets.DOCKER_PASSWORD }}" -AsPlainText -Force
./docker/Publish-UnpublishedImage.ps1 PnP.PowerShell ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_ORG }} powershell $securedPassword "ContainerAdministrator" $true "nanoserver-ltsc2022"
publish-docker-windows-2019:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Build and Publish All
shell: pwsh
run: |
$securedPassword = ConvertTo-SecureString "${{ secrets.DOCKER_PASSWORD }}" -AsPlainText -Force
./docker/Publish-UnpublishedImage.ps1 PnP.PowerShell ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_ORG }} powershell $securedPassword "ContainerAdministrator" $true "nanoserver-1809"
publish-docker-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and Publish All
shell: pwsh
run: |
$securedPassword = ConvertTo-SecureString "${{ secrets.DOCKER_PASSWORD }}" -AsPlainText -Force
./docker/Publish-UnpublishedImage.ps1 PnP.PowerShell ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_ORG }} powershell $securedPassword "root" $false "alpine-3.14"
230 changes: 214 additions & 16 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PnP PowerShell

**PnP PowerShell** is a .NET Core 3.1 / .NET Framework 4.6.1 based PowerShell Module providing over 600 cmdlets that work with Microsoft 365 environments such as SharePoint Online, Microsoft Teams, Microsoft Project, Security & Compliance, Azure Active Directory, and more.
**PnP PowerShell** is a .NET Core 3.1 / .NET Framework 4.6.2 based PowerShell Module providing nearly 650 cmdlets that work with Microsoft 365 environments such as SharePoint Online, Microsoft Teams, Microsoft Project, Security & Compliance, Azure Active Directory, and more.

Last version | Last nightly version
-------------|---------------------
Expand Down
5 changes: 3 additions & 2 deletions build/Build-Debug.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#Requires -PSEdition Core
Param(
[Parameter(Mandatory = $false,
ValueFromPipeline = $false)]
Expand Down Expand Up @@ -119,7 +120,7 @@ if ($LASTEXITCODE -eq 0) {
Get-ChildItem -Path "$PSScriptRoot/../src/ALC/bin/Debug/netstandard2.0" | Where-Object { $_.Extension -in '.dll', '.pdb' } | Foreach-Object { if (!$assemblyExceptions.Contains($_.Name)) { [void]$commonFiles.Add($_.Name) }; Copy-Item -LiteralPath $_.FullName -Destination $commonPath }
Get-ChildItem -Path "$PSScriptRoot/../src/Commands/bin/Debug/$configuration" | Where-Object { $_.Extension -in '.dll', '.pdb' -and -not $commonFiles.Contains($_.Name) } | Foreach-Object { Copy-Item -LiteralPath $_.FullName -Destination $corePath }
if (!$IsLinux -and !$IsMacOs) {
Get-ChildItem -Path "$PSScriptRoot/../src/Commands/bin/Debug/net461" | Where-Object { $_.Extension -in '.dll', '.pdb' -and -not $commonFiles.Contains($_.Name) } | Foreach-Object { Copy-Item -LiteralPath $_.FullName -Destination $frameworkPath }
Get-ChildItem -Path "$PSScriptRoot/../src/Commands/bin/Debug/net462" | Where-Object { $_.Extension -in '.dll', '.pdb' -and -not $commonFiles.Contains($_.Name) } | Foreach-Object { Copy-Item -LiteralPath $_.FullName -Destination $frameworkPath }
}
}
Catch {
Expand Down Expand Up @@ -168,7 +169,7 @@ if ($LASTEXITCODE -eq 0) {
CompanyName = 'Microsoft 365 Patterns and Practices'
CompatiblePSEditions = @(`"Core`",`"Desktop`")
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.6.1'
DotNetFrameworkVersion = '4.6.2'
ProcessorArchitecture = 'None'
FunctionsToExport = '*'
CmdletsToExport = @($cmdletsString)
Expand Down
6 changes: 3 additions & 3 deletions build/Build-Nightly.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ if ($runPublish -eq $true) {
Get-ChildItem -Path "$PSScriptRoot/../src/ALC/bin/Release/netstandard2.0" | Where-Object { $_.Extension -in '.dll', '.pdb' } | Foreach-Object { if (!$assemblyExceptions.Contains($_.Name)) { [void]$commonFiles.Add($_.Name) }; Copy-Item -LiteralPath $_.FullName -Destination $commonPath }
Get-ChildItem -Path "$PSScriptRoot/../src/Commands/bin/Release/netcoreapp3.1" | Where-Object { $_.Extension -in '.dll', '.pdb' -and -not $commonFiles.Contains($_.Name) } | Foreach-Object { Copy-Item -LiteralPath $_.FullName -Destination $corePath }
if (!$IsLinux -and !$IsMacOs) {
Get-ChildItem -Path "$PSScriptRoot/../src/Commands/bin/Release/net461" | Where-Object { $_.Extension -in '.dll', '.pdb' -and -not $commonFiles.Contains($_.Name) } | Foreach-Object { Copy-Item -LiteralPath $_.FullName -Destination $frameworkPath }
Get-ChildItem -Path "$PSScriptRoot/../src/Commands/bin/Release/net462" | Where-Object { $_.Extension -in '.dll', '.pdb' -and -not $commonFiles.Contains($_.Name) } | Foreach-Object { Copy-Item -LiteralPath $_.FullName -Destination $frameworkPath }
}
}
Catch {
Expand Down Expand Up @@ -171,7 +171,7 @@ if ($runPublish -eq $true) {
CompanyName = 'Microsoft 365 Patterns and Practices'
CompatiblePSEditions = @(`"Core`",`"Desktop`")
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.6.1'
DotNetFrameworkVersion = '4.6.2'
ProcessorArchitecture = 'None'
FunctionsToExport = '*'
CmdletsToExport = @($cmdletsString)
Expand Down Expand Up @@ -208,4 +208,4 @@ if ($runPublish -eq $true) {

# Write version back to version
Set-Content ./version.txt -Value $version -Force -NoNewline
}
}
65 changes: 65 additions & 0 deletions docker/Publish-UnpublishedImage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Param(
[Parameter(Position = 0,
Mandatory = $true,
ValueFromPipeline = $false)]
[String]
$PS_MODULE_NAME,
[Parameter(Position = 1,
Mandatory = $true,
ValueFromPipeline = $false)]
[String]
$DOCKER_USERNAME,
[Parameter(Position = 2,
Mandatory = $true,
ValueFromPipeline = $false)]
[String]
$DOCKER_ORG,
[Parameter(Position = 3,
Mandatory = $true,
ValueFromPipeline = $false)]
[String]
$DOCKER_IMAGE_NAME,
[Parameter(Position = 4,
Mandatory = $true,
ValueFromPipeline = $false)]
[Security.SecureString]
$DOCKER_PASSWORD,
[Parameter(Position = 5,
Mandatory = $false,
ValueFromPipeline = $false)]
[String]
$DOCKER_INSTALL_USER = "ContainerAdministrator",
[Parameter(Position = 6,
Mandatory = $false,
ValueFromPipeline = $false)]
[bool]
$SKIP_PUBLISHER_CHECK = $false,
[Parameter(Position = 7,
Mandatory = $false,
ValueFromPipeline = $false)]
[String]
$DOCKER_IMAGE_SUFFIX_ARRAY = "nanoserver-ltsc2022"
)
$publishedImageVersions = (Invoke-RestMethod https://registry.hub.docker.com/v2/repositories/$DOCKER_ORG/$DOCKER_IMAGE_NAME/tags?page_size=10240).results | % {
$_.name
}
$moduleVersions = Find-Module $PS_MODULE_NAME -AllVersions;
[array]::Reverse($moduleVersions);
$moduleVersions | % {
$moduleVersion = $_.Version;
$DOCKER_IMAGE_SUFFIX_ARRAY.Split( "," ) | % {
$baseImageSuffix = $_;
$imageVersion = "$moduleVersion-$baseImageSuffix";
Write-Host "Checking $imageVersion"
if ( !( $publishedImageVersions -contains $imageVersion ) ) {
docker build --build-arg "PNP_MODULE_VERSION=$moduleVersion" --build-arg "BASE_IMAGE_SUFFIX=$baseImageSuffix" --build-arg "INSTALL_USER=$DOCKER_INSTALL_USER" --build-arg "SKIP_PUBLISHER_CHECK=$SKIP_PUBLISHER_CHECK" ./docker -f ./docker/pnppowershell.dockerFile --tag $DOCKER_ORG/$DOCKER_IMAGE_NAME`:$imageVersion;
$plainStringPassword = [System.Net.NetworkCredential]::new("", $DOCKER_PASSWORD).Password;
docker login -u $DOCKER_USERNAME -p "$plainStringPassword";
docker push $DOCKER_ORG/$DOCKER_IMAGE_NAME`:$imageVersion;
if ( $baseImageSuffix -eq "alpine-3.14") {
docker image tag $DOCKER_ORG/$DOCKER_IMAGE_NAME`:$imageVersion $DOCKER_ORG/$DOCKER_IMAGE_NAME`:latest;
docker push $DOCKER_ORG/$DOCKER_IMAGE_NAME`:latest;
}
}
}
}
64 changes: 64 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Publish manually in Windows

1. Set `DOCKER_USERNAME`, `DOCKER_ORG` and `DOCKER_PASSWORD` variables

2. Run

```powershell
$securedPassword = ConvertTo-SecureString $DOCKER_PASSWORD -AsPlainText -Force
./docker/Publish-UnpublishedImage.ps1 PnP.PowerShell $DOCKER_USERNAME $DOCKER_ORG powershell $securedPassword "ContainerAdministrator" $true "nanoserver-1809"
```

# Publish manually in Linux

1. Set `DOCKER_USERNAME`, `DOCKER_ORG` and `DOCKER_PASSWORD` variables

2. Run

```powershell
$securedPassword = ConvertTo-SecureString $DOCKER_PASSWORD -AsPlainText -Force
./docker/Publish-UnpublishedImage.ps1 PnP.PowerShell $DOCKER_USERNAME $DOCKER_ORG powershell $securedPassword $false "root" "alpine-3.14"
```

# Publish with prereleases manually in Windows

1. Set `DOCKER_USERNAME`, `DOCKER_ORG` and `DOCKER_PASSWORD` variables

2. Run

```PowerShell
$VERSION="$(cat ./version.txt)-nightly"
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=nanoserver-ltsc2022" --build-arg "INSTALL_USER=ContainerAdministrator" --build-arg "SKIP_PUBLISHER_CHECK=True" ./docker -f ./docker/pnppowershell.dockerFile --tag "$DOCKER_ORG/powershell:$VERSION-nanoserver-ltsc2022";
$VERSION="$(cat ./version.txt)-nightly"
docker login -u $DOCKER_USERNAME -p "$DOCKER_PASSWORD"
docker push "$DOCKER_ORG/powershell:$VERSION-nanoserver-ltsc2022"
```

or

```PowerShell
$VERSION="$(cat ./version.txt)-nightly"
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=nanoserver-1809" --build-arg "INSTALL_USER=ContainerAdministrator" --build-arg "SKIP_PUBLISHER_CHECK=True" ./docker -f ./docker/pnppowershell.dockerFile --tag "$DOCKER_ORG/powershell:$VERSION-nanoserver-1809";
$VERSION="$(cat ./version.txt)-nightly"
docker login -u $DOCKER_USERNAME -p "$DOCKER_PASSWORD"
docker push "$DOCKER_ORG/powershell:$VERSION-nanoserver-1809"
```

# Publish with prereleases manually in Linux

1. Set `DOCKER_USERNAME`, `DOCKER_ORG` and `DOCKER_PASSWORD` variables

2. Run

```bash
VERSION=$(cat ./version.txt)-nightly
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=alpine-3.14" --build-arg "INSTALL_USER=root" --build-arg "SKIP_PUBLISHER_CHECK=False" ./docker -f ./docker/pnppowershell.dockerFile --tag $DOCKER_ORG/powershell:$VERSION-alpine-3.14;
docker image tag $DOCKER_ORG/powershell:$VERSION-alpine-3.14 $DOCKER_ORG/powershell:nightly
docker login -u $DOCKER_USERNAME -p "$DOCKER_PASSWORD"
docker push $DOCKER_ORG/powershell:$VERSION-alpine-3.14
docker push $DOCKER_ORG/powershell:nightly
```

# Publish automatically with Github Actions

Set `DOCKER_USERNAME`, `DOCKER_ORG` and `DOCKER_PASSWORD` variables in Github Actions Secrets
1 change: 0 additions & 1 deletion docker/build.ps1

This file was deleted.

77 changes: 77 additions & 0 deletions docker/hub.docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# PnP.Powershell

## Featured tags

### Latest

* latest: The latest stable image

* alpine-3.14
* `docker pull m365pnp/powershell` or `docker pull m365pnp/powershell:latest`

### Nightly

* nightly: The latest night image

* alpine-3.14
* `docker pull m365pnp/powershell:nightly`

## About this image

**PnP PowerShell** is a .NET Core 3.1 / .NET Framework 4.6.1 based PowerShell Module providing over 600 cmdlets that work with Microsoft 365 environments such as SharePoint Online, Microsoft Teams, Microsoft Project, Security & Compliance, Azure Active Directory, and more.

## Usage examples

### Windows-container

Starting an isolated container with PnP.PowerShell module installed:

```
docker run --rm -it m365pnp/powershell:1.10.0-nanoserver-1809
```

Starting a PnP.PowerShell container with the current directory mounted:

```PowerShell
docker run --rm -it -v ${PWD}:c:/app -w c:/app m365pnp/powershell:1.10.0-nanoserver-1809
```

### Linux-container

Starting an isolated container with PnP.PowerShell module installed:

```
docker run --rm -it m365pnp/powershell
```

Starting a PnP.PowerShell container with the current directory mounted:

```bash
docker run --rm -it -v ${PWD}:/home -w /home m365pnp/powershell
```

## Tag explanation

Tags names mean the following:

`<version>(-nightly)-<platform>`

Currently supported platforms:

* nanoserver-ltsc2022
* nanoserver-1809
* alpine-3.14

Tag name examples:

* 1.8.0-nanoserver-ltsc2022
* 1.9.0-nanoserver-ltsc2022
* 1.10.0-nanoserver-1809
* 1.10.0-alpine-3.14
* 1.10.26-nightly-nanoserver-ltsc2022

To find the version numbers please visit https://www.powershellgallery.com/packages/PnP.PowerShell

## Feedback

* To give feedback for PnP.PowerShell or for how the images are built, file an issue at [PnP/PowerShell](https://github.com/pnp/powershell/issues/new/choose)
18 changes: 15 additions & 3 deletions docker/pnppowershell.dockerFile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
FROM mcr.microsoft.com/powershell:lts-debian-10
COPY ./powershell/ powershell
RUN /usr/bin/pwsh -File ./powershell/installModules.ps1 && rm -rf ./powershell
ARG BASE_IMAGE_SUFFIX=alpine-3.14
ARG BASE_IMAGE=mcr.microsoft.com/powershell:lts-7.2-$BASE_IMAGE_SUFFIX
FROM $BASE_IMAGE

SHELL ["pwsh", "-command"]
ARG INSTALL_USER=ContainerAdministrator
USER $INSTALL_USER
ARG PNP_MODULE_VERSION
ARG SKIP_PUBLISHER_CHECK=TRUE
RUN if ( $env:SKIP_PUBLISHER_CHECK -eq $true ) { \
Write-Host "SKIP_PUBLISHER_CHECK"; \
Install-Module -Name PnP.PowerShell -RequiredVersion $env:PNP_MODULE_VERSION -Force -AllowPrerelease -Scope AllUsers -SkipPublisherCheck; \
} else { \
Install-Module -Name PnP.PowerShell -RequiredVersion $env:PNP_MODULE_VERSION -Force -AllowPrerelease -Scope AllUsers; \
}
Loading

0 comments on commit 8fbb9f1

Please sign in to comment.