Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Docker image build and push process #4376

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/nightlyrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
dotnet-version: |
6.x
7.x
8.x
- uses: actions/checkout@v4
with:
ref: dev
Expand Down Expand Up @@ -48,12 +49,12 @@ jobs:
- 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";
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=lts-nanoserver-ltsc2022" --build-arg "INSTALL_USER=ContainerAdministrator" --build-arg "SKIP_PUBLISHER_CHECK=True" ./docker -f ./docker/pnppowershell.dockerFile --tag "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-lts-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"
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-lts-nanoserver-ltsc2022"
publish-docker-windows-2019:
runs-on: windows-2019
needs: [ build ]
Expand All @@ -62,12 +63,12 @@ jobs:
- 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";
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=lts-nanoserver-1809" --build-arg "INSTALL_USER=ContainerAdministrator" --build-arg "SKIP_PUBLISHER_CHECK=True" ./docker -f ./docker/pnppowershell.dockerFile --tag "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-lts-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"
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-lts-nanoserver-1809"
publish-docker-linux:
runs-on: ubuntu-latest
needs: [ build ]
Expand All @@ -76,14 +77,14 @@ jobs:
- 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.17" --build-arg "INSTALL_USER=root" --build-arg "SKIP_PUBLISHER_CHECK=False" ./docker -f ./docker/pnppowershell.dockerFile --tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-alpine-3.17;
docker build --build-arg "PNP_MODULE_VERSION=$VERSION" --build-arg "BASE_IMAGE_SUFFIX=lts-alpine-3.17" --build-arg "INSTALL_USER=root" --build-arg "SKIP_PUBLISHER_CHECK=False" ./docker -f ./docker/pnppowershell.dockerFile --tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-lts-alpine-3.17;
- name: Tag the image
run: |
VERSION=$(cat ./version.txt)-nightly
docker image tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-alpine-3.17 ${{ secrets.DOCKER_ORG }}/powershell:nightly
docker image tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-lts-alpine-3.17 ${{ 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.17
docker push ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-lts-alpine-3.17
docker push ${{ secrets.DOCKER_ORG }}/powershell:nightly
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
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"
./docker/Publish-UnpublishedImage.ps1 PnP.PowerShell ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_ORG }} powershell $securedPassword "ContainerAdministrator" $true "lts-nanoserver-ltsc2022"
publish-docker-windows-2019:
runs-on: windows-2019
steps:
Expand All @@ -25,7 +25,7 @@ jobs:
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"
./docker/Publish-UnpublishedImage.ps1 PnP.PowerShell ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_ORG }} powershell $securedPassword "ContainerAdministrator" $true "lts-nanoserver-1809"
publish-docker-linux:
runs-on: ubuntu-latest
steps:
Expand All @@ -34,4 +34,4 @@ jobs:
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.17"
./docker/Publish-UnpublishedImage.ps1 PnP.PowerShell ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_ORG }} powershell $securedPassword "root" $false "lts-alpine-3.17"
34 changes: 17 additions & 17 deletions docker/Publish-UnpublishedImage.ps1
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
Param(
[Parameter(Position = 0,
Mandatory = $true,
ValueFromPipeline = $false)]
Mandatory = $true,
ValueFromPipeline = $false)]
[String]
$PS_MODULE_NAME,
[Parameter(Position = 1,
Mandatory = $true,
ValueFromPipeline = $false)]
Mandatory = $true,
ValueFromPipeline = $false)]
[String]
$DOCKER_USERNAME,
[Parameter(Position = 2,
Mandatory = $true,
ValueFromPipeline = $false)]
Mandatory = $true,
ValueFromPipeline = $false)]
[String]
$DOCKER_ORG,
[Parameter(Position = 3,
Mandatory = $true,
ValueFromPipeline = $false)]
Mandatory = $true,
ValueFromPipeline = $false)]
[String]
$DOCKER_IMAGE_NAME,
[Parameter(Position = 4,
Mandatory = $true,
ValueFromPipeline = $false)]
Mandatory = $true,
ValueFromPipeline = $false)]
[Security.SecureString]
$DOCKER_PASSWORD,
[Parameter(Position = 5,
Mandatory = $false,
ValueFromPipeline = $false)]
Mandatory = $false,
ValueFromPipeline = $false)]
[String]
$DOCKER_INSTALL_USER = "ContainerAdministrator",
[Parameter(Position = 6,
Mandatory = $false,
ValueFromPipeline = $false)]
Mandatory = $false,
ValueFromPipeline = $false)]
[bool]
$SKIP_PUBLISHER_CHECK = $false,
[Parameter(Position = 7,
Mandatory = $false,
ValueFromPipeline = $false)]
Mandatory = $false,
ValueFromPipeline = $false)]
[String]
$DOCKER_IMAGE_SUFFIX_ARRAY = "nanoserver-ltsc2022"
)
Expand All @@ -56,7 +56,7 @@ $moduleVersions | % {
$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.17") {
if ( $baseImageSuffix -eq "lts-alpine-3.17") {
docker image tag $DOCKER_ORG/$DOCKER_IMAGE_NAME`:$imageVersion $DOCKER_ORG/$DOCKER_IMAGE_NAME`:latest;
docker push $DOCKER_ORG/$DOCKER_IMAGE_NAME`:latest;
}
Expand Down
4 changes: 2 additions & 2 deletions docker/pnppowershell.dockerFile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE_SUFFIX=alpine-3.17
ARG BASE_IMAGE=mcr.microsoft.com/powershell:lts-7.4-$BASE_IMAGE_SUFFIX
ARG BASE_IMAGE_SUFFIX=lts-alpine-3.17
ARG BASE_IMAGE=mcr.microsoft.com/powershell:$BASE_IMAGE_SUFFIX
FROM $BASE_IMAGE

SHELL ["pwsh", "-command"]
Expand Down
2 changes: 1 addition & 1 deletion documentation/Add-PnPAzureADGroupOwner.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ title: Add-PnPAzureADGroupOwner

* Microsoft Graph API: All of Group.ReadWrite.All, User.ReadWrite.All

Adds users to the owners of an Azure Active Directory group. This can be a security, distribution or Microsoft 365 group.
Adds users to the owners of an Azure Active Directory group. This can be a security or Microsoft 365 group. Distribution lists are not currently supported by Graph API.

## SYNTAX

Expand Down
2 changes: 1 addition & 1 deletion documentation/Remove-PnPAzureADGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPAzureADGroup.

* Microsoft Graph API: Group.ReadWrite.All

Removes one Azure Active Directory group. This can be a security, distribution or Microsoft 365 group.
Removes one Azure Active Directory group. This can be a security or Microsoft 365 group. Distribution lists are not currently supported by Graph API.

## SYNTAX

Expand Down
Loading