Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/drupal-contrib-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ jobs:
run:
shell: bash -euo pipefail {0}
env:
WORKSPACE_NAME: gc-${{ matrix.project }}-d${{ matrix.drupal_version }}-${{ github.run_number }}-${{ github.run_attempt }}
WORKSPACE_NAME: gc-${{ matrix.project }}-d${{ matrix.drupal_version }}-${{ github.event.pull_request.number && format('pr{0}', github.event.pull_request.number) || github.ref_name == 'main' && 'main' || format('x{0}', github.run_number) }}-${{ github.run_number }}-${{ github.run_attempt }}
CI: "true"
DDEV_NONINTERACTIVE: "true"
NO_COLOR: "1"
Expand Down Expand Up @@ -512,7 +512,7 @@ jobs:
--variable github_token=${{ secrets.GITHUB_TOKEN }}

- name: Reap predecessor workspaces (cancelled prior runs of this cell)
run: ./scripts/ci-reap-family.sh "gc-${{ matrix.project }}-d${{ matrix.drupal_version }}-" "${{ env.WORKSPACE_NAME }}"
run: ./scripts/ci-reap-family.sh "${WORKSPACE_NAME%-*-*}-" "$WORKSPACE_NAME"

- name: Acquire staging box lock
run: ./scripts/ci-acquire-staging-lock.sh
Expand Down Expand Up @@ -696,7 +696,7 @@ jobs:
run:
shell: bash -euo pipefail {0}
env:
WORKSPACE_NAME: gc-fork-${{ github.run_number }}-${{ github.run_attempt }}
WORKSPACE_NAME: gc-fork-${{ github.event.pull_request.number && format('pr{0}', github.event.pull_request.number) || github.ref_name == 'main' && 'main' || format('x{0}', github.run_number) }}-${{ github.run_number }}-${{ github.run_attempt }}
CI: "true"
DDEV_NONINTERACTIVE: "true"
NO_COLOR: "1"
Expand Down Expand Up @@ -765,7 +765,7 @@ jobs:
--variable github_token=${{ secrets.GITHUB_TOKEN }}

- name: Reap predecessor workspaces (cancelled prior runs of this cell)
run: ./scripts/ci-reap-family.sh "gc-fork-" "${{ env.WORKSPACE_NAME }}"
run: ./scripts/ci-reap-family.sh "${WORKSPACE_NAME%-*-*}-" "$WORKSPACE_NAME"

- name: Acquire staging box lock
run: ./scripts/ci-acquire-staging-lock.sh
Expand Down Expand Up @@ -906,7 +906,7 @@ jobs:
run:
shell: bash -euo pipefail {0}
env:
WORKSPACE_NAME: gc-glfork-${{ github.run_number }}-${{ github.run_attempt }}
WORKSPACE_NAME: gc-glfork-${{ github.event.pull_request.number && format('pr{0}', github.event.pull_request.number) || github.ref_name == 'main' && 'main' || format('x{0}', github.run_number) }}-${{ github.run_number }}-${{ github.run_attempt }}
CI: "true"
DDEV_NONINTERACTIVE: "true"
NO_COLOR: "1"
Expand Down Expand Up @@ -975,7 +975,7 @@ jobs:
--variable github_token=${{ secrets.GITHUB_TOKEN }}

- name: Reap predecessor workspaces (cancelled prior runs of this cell)
run: ./scripts/ci-reap-family.sh "gc-glfork-" "${{ env.WORKSPACE_NAME }}"
run: ./scripts/ci-reap-family.sh "${WORKSPACE_NAME%-*-*}-" "$WORKSPACE_NAME"

- name: Acquire staging box lock
run: ./scripts/ci-acquire-staging-lock.sh
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/drupal-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ jobs:
run:
shell: bash -euo pipefail {0}
env:
WORKSPACE_NAME: gd-${{ matrix.drupal_version }}-${{ github.run_number }}-${{ github.run_attempt }}
WORKSPACE_NAME: gd-${{ matrix.drupal_version }}-${{ github.event.pull_request.number && format('pr{0}', github.event.pull_request.number) || github.ref_name == 'main' && 'main' || format('x{0}', github.run_number) }}-${{ github.run_number }}-${{ github.run_attempt }}
CI: "true"
DDEV_NONINTERACTIVE: "true"
NO_COLOR: "1"
Expand Down Expand Up @@ -290,7 +290,7 @@ jobs:
--variable github_token=${{ secrets.GITHUB_TOKEN }}

- name: Reap predecessor workspaces (cancelled prior runs of this cell)
run: ./scripts/ci-reap-family.sh "gd-${{ matrix.drupal_version }}-" "${{ env.WORKSPACE_NAME }}"
run: ./scripts/ci-reap-family.sh "${WORKSPACE_NAME%-*-*}-" "$WORKSPACE_NAME"

- name: Acquire staging box lock
run: ./scripts/ci-acquire-staging-lock.sh
Expand Down Expand Up @@ -568,7 +568,7 @@ jobs:
run:
shell: bash -euo pipefail {0}
env:
WORKSPACE_NAME: gd-fork-${{ github.run_number }}-${{ github.run_attempt }}
WORKSPACE_NAME: gd-fork-${{ github.event.pull_request.number && format('pr{0}', github.event.pull_request.number) || github.ref_name == 'main' && 'main' || format('x{0}', github.run_number) }}-${{ github.run_number }}-${{ github.run_attempt }}
CI: "true"
DDEV_NONINTERACTIVE: "true"
NO_COLOR: "1"
Expand Down Expand Up @@ -621,7 +621,7 @@ jobs:
--variable github_token=${{ secrets.GITHUB_TOKEN }}

- name: Reap predecessor workspaces (cancelled prior runs of this cell)
run: ./scripts/ci-reap-family.sh "gd-fork-" "${{ env.WORKSPACE_NAME }}"
run: ./scripts/ci-reap-family.sh "${WORKSPACE_NAME%-*-*}-" "$WORKSPACE_NAME"

- name: Acquire staging box lock
run: ./scripts/ci-acquire-staging-lock.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ jobs:
shell: bash -euo pipefail {0}
env:
CI_TAG: ${{ github.run_number }}-${{ github.run_attempt }}
WORKSPACE_NAME: gh-${{ matrix.ws_name }}-${{ github.run_number }}-${{ github.run_attempt }}
WORKSPACE_NAME: gh-${{ matrix.ws_name }}-${{ github.event.pull_request.number && format('pr{0}', github.event.pull_request.number) || github.ref_name == 'main' && 'main' || format('x{0}', github.run_number) }}-${{ github.run_number }}-${{ github.run_attempt }}
CI: "true"
DDEV_NONINTERACTIVE: "true"
NO_COLOR: "1"
Expand Down Expand Up @@ -363,7 +363,7 @@ jobs:
${{ matrix.extra_vars }}

- name: Reap predecessor workspaces (cancelled prior runs of this cell)
run: ./scripts/ci-reap-family.sh "gh-${{ matrix.ws_name }}-" "${{ env.WORKSPACE_NAME }}"
run: ./scripts/ci-reap-family.sh "${WORKSPACE_NAME%-*-*}-" "$WORKSPACE_NAME"

- name: Acquire staging box lock
run: ./scripts/ci-acquire-staging-lock.sh
Expand Down
14 changes: 11 additions & 3 deletions scripts/ci-reap-family.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@
# its own family and can delete any older sibling before creating its own.
#
# Workspace names are <family>-<run_number>-<run_attempt> (e.g.
# gc-pathauto-d11-152-1). The family is the stable part shared across runs of
# the same matrix cell. Passing the family prefix here deletes every ci-bot
# workspace that starts with it EXCEPT the one this run is about to create.
# gc-pathauto-d11-pr212-152-1). The family is the stable part shared across
# runs of the same matrix cell ON THE SAME REF. Passing the family prefix here
# deletes every ci-bot workspace that starts with it EXCEPT the one this run
# is about to create.
#
# The family MUST include a ref tag (pr<N> for pull requests, main for
# push/schedule/dispatch on main, x<run_number> elsewhere). Runs on different
# refs are in different concurrency groups and legitimately overlap; without
# the ref tag, a PR run's reap would delete main's in-flight workspace (this
# happened on main run 407, deleted by PR run 408). Callers derive the family
# from WORKSPACE_NAME as "${WORKSPACE_NAME%-*-*}-" so the two cannot drift.
#
# Usage:
# ci-reap-family.sh <family-prefix> [keep-name]
Expand Down
Loading