Skip to content

Commit

Permalink
Merge pull request #111 from theohbrothers/refactor/ci-use-a-job-grou…
Browse files Browse the repository at this point in the history
…p-key-to-group-jobs

Refactor (ci): Use a `job_group_key` to group jobs
  • Loading branch information
leojonathanoh authored Sep 25, 2023
2 parents 625833f + 4257114 commit 046d478
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"-c",
"Generate-DockerImageVariants ."
],
"group": {
"kind": "build",
"isDefault": true
}
"group": "build"
},
{
"label": "Install DockerImageVariants module",
Expand Down
1 change: 1 addition & 0 deletions generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ $VARIANTS = @(
distro_version = $variant['distro_version']
platforms = 'linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x'
components = $subVariant['components']
job_group_key = $variant['package_version']
}
# Docker image tag. E.g. 'v2.3.0.0-alpine-3.6'
tag = @(
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/.github/workflows/ci-master-pr.yml.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
@"
Expand Down

0 comments on commit 046d478

Please sign in to comment.