Skip to content

Commit 5fb8fc5

Browse files
committed
ci: dispatch image builds manually
1 parent 87abf1c commit 5fb8fc5

1 file changed

Lines changed: 10 additions & 49 deletions

File tree

.github/workflows/build_image.yml

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,6 @@
1515
name: Build Docker Images
1616

1717
on:
18-
push:
19-
branches:
20-
- main
21-
- 'ci/**'
22-
paths:
23-
- 'docker/**'
24-
- 'tools/install/**'
25-
- 'requirements/**'
26-
- '.github/configs/**'
27-
- '.github/workflows/build_image.yml'
28-
- '.github/workflows/build_image_common.yml'
29-
pull_request:
30-
branches: [main]
31-
paths:
32-
- 'docker/**'
33-
- 'tools/install/**'
34-
- 'requirements/**'
35-
- '.github/configs/**'
36-
- '.github/workflows/build_image.yml'
37-
- '.github/workflows/build_image_common.yml'
3818
workflow_dispatch:
3919
inputs:
4020
platform:
@@ -98,8 +78,8 @@ jobs:
9878
- name: Checkout source
9979
uses: actions/checkout@v4
10080
with:
101-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
102-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
81+
repository: ${{ github.repository }}
82+
ref: ${{ github.sha }}
10383
persist-credentials: false
10484

10585
- name: Install yq
@@ -113,17 +93,14 @@ jobs:
11393
id: prepare
11494
shell: bash
11595
env:
116-
EVENT_NAME: ${{ github.event_name }}
11796
INPUT_PLATFORM: ${{ inputs.platform }}
11897
INPUT_TASKS: ${{ inputs.tasks }}
11998
INPUT_BUILD_IMAGES: ${{ inputs.build_images }}
12099
INPUT_RUN_TESTS: ${{ inputs.run_tests }}
121100
INPUT_PUSH: ${{ inputs.push }}
122101
INPUT_NO_CACHE: ${{ inputs.no_cache }}
123102
INPUT_TARGET: ${{ inputs.target }}
124-
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
125-
BASE_REPOSITORY: ${{ github.repository }}
126-
GITHUB_TOKEN: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository && 'unavailable' || github.token }}
103+
GITHUB_TOKEN: ${{ github.token }}
127104
run: |
128105
set -euo pipefail
129106
@@ -137,29 +114,13 @@ jobs:
137114
python3 tools/install/utils/resolve_source_refs.py --validate-only >/dev/null
138115
139116
execute=true
140-
if [ "$EVENT_NAME" = workflow_dispatch ]; then
141-
selected_platform="${INPUT_PLATFORM:-all}"
142-
tasks="${INPUT_TASKS:-all_tasks}"
143-
build_images="${INPUT_BUILD_IMAGES:-true}"
144-
run_tests="${INPUT_RUN_TESTS:-true}"
145-
push="${INPUT_PUSH:-true}"
146-
no_cache="${INPUT_NO_CACHE:-false}"
147-
target="${INPUT_TARGET:-}"
148-
else
149-
selected_platform=all
150-
tasks=all_tasks
151-
build_images=true
152-
run_tests=true
153-
push=true
154-
no_cache=false
155-
target=''
156-
if [ "$EVENT_NAME" = pull_request ] && \
157-
[ "$HEAD_REPOSITORY" != "$BASE_REPOSITORY" ]; then
158-
build_images=false
159-
push=false
160-
echo "::notice::Fork PR will run tests with the validated Harbor images; image build and push are disabled for this event"
161-
fi
162-
fi
117+
selected_platform="${INPUT_PLATFORM:-all}"
118+
tasks="${INPUT_TASKS:-all_tasks}"
119+
build_images="${INPUT_BUILD_IMAGES:-true}"
120+
run_tests="${INPUT_RUN_TESTS:-true}"
121+
push="${INPUT_PUSH:-true}"
122+
no_cache="${INPUT_NO_CACHE:-false}"
123+
target="${INPUT_TARGET:-}"
163124
164125
if [[ ! "$selected_platform" =~ ^(all|[a-z0-9_-]+)$ ]]; then
165126
echo "::error::Invalid platform: $selected_platform"

0 commit comments

Comments
 (0)