Skip to content

Commit f280fe6

Browse files
adamanciniclaude
andcommitted
fix: add workflow run number to cluster names to prevent duplicates
The PR validation workflow was creating duplicate cluster names across multiple workflow runs, causing cluster creation failures. Updated all cluster name generation to include github.run_number, ensuring unique cluster names for each workflow execution. Pattern changed from: {channel-name}-{k8s-version}-{distribution} To: {channel-name}-{k8s-version}-{distribution}-{run-number} 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent b68a217 commit f280fe6

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/wg-easy-pr-validation.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@ jobs:
342342
set +e # Disable exit on error to handle failures gracefully
343343
344344
# Normalize cluster name to match task expectations (replace dots with dashes)
345+
# Include run number to ensure unique cluster names across workflow runs
345346
K8S_VERSION_NORMALIZED=$(echo "${{ matrix.k8s-version }}" | tr '.' '-')
346-
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}"
347+
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}-${{ github.run_number }}"
347348
echo "Checking for existing cluster: $CLUSTER_NAME"
348349
349350
# Get clusters with error handling
@@ -467,8 +468,9 @@ jobs:
467468
set +e # Disable exit on error to handle failures gracefully
468469
469470
# Normalize cluster name to match task expectations (replace dots with dashes)
471+
# Include run number to ensure unique cluster names across workflow runs
470472
K8S_VERSION_NORMALIZED=$(echo "${{ matrix.k8s-version }}" | tr '.' '-')
471-
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}"
473+
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}-${{ github.run_number }}"
472474
echo "Creating cluster: $CLUSTER_NAME"
473475
474476
# Use the replicated CLI to create the cluster with normalized name
@@ -535,8 +537,9 @@ jobs:
535537
working-directory: ${{ env.APP_DIR }}
536538
run: |
537539
# Normalize cluster name to match task expectations (replace dots with dashes)
540+
# Include run number to ensure unique cluster names across workflow runs
538541
K8S_VERSION_NORMALIZED=$(echo "${{ matrix.k8s-version }}" | tr '.' '-')
539-
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}"
542+
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}-${{ github.run_number }}"
540543
task cluster-ports-expose CLUSTER_NAME="$CLUSTER_NAME"
541544
542545
- name: Validate cluster readiness
@@ -608,8 +611,9 @@ jobs:
608611
id: set-cluster-matrix
609612
run: |
610613
# Create cluster info for test deployment job
614+
# Include run number to ensure unique cluster names across workflow runs
611615
K8S_VERSION_NORMALIZED=$(echo "${{ matrix.k8s-version }}" | tr '.' '-')
612-
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}"
616+
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}-${{ github.run_number }}"
613617
614618
CLUSTER_ID="${{ steps.set-cluster-outputs.outputs.cluster-id }}"
615619
@@ -663,8 +667,9 @@ jobs:
663667
shell: bash
664668
run: |
665669
# Normalize cluster name to match task expectations (replace dots with dashes)
670+
# Include run number to ensure unique cluster names across workflow runs
666671
K8S_VERSION_NORMALIZED=$(echo "${{ matrix.k8s-version }}" | tr '.' '-')
667-
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}"
672+
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}-${{ github.run_number }}"
668673
669674
echo "Getting kubeconfig for cluster: $CLUSTER_NAME"
670675
@@ -685,8 +690,9 @@ jobs:
685690
working-directory: ${{ env.APP_DIR }}
686691
run: |
687692
# Normalize cluster name to match task expectations (replace dots with dashes)
693+
# Include run number to ensure unique cluster names across workflow runs
688694
K8S_VERSION_NORMALIZED=$(echo "${{ matrix.k8s-version }}" | tr '.' '-')
689-
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}"
695+
CLUSTER_NAME="${{ needs.setup.outputs.channel-name }}-$K8S_VERSION_NORMALIZED-${{ matrix.distribution }}-${{ github.run_number }}"
690696
task customer-helm-install \
691697
CUSTOMER_NAME="${{ needs.setup.outputs.customer-name }}" \
692698
CLUSTER_NAME="$CLUSTER_NAME" \

0 commit comments

Comments
 (0)