diff --git a/.github/actions/push-manifests/action.yaml b/.github/actions/push-manifests/action.yaml new file mode 100644 index 0000000..393051a --- /dev/null +++ b/.github/actions/push-manifests/action.yaml @@ -0,0 +1,27 @@ +name: 'Push manifests' +description: 'Push manifest lists' +inputs: + images: + description: 'Push base image manifests' + required: false + default: 'true' + chapters: + description: 'Build chapter image manifests' + required: false + default: 'false' + filter: + description: 'Filter manifests to push' + required: false + default: '' +runs: + using: "composite" + steps: + - name: Push manifest lists + working-directory: build + shell: pwsh + run: | + ./push-manifests.ps1 + env: + BUILD_IMAGES: ${{ inputs.images }} + BUILD_CHAPTERS: ${{ inputs.chapters }} + FILTER: ${{ inputs.filter }} \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..f6b8c8c --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,139 @@ +name: Build + +on: + push: + branches: + - "2e" + paths: + - "images/**" + - "build/**" + - ".github/workflows/build.yaml" + +jobs: + images-linux-amd64: + runs-on: ubuntu-latest + steps: + + - name: Registry login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - uses: actions/checkout@master + + - uses: ./.github/actions/build + + - uses: ./.github/actions/build + with: + images: 'false' + chapters: 'true' + + images-windows-ltsc2019: + runs-on: windows-2019 + steps: + + - name: Docker Hub login + shell: pwsh + run: | + docker login -u $env:USER -p $env:TOKEN + env: + USER: ${{ secrets.DOCKER_HUB_USERNAME }} + TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Checkout + uses: actions/checkout@master + + - name: Build Git Windows image + uses: ./.github/actions/build + with: + filter: 'git-windows' + + - name: Build base images + uses: ./.github/actions/build + + - name: Build chapter images + uses: ./.github/actions/build + with: + images: 'false' + chapters: 'true' + + images-windows-ltsc2022: + runs-on: windows-2022 + steps: + + - name: Docker Hub login + shell: pwsh + run: | + docker login -u $env:USER -p $env:TOKEN + env: + USER: ${{ secrets.DOCKER_HUB_USERNAME }} + TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Checkout + uses: actions/checkout@master + + - name: Build Git Windows image + uses: ./.github/actions/build + with: + filter: 'git-windows' + + - name: Build base images + uses: ./.github/actions/build + + - name: Build chapter images + uses: ./.github/actions/build + with: + images: 'false' + chapters: 'true' + + images-windows-ltsc2025: + runs-on: windows-2025 + steps: + + - name: Docker Hub login + shell: pwsh + run: | + docker login -u $env:USER -p $env:TOKEN + env: + USER: ${{ secrets.DOCKER_HUB_USERNAME }} + TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Checkout + uses: actions/checkout@master + + - name: Build Git Windows image + uses: ./.github/actions/build + with: + filter: 'git-windows' + + - name: Build base images + uses: ./.github/actions/build + + - name: Build chapter images + uses: ./.github/actions/build + with: + images: 'false' + chapters: 'true' + + push-manifests: + if: ${{ always() }} + needs: + - images-linux-amd64 + - images-windows-ltsc2019 + - images-windows-ltsc2022 + - images-windows-ltsc2025 + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@master + + - name: Push base image manifests + uses: ./.github/actions/push-manifests + + - name: Push chapter image manifests + uses: ./.github/actions/push-manifests + with: + images: 'false' + chapters: 'true' + diff --git a/.github/workflows/images-linux-amd64.yaml b/.github/workflows/images-linux-amd64.yaml deleted file mode 100644 index a0033d4..0000000 --- a/.github/workflows/images-linux-amd64.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Linux AMD64 image build - -on: - push: - branches: - - "2e" - paths: - - "images/**" - - "build/**" - - ".github/workflows/images-linux-amd64.yaml" - -jobs: - images-linux-amd64: - runs-on: ubuntu-latest - steps: - - - name: Registry login - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - uses: actions/checkout@master - - - uses: ./.github/actions/build - - - uses: ./.github/actions/build - with: - images: 'false' - chapters: 'true' \ No newline at end of file diff --git a/.github/workflows/images-windows-ltsc2019.yaml b/.github/workflows/images-windows-ltsc2019.yaml deleted file mode 100644 index 59dccf5..0000000 --- a/.github/workflows/images-windows-ltsc2019.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Windows LTSC2019 image build - -on: - push: - branches: - - "2e" - paths: - - "images/**" - - "build/**" - - ".github/workflows/images-windows-ltsc2019.yaml" - -jobs: - images-windows-ltsc2019: - runs-on: windows-2019 - steps: - - - name: Docker Hub login - shell: pwsh - run: | - docker login -u $env:USER -p $env:TOKEN - env: - USER: ${{ secrets.DOCKER_HUB_USERNAME }} - TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Checkout - uses: actions/checkout@master - - - name: Build Git Windows image - uses: ./.github/actions/build - with: - filter: 'git-windows' - - - name: Build base images - uses: ./.github/actions/build - - - name: Build chapter images - uses: ./.github/actions/build - with: - images: 'false' - chapters: 'true' diff --git a/.github/workflows/images-windows-ltsc2022.yaml b/.github/workflows/images-windows-ltsc2022.yaml deleted file mode 100644 index 2772486..0000000 --- a/.github/workflows/images-windows-ltsc2022.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Windows LTSC2022 image build - -on: - push: - branches: - - "2e" - paths: - - "images/**" - - "build/**" - - ".github/workflows/images-windows-ltsc2022.yaml" - -jobs: - images-windows-ltsc2022: - runs-on: windows-2022 - steps: - - - name: Docker Hub login - shell: pwsh - run: | - docker login -u $env:USER -p $env:TOKEN - env: - USER: ${{ secrets.DOCKER_HUB_USERNAME }} - TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Checkout - uses: actions/checkout@master - - - name: Build Git Windows image - uses: ./.github/actions/build - with: - filter: 'git-windows' - - - name: Build base images - uses: ./.github/actions/build - - - name: Build chapter images - uses: ./.github/actions/build - with: - images: 'false' - chapters: 'true' diff --git a/.github/workflows/images-windows-ltsc2025.yaml b/.github/workflows/images-windows-ltsc2025.yaml deleted file mode 100644 index 7bf48ec..0000000 --- a/.github/workflows/images-windows-ltsc2025.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Windows LTSC2025 image build - -on: - push: - branches: - - "2e" - paths: - - "images/**" - - "build/**" - - ".github/workflows/images-windows-ltsc2025.yaml" - -jobs: - images-windows-ltsc2025: - runs-on: windows-2025 - steps: - - - name: Docker Hub login - shell: pwsh - run: | - docker login -u $env:USER -p $env:TOKEN - env: - USER: ${{ secrets.DOCKER_HUB_USERNAME }} - TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Checkout - uses: actions/checkout@master - - - name: Build Git Windows image - uses: ./.github/actions/build - with: - filter: 'git-windows' - - - name: Build base images - uses: ./.github/actions/build - - - name: Build chapter images - uses: ./.github/actions/build - with: - images: 'false' - chapters: 'true' diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index ae9a248..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dotnet.defaultSolution": "disable", - "workbench.colorTheme": "Default High Contrast Light", - "terminal.integrated.fontSize": 12 -} \ No newline at end of file diff --git a/build/build.ps1 b/build/build.ps1 index 5668f01..602094a 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -72,11 +72,11 @@ try { if ($Filter -and ($Filter -ne '')) { docker compose $composeFiles build --pull $Filter - docker compose $composeFiles push $Filter + docker compose $composeFiles push -q $Filter } else { docker compose $composeFiles build --pull - docker compose $composeFiles push + docker compose $composeFiles push -q } } diff --git a/build/push-manifests.ps1 b/build/push-manifests.ps1 index 2cddcb0..d4ffaa8 100644 --- a/build/push-manifests.ps1 +++ b/build/push-manifests.ps1 @@ -5,6 +5,15 @@ param( ) try { + + echo '------------------' + echo 'Build info' + echo '------------------' + echo "Images = $Images" + echo "Chapters = $Chapters" + echo "Filter = $Filter" + echo '------------------' + $collection='images' if ($Chapters) { $collection='chapters' @@ -23,18 +32,34 @@ try { $imageList = $allImages | where {$_ -eq $Filter} } + $variants = @( + "linux-arm64", + "linux-amd64", + "windows-ltsc2019-amd64", + "windows-ltsc2022-amd64", + "windows-ltsc2025-amd64" + ) + + $manifestMediaType='application/vnd.docker.distribution.manifest.v2+json' + foreach ($image in $imageList) { - docker manifest rm $image + echo "* Processing image: $image" + $variantList = @() + foreach ($variant in $variants) { + $ref = "$($image)-$variant" + $manifest = docker manifest inspect $ref | ConvertFrom-Json + if ($null -ne $manifest -and $manifest.mediaType -eq $manifestMediaType) { + $variantList += $ref + echo "** Image variant found. Will add to manifest list: $ref" + } + else { + echo "** Image variant found. Skipping: $ref" + } + } - # TODO - add other OS & archs - docker manifest create --amend $image ` - "$($image)-linux-arm64" ` - "$($image)-linux-amd64" ` - "$($image)-windows-ltsc2019-amd64" ` - "$($image)-windows-ltsc2022-amd64"` - "$($image)-windows-ltsc2025-amd64" - + docker manifest rm $image + docker manifest create --amend $image @variantList docker manifest push $image docker pull $image }