Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Add concurrency cancellation to all PR-triggered workflows (#4318)

Jan Høydahl38c8768664d8
diff --git a/.github/workflows/bin-solr-test.yml b/.github/workflows/bin-solr-test.yml
index 02f1c577af0..0e7369ad2cc 100644
--- a/.github/workflows/bin-solr-test.yml
+++ b/.github/workflows/bin-solr-test.yml
@@ -10,6 +10,10 @@ on:
- 'solr/packaging/**'
- 'solr/core/src/java/org/apache/solr/cli/**'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
test:
name: Run Solr Script Tests
diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml
index 74557283d92..7f40ee7807e 100644
--- a/.github/workflows/docker-test.yml
+++ b/.github/workflows/docker-test.yml
@@ -10,6 +10,10 @@ on:
- 'solr/docker/**'
- 'solr/packaging/**'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
test:
name: Build and test Docker image
diff --git a/.github/workflows/gradle-extraction-check.yml b/.github/workflows/gradle-extraction-check.yml
index 61b21cb4ca4..f2a3f645a8f 100644
--- a/.github/workflows/gradle-extraction-check.yml
+++ b/.github/workflows/gradle-extraction-check.yml
@@ -8,6 +8,10 @@ on:
paths:
- 'solr/modules/extraction/**'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
test:
name: extraction module tests with docker
diff --git a/.github/workflows/gradle-precommit.yml b/.github/workflows/gradle-precommit.yml
index 7cc7cd95cf9..1d878fb98b5 100644
--- a/.github/workflows/gradle-precommit.yml
+++ b/.github/workflows/gradle-precommit.yml
@@ -5,6 +5,10 @@ on:
branches:
- '*'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
test:
name: gradle check
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index c1e4751a1e9..3e51ade6a4e 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -2,6 +2,10 @@ name: "Pull Request Labeler"
on:
- pull_request_target
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
labeler:
permissions:
diff --git a/.github/workflows/renovate-changelog.yml b/.github/workflows/renovate-changelog.yml
index 21fcb76f3d2..efd0f57c186 100644
--- a/.github/workflows/renovate-changelog.yml
+++ b/.github/workflows/renovate-changelog.yml
@@ -10,6 +10,10 @@ on:
- main
- 'branch_*'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
permissions:
contents: write
pull-requests: write
diff --git a/.github/workflows/solrj-test.yml b/.github/workflows/solrj-test.yml
index 68942e7b87d..6ed6d5254ce 100644
--- a/.github/workflows/solrj-test.yml
+++ b/.github/workflows/solrj-test.yml
@@ -8,6 +8,10 @@ on:
- '.github/workflows/solrj-test.yml'
- 'solr/solrj/**'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
test:
name: Run SolrJ Tests
diff --git a/.github/workflows/tests-via-crave.yml b/.github/workflows/tests-via-crave.yml
index 1476d9c9660..b8b7e0b9db5 100644
--- a/.github/workflows/tests-via-crave.yml
+++ b/.github/workflows/tests-via-crave.yml
@@ -5,6 +5,10 @@ on:
branches:
- '*'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
test:
name: Run Solr Tests using Crave.io resources
@@ -12,24 +16,30 @@ jobs:
runs-on: self-hosted
timeout-minutes: 40
+ env:
+ # Use a PR-scoped workspace path so that each new run for the same PR
+ # destroys any leftover resources from a previous run (including cancelled
+ # runs whose cleanup step may not have completed in time).
+ CRAVE_WORKSPACE: /crave-devspaces/pipeline/prs/${{ github.event.pull_request.number }}
+
steps:
- name: Destroy previous clone
- run: crave clone destroy -y /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER} || echo "Clone did not exist"
+ run: crave clone destroy -y ${CRAVE_WORKSPACE} || echo "Clone did not exist"
continue-on-error: true
- name: Crave clone sources
- run: crave clone create --projectID 39 /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}
+ run: crave clone create --projectID 39 ${CRAVE_WORKSPACE}
- name: Checkout the correct branch
run: |
- git -C /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER} fetch origin ${GITHUB_REF}:${GITHUB_REF}
- git -C /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER} checkout ${GITHUB_REF}
+ git -C ${CRAVE_WORKSPACE} fetch origin ${GITHUB_REF}:${GITHUB_REF}
+ git -C ${CRAVE_WORKSPACE} checkout ${GITHUB_REF}
- name: Initialize, build, test
run: |
- cd /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}
+ cd ${CRAVE_WORKSPACE}
crave run --clean --message "PR: ${GITHUB_REF_NAME}" -- ./gradlew --console=plain test
- name: Cleanup
if: ${{ always() }}
run: |
- pushd /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}
+ pushd ${CRAVE_WORKSPACE}
crave stop --all
popd
- crave clone destroy -y /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}
+ crave clone destroy -y ${CRAVE_WORKSPACE}
diff --git a/.github/workflows/validate-changelog.yml b/.github/workflows/validate-changelog.yml
index 028ddd8c176..2d6c3a71d78 100644
--- a/.github/workflows/validate-changelog.yml
+++ b/.github/workflows/validate-changelog.yml
@@ -5,6 +5,10 @@ on:
branches:
- '*'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
jobs:
validate-changelog:
name: Check changelog entry