Skip to content

Commit b101dff

Browse files
mistercrunchrusackas
authored andcommitted
chore: prevent CI double runs on push + pull_request (#26766)
1 parent 3a2865f commit b101dff

17 files changed

+132
-31
lines changed

.github/workflows/check_db_migration_confict.yml

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ on:
33
push:
44
paths:
55
- "superset/migrations/**"
6+
branches:
7+
- 'master'
8+
pull_request:
9+
paths:
10+
- "superset/migrations/**"
11+
types: [synchronize, opened, reopened, ready_for_review]
612

713
jobs:
814
check_db_migration_conflict:

.github/workflows/docker.yml

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ jobs:
3333
matrix:
3434
target: ["dev", "lean", "lean310", "websocket", "dockerize"]
3535
platform: ["linux/amd64", "linux/arm64"]
36+
exclude:
37+
# disabling because slow! no python wheels for arm/py39 and
38+
# QEMU is slow!
39+
- target: "dev"
40+
platform: "linux/arm64"
41+
- target: "lean"
42+
platform: "linux/arm64"
3643
fail-fast: false
3744
steps:
3845
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"

.github/workflows/license-check.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: License Check
22

33
on:
44
push:
5-
branches-ignore:
6-
- "dependabot/**"
5+
branches:
6+
- 'master'
77
pull_request:
8+
types: [synchronize, opened, reopened, ready_for_review]
89

910
jobs:
1011
config:

.github/workflows/no-op.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# no-op.yml
2+
#
3+
# Purpose:
4+
# This workflow provides a workaround for the "required status checks" feature in GitHub Actions
5+
# when using path-specific conditions in other workflows. Required checks might remain in a "Pending"
6+
# state if the conditions are not met, thus blocking pull requests from being merged.
7+
# This no-op (no operation) workflow provides dummy success statuses for these required jobs when
8+
# the real jobs do not run due to path-specific conditions.
9+
#
10+
# How it works:
11+
# - It defines jobs with the same names as the required jobs in the main workflows.
12+
# - These jobs simply execute a command (`exit 0`) to succeed immediately.
13+
# - When a pull request is created or updated, both this no-op workflow and the main workflows are triggered.
14+
# - If the main workflows' jobs don't run (due to path conditions), these no-op jobs provide successful statuses.
15+
# - If the main workflows' jobs do run and fail, their failure statuses take precedence,
16+
# ensuring that pull requests are not merged with failing checks.
17+
#
18+
# Usage:
19+
# - Ensure that the job names in this workflow match exactly the names of the corresponding jobs in the main workflows.
20+
# - This workflow should be kept as-is, without path-specific conditions.
21+
22+
name: No Operation Checks
23+
on: pull_request
24+
25+
jobs:
26+
frontend-build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: No-op for frontend-build
30+
run: |
31+
echo "This is a no-op step for frontend-build to ensure a successful status."
32+
exit 0
33+
34+
pre-commit:
35+
strategy:
36+
matrix:
37+
python-version: ["3.9"]
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: No-op for pre-commit
41+
run: |
42+
echo "This is a no-op step for pre-commit to ensure a successful status."
43+
exit 0
44+
45+
python-lint:
46+
strategy:
47+
matrix:
48+
python-version: ["3.9"]
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: No-op for python-lint
52+
run: |
53+
echo "This is a no-op step for python-lint to ensure a successful status."
54+
exit 0

.github/workflows/prefer-typescript.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ name: Prefer TypeScript
22

33
on:
44
push:
5-
branches-ignore:
6-
- "dependabot/**"
5+
branches:
6+
- 'master'
7+
paths:
8+
- "superset-frontend/src/**"
79
pull_request:
8-
10+
types: [synchronize, opened, reopened, ready_for_review]
11+
paths:
12+
- "superset-frontend/src/**"
913
jobs:
1014
prefer_typescript:
1115
if: github.ref == 'ref/heads/master' && github.event_name == 'pull_request'

.github/workflows/superset-cli.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Superset CLI tests
22

33
on:
44
push:
5-
branches-ignore:
6-
- "dependabot/npm_and_yarn/**"
5+
branches:
6+
- 'master'
77
pull_request:
88
types: [synchronize, opened, reopened, ready_for_review]
99

.github/workflows/superset-docs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ on:
44
push:
55
paths:
66
- "docs/**"
7+
branches:
8+
- 'master'
79
pull_request:
810
paths:
911
- "docs/**"
12+
types: [synchronize, opened, reopened, ready_for_review]
1013

1114
jobs:
1215
config:

.github/workflows/superset-e2e.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ name: E2E
22

33
on:
44
push:
5-
branches-ignore:
6-
- "dependabot/**/docs/**"
7-
paths-ignore:
8-
- "docs/**"
5+
branches:
6+
- 'master'
97
pull_request:
108
types: [synchronize, opened, reopened, ready_for_review]
119

.github/workflows/superset-frontend.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ name: Frontend
22

33
on:
44
push:
5-
branches-ignore:
6-
- "dependabot/**/docs/**"
7-
- "dependabot/**/cypress-base/**"
5+
branches:
6+
- "master"
7+
paths:
8+
- "superset-frontend/**"
89
pull_request:
910
types: [synchronize, opened, reopened, ready_for_review]
11+
paths:
12+
- "superset-frontend/**"
1013

1114
jobs:
1215
frontend-build:

.github/workflows/superset-helm-lint.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Lint and Test Charts
33
on:
44
pull_request:
55
types: [opened, edited, reopened, synchronize]
6+
paths:
7+
- "helm/**"
68

79
jobs:
810
lint-test:

.github/workflows/superset-python-integrationtest.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Python-Integration
33

44
on:
55
push:
6-
branches-ignore:
7-
- "dependabot/npm_and_yarn/**"
6+
branches:
7+
- 'master'
88
pull_request:
99
types: [synchronize, opened, reopened, ready_for_review]
1010

.github/workflows/superset-python-misc.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ name: Python Misc
33

44
on:
55
push:
6-
branches-ignore:
7-
- "dependabot/npm_and_yarn/**"
6+
branches:
7+
- 'master'
8+
paths:
9+
- "superset/**"
810
pull_request:
911
types: [synchronize, opened, reopened, ready_for_review]
12+
paths:
13+
- "superset/**"
1014

1115
jobs:
1216
python-lint:

.github/workflows/superset-python-presto-hive.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ name: Python Presto/Hive
33

44
on:
55
push:
6-
branches-ignore:
7-
- "dependabot/npm_and_yarn/**"
6+
branches:
7+
- 'master'
8+
paths:
9+
- "superset/**"
810
pull_request:
911
types: [synchronize, opened, reopened, ready_for_review]
12+
paths:
13+
- "superset/**"
1014

1115
jobs:
1216
test-postgres-presto:

.github/workflows/superset-python-unittest.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ name: Python-Unit
33

44
on:
55
push:
6-
branches-ignore:
7-
- "dependabot/npm_and_yarn/**"
6+
branches:
7+
- 'master'
8+
paths:
9+
- "superset/**"
810
pull_request:
911
types: [synchronize, opened, reopened, ready_for_review]
12+
paths:
13+
- "superset/**"
1014

1115
jobs:
1216
unit-tests:

.github/workflows/superset-translations.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Translations
22

33
on:
44
push:
5-
branches-ignore:
6-
- "dependabot/npm_and_yarn/**"
5+
branches:
6+
- 'master'
77
pull_request:
88
types: [synchronize, opened, reopened, ready_for_review]
99

.github/workflows/superset-websocket.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: WebSocket server
22
on:
33
push:
4+
branches:
5+
- 'master'
46
paths:
57
- "superset-websocket/**"
68
pull_request:
79
paths:
810
- "superset-websocket/**"
11+
types: [synchronize, opened, reopened, ready_for_review]
912

1013
jobs:
1114
app-checks:

scripts/docker_build_push.sh

+15-7
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,31 @@ fi
7070

7171
BUILD_ARG="3.9-slim-bookworm"
7272

73+
# Replace '/' with '-' in BUILD_PLATFORM
74+
SAFE_BUILD_PLATFORM=$(echo "${BUILD_PLATFORM}" | sed 's/\//-/g')
75+
MAIN_UNIQUE_TAG="${REPO_NAME}:${SHA}-${TARGET}-${SAFE_BUILD_PLATFORM}-${BUILD_ARG}"
76+
7377
case "${TARGET}" in
7478
"dev")
75-
DOCKER_TAGS="-t ${REPO_NAME}:${SHA}-dev -t ${REPO_NAME}:${REFSPEC}-dev -t ${DEV_TAG}"
79+
DOCKER_TAGS="-t ${MAIN_UNIQUE_TAG} -t ${REPO_NAME}:${SHA}-dev -t ${REPO_NAME}:${REFSPEC}-dev -t ${DEV_TAG}"
7680
BUILD_TARGET="dev"
7781
;;
7882
"lean")
79-
DOCKER_TAGS="-t ${REPO_NAME}:${SHA} -t ${REPO_NAME}:${REFSPEC} -t ${REPO_NAME}:${LATEST_TAG}"
83+
DOCKER_TAGS="-t ${MAIN_UNIQUE_TAG} -t ${REPO_NAME}:${SHA} -t ${REPO_NAME}:${REFSPEC} -t ${REPO_NAME}:${LATEST_TAG}"
8084
BUILD_TARGET="lean"
8185
;;
8286
"lean310")
83-
DOCKER_TAGS="-t ${REPO_NAME}:${SHA}-py310 -t ${REPO_NAME}:${REFSPEC}-py310 -t ${REPO_NAME}:${LATEST_TAG}-py310"
87+
DOCKER_TAGS="-t ${MAIN_UNIQUE_TAG} -t ${REPO_NAME}:${SHA}-py310 -t ${REPO_NAME}:${REFSPEC}-py310 -t ${REPO_NAME}:${LATEST_TAG}-py310"
8488
BUILD_TARGET="lean"
8589
BUILD_ARG="3.10-slim-bookworm"
8690
;;
8791
"websocket")
88-
DOCKER_TAGS="-t ${REPO_NAME}:${SHA}-websocket -t ${REPO_NAME}:${REFSPEC}-websocket -t ${REPO_NAME}:${LATEST_TAG}-websocket"
92+
DOCKER_TAGS="-t ${MAIN_UNIQUE_TAG} -t ${REPO_NAME}:${SHA}-websocket -t ${REPO_NAME}:${REFSPEC}-websocket -t ${REPO_NAME}:${LATEST_TAG}-websocket"
8993
BUILD_TARGET=""
9094
DOCKER_CONTEXT="superset-websocket"
9195
;;
9296
"dockerize")
93-
DOCKER_TAGS="-t ${REPO_NAME}:dockerize"
97+
DOCKER_TAGS="-t ${MAIN_UNIQUE_TAG} -t ${REPO_NAME}:dockerize"
9498
BUILD_TARGET=""
9599
DOCKER_CONTEXT="-f dockerize.Dockerfile ."
96100
;;
@@ -102,6 +106,7 @@ esac
102106

103107
cat<<EOF
104108
Rolling with tags:
109+
- $MAIN_UNIQUE_TAG
105110
- ${REPO_NAME}:${SHA}
106111
- ${REPO_NAME}:${REFSPEC}
107112
- ${REPO_NAME}:${LATEST_TAG}
@@ -125,11 +130,14 @@ if [[ -n "${BUILD_TARGET}" ]]; then
125130
TARGET_ARGUMENT="--target ${BUILD_TARGET}"
126131
fi
127132

133+
CACHE_REF="${REPO_NAME}-cache:${TARGET}-${BUILD_ARG}"
134+
CACHE_REF=$(echo "${CACHE_REF}" | tr -d '.')
135+
128136
docker buildx build \
129137
${TARGET_ARGUMENT} \
130138
${DOCKER_ARGS} \
131-
--cache-from=type=registry,ref=apache/superset:${TARGET} \
132-
--cache-to=type=registry,mode=max,ref=apache/superset:${TARGET} \
139+
--cache-from=type=registry,ref=${CACHE_REF} \
140+
--cache-to=type=registry,mode=max,ref=${CACHE_REF} \
133141
${DOCKER_TAGS} \
134142
--platform ${BUILD_PLATFORM} \
135143
--label "sha=${SHA}" \

0 commit comments

Comments
 (0)