workflows/test: prefix artifacts

Once we start running similar jobs in the PR and Merge Queue workflows,
the Test workflow will run into a problem: Both nested workflows will
try to upload the same artifacts, which errors out.

By providing a prefix to use for artifact names, this will be a
non-issue when we later run more of Eval in the merge queue or when we
add the build jobs to the queue as well.
This commit is contained in:
Wolfgang Walther
2025-10-27 15:16:58 +01:00
parent bffec9a322
commit 67506595ac
6 changed files with 36 additions and 7 deletions

View File

@@ -3,6 +3,9 @@ name: Build
on: on:
workflow_call: workflow_call:
inputs: inputs:
artifact-prefix:
required: true
type: string
baseBranch: baseBranch:
required: true required: true
type: string type: string
@@ -100,5 +103,5 @@ jobs:
contains(fromJSON(inputs.baseBranch).type, 'primary') contains(fromJSON(inputs.baseBranch).type, 'primary')
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with: with:
name: nixos-manual-${{ matrix.name }} name: ${{ inputs.artifact-prefix }}nixos-manual-${{ matrix.name }}
path: nixos-manual path: nixos-manual

View File

@@ -3,6 +3,9 @@ name: Eval
on: on:
workflow_call: workflow_call:
inputs: inputs:
artifact-prefix:
required: true
type: string
mergedSha: mergedSha:
required: true required: true
type: string type: string
@@ -145,7 +148,7 @@ jobs:
if: inputs.targetSha if: inputs.targetSha
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with: with:
name: ${{ matrix.version && format('{0}-', matrix.version) || '' }}diff-${{ matrix.system }} name: ${{ inputs.artifact-prefix }}${{ matrix.version && format('{0}-', matrix.version) || '' }}diff-${{ matrix.system }}
path: diff/* path: diff/*
compare: compare:
@@ -169,7 +172,7 @@ jobs:
- name: Download output paths and eval stats for all systems - name: Download output paths and eval stats for all systems
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with: with:
pattern: diff-* pattern: ${{ inputs.artifact-prefix }}diff-*
path: diff path: diff
merge-multiple: true merge-multiple: true
@@ -202,7 +205,7 @@ jobs:
- name: Upload the comparison results - name: Upload the comparison results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with: with:
name: comparison name: ${{ inputs.artifact-prefix }}comparison
path: comparison/* path: comparison/*
- name: Add eval summary to commit statuses - name: Add eval summary to commit statuses
@@ -250,6 +253,7 @@ jobs:
- name: Add version comparison table to job summary - name: Add version comparison table to job summary
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env: env:
ARTIFACT_PREFIX: ${{ inputs.artifact-prefix }}
SYSTEMS: ${{ inputs.systems }} SYSTEMS: ${{ inputs.systems }}
VERSIONS: ${{ needs.versions.outputs.versions }} VERSIONS: ${{ needs.versions.outputs.versions }}
with: with:
@@ -257,6 +261,7 @@ jobs:
const { readFileSync } = require('node:fs') const { readFileSync } = require('node:fs')
const path = require('node:path') const path = require('node:path')
const prefix = process.env.ARTIFACT_PREFIX
const systems = JSON.parse(process.env.SYSTEMS) const systems = JSON.parse(process.env.SYSTEMS)
const versions = JSON.parse(process.env.VERSIONS) const versions = JSON.parse(process.env.VERSIONS)
@@ -272,7 +277,7 @@ jobs:
[{ data: version }].concat( [{ data: version }].concat(
systems.map((system) => { systems.map((system) => {
try { try {
const artifact = path.join('versions', `${version}-diff-${system}`) const artifact = path.join('versions', `${prefix}${version}-diff-${system}`)
const time = Math.round( const time = Math.round(
parseFloat( parseFloat(
readFileSync( readFileSync(

View File

@@ -4,6 +4,9 @@ on:
merge_group: merge_group:
workflow_call: workflow_call:
inputs: inputs:
artifact-prefix:
required: true
type: string
mergedSha: mergedSha:
required: true required: true
type: string type: string
@@ -54,6 +57,7 @@ jobs:
secrets: secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
with: with:
artifact-prefix: ${{ inputs.artifact-prefix }}
mergedSha: ${{ inputs.mergedSha || github.event.merge_group.head_sha }} mergedSha: ${{ inputs.mergedSha || github.event.merge_group.head_sha }}
systems: ${{ needs.prepare.outputs.systems }} systems: ${{ needs.prepare.outputs.systems }}

View File

@@ -3,6 +3,10 @@ name: PR
on: on:
pull_request_target: pull_request_target:
workflow_call: workflow_call:
inputs:
artifact-prefix:
required: true
type: string
secrets: secrets:
CACHIX_AUTH_TOKEN: CACHIX_AUTH_TOKEN:
required: true required: true
@@ -85,6 +89,7 @@ jobs:
secrets: secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
with: with:
artifact-prefix: ${{ inputs.artifact-prefix }}
mergedSha: ${{ needs.prepare.outputs.mergedSha }} mergedSha: ${{ needs.prepare.outputs.mergedSha }}
targetSha: ${{ needs.prepare.outputs.targetSha }} targetSha: ${{ needs.prepare.outputs.targetSha }}
systems: ${{ needs.prepare.outputs.systems }} systems: ${{ needs.prepare.outputs.systems }}
@@ -111,6 +116,8 @@ jobs:
uses: ./.github/workflows/reviewers.yml uses: ./.github/workflows/reviewers.yml
secrets: secrets:
OWNER_APP_PRIVATE_KEY: ${{ secrets.OWNER_APP_PRIVATE_KEY }} OWNER_APP_PRIVATE_KEY: ${{ secrets.OWNER_APP_PRIVATE_KEY }}
with:
artifact-prefix: ${{ inputs.artifact-prefix }}
build: build:
name: Build name: Build
@@ -119,6 +126,7 @@ jobs:
secrets: secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
with: with:
artifact-prefix: ${{ inputs.artifact-prefix }}
baseBranch: ${{ needs.prepare.outputs.baseBranch }} baseBranch: ${{ needs.prepare.outputs.baseBranch }}
mergedSha: ${{ needs.prepare.outputs.mergedSha }} mergedSha: ${{ needs.prepare.outputs.mergedSha }}

View File

@@ -7,6 +7,10 @@ on:
pull_request_target: pull_request_target:
types: [ready_for_review] types: [ready_for_review]
workflow_call: workflow_call:
inputs:
artifact-prefix:
required: true
type: string
secrets: secrets:
OWNER_APP_PRIVATE_KEY: OWNER_APP_PRIVATE_KEY:
required: true required: true
@@ -91,6 +95,8 @@ jobs:
- name: Wait for comparison to be done - name: Wait for comparison to be done
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: eval id: eval
env:
ARTIFACT: ${{ inputs.artifact-prefix }}comparison
with: with:
script: | script: |
const run_id = (await github.rest.actions.listWorkflowRuns({ const run_id = (await github.rest.actions.listWorkflowRuns({
@@ -111,7 +117,7 @@ jobs:
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
run_id, run_id,
name: 'comparison' name: process.env.ARTIFACT,
}) })
if (result.data.total_count > 0) return if (result.data.total_count > 0) return
await new Promise(resolve => setTimeout(resolve, 5000)) await new Promise(resolve => setTimeout(resolve, 5000))
@@ -128,7 +134,7 @@ jobs:
with: with:
run-id: ${{ steps.eval.outputs.run-id }} run-id: ${{ steps.eval.outputs.run-id }}
github-token: ${{ github.token }} github-token: ${{ github.token }}
pattern: comparison pattern: ${{ inputs.artifact-prefix }}comparison
path: comparison path: comparison
merge-multiple: true merge-multiple: true

View File

@@ -79,6 +79,7 @@ jobs:
secrets: secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
with: with:
artifact-prefix: mg-
mergedSha: ${{ needs.prepare.outputs.mergedSha }} mergedSha: ${{ needs.prepare.outputs.mergedSha }}
targetSha: ${{ needs.prepare.outputs.targetSha }} targetSha: ${{ needs.prepare.outputs.targetSha }}
@@ -95,3 +96,5 @@ jobs:
secrets: secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
NIXPKGS_CI_APP_PRIVATE_KEY: ${{ secrets.NIXPKGS_CI_APP_PRIVATE_KEY }} NIXPKGS_CI_APP_PRIVATE_KEY: ${{ secrets.NIXPKGS_CI_APP_PRIVATE_KEY }}
with:
artifact-prefix: pr-