From 63f22642769ec1999e9bc288c0d3f2aa11e5ab6d Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Mon, 25 Sep 2023 15:37:36 +0000 Subject: [PATCH] Refactor (ci): Use a `job_group_key` to group jobs --- .github/workflows/ci-master-pr.yml | 2 +- .vscode/tasks.json | 5 +---- generate/definitions/VARIANTS.ps1 | 2 +- generate/templates/.github/workflows/ci-master-pr.yml.ps1 | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-master-pr.yml b/.github/workflows/ci-master-pr.yml index 1d02d23..2672ac5 100644 --- a/.github/workflows/ci-master-pr.yml +++ b/.github/workflows/ci-master-pr.yml @@ -14,7 +14,7 @@ jobs: test-nogitdiff: runs-on: ubuntu-latest container: - image: mcr.microsoft.com/powershell:7.2.2-alpine-3.14-20220318 + image: mcr.microsoft.com/powershell:lts-7.2-alpine-3.17 steps: - run: | apk add --no-cache git diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5d409e9..1ed2a74 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,10 +11,7 @@ "-c", "Generate-DockerImageVariants ." ], - "group": { - "kind": "build", - "isDefault": true - } + "group": "build" }, { "label": "Install DockerImageVariants module", diff --git a/generate/definitions/VARIANTS.ps1 b/generate/definitions/VARIANTS.ps1 index b75f921..946888f 100644 --- a/generate/definitions/VARIANTS.ps1 +++ b/generate/definitions/VARIANTS.ps1 @@ -25,7 +25,6 @@ $VARIANTS = @( @{ # Metadata object _metadata = @{ - package_version = $variant['distro_version'] distro = $variant['distro'] distro_version = $variant['distro_version'] platforms = & { @@ -36,6 +35,7 @@ $VARIANTS = @( } } components = $subVariant['components'] + job_group_key = $variant['distro_version'] } # Docker image tag. E.g. '3.8-curl' tag = @( diff --git a/generate/templates/.github/workflows/ci-master-pr.yml.ps1 b/generate/templates/.github/workflows/ci-master-pr.yml.ps1 index c73c08f..9be7359 100644 --- a/generate/templates/.github/workflows/ci-master-pr.yml.ps1 +++ b/generate/templates/.github/workflows/ci-master-pr.yml.ps1 @@ -15,7 +15,7 @@ jobs: test-nogitdiff: runs-on: ubuntu-latest container: - image: mcr.microsoft.com/powershell:7.2.2-alpine-3.14-20220318 + image: mcr.microsoft.com/powershell:lts-7.2-alpine-3.17 steps: - run: | apk add --no-cache git @@ -36,7 +36,7 @@ jobs: '@ # Group variants by the package version -$groups = $VARIANTS | Group-Object -Property { $_['_metadata']['package_version'] } | Sort-Object -Property { [version]$_.Name } -Descending +$groups = $VARIANTS | Group-Object -Property { $_['_metadata']['job_group_key'] } | Sort-Object { [version]$_.Name.Split('-')[0] } -Descending $WORKFLOW_JOB_NAMES = $groups | % { "build-$( $_.Name.Replace('.', '-') )" } foreach ($g in $groups) { @"