From 2efbbc827811c8cd8528b968cf9bff0c30475410 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Mon, 25 Sep 2023 16:07:39 +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 | 1 + generate/templates/.github/workflows/ci-master-pr.yml.ps1 | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-master-pr.yml b/.github/workflows/ci-master-pr.yml index 793ccbc..8125175 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 1f0bef4..e669d81 100755 --- a/generate/definitions/VARIANTS.ps1 +++ b/generate/definitions/VARIANTS.ps1 @@ -34,6 +34,7 @@ $VARIANTS = @( } } components = $subVariant['components'] + job_group_key = $variant['package_version'] } # Docker image tag. E.g. 'v1.5.2' 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) { @"