mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 08:09:27 +00:00
chore: make OSS Docker image build manual-only (#10190)
## Summary - Switch `build-pr-image.yml` from auto-triggering on every PR to `workflow_dispatch` only ## Why OSS Docker image builds on every PR waste CI compute. The image isn't always needed — developers can trigger it manually when required. --------- Co-authored-by: Yashodhan Joshi <yashodhan@openobserve.ai>
This commit is contained in:
co-authored by
Yashodhan Joshi
parent
c8663d6ef0
commit
c2ba47bdd8
@@ -1,56 +1,26 @@
|
||||
name: Build PR Docker Image
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to build (e.g., feature/my-branch)'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
group: ${{ github.workflow }}-${{ inputs.branch }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
AWS_REGION: us-east-1
|
||||
|
||||
jobs:
|
||||
check_changes:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
has_changes: ${{ steps.check_changes.outputs.has_changes }}
|
||||
should_build: ${{ steps.check_changes.outputs.should_build }}
|
||||
steps:
|
||||
- name: Clone the current repo
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check if relevant code has changes
|
||||
id: check_changes
|
||||
run: |
|
||||
if git diff --name-only origin/${{ github.base_ref || 'main' }} ${{ github.sha }} | grep -qvE '\.(md|yml|yaml)$'; then
|
||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# Also check if this is a non-fork PR
|
||||
if [ "${{ github.event_name }}" == "pull_request" ] && \
|
||||
[ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ] && \
|
||||
[ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]; then
|
||||
echo "should_build=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "should_build=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
build_pr_image_amd64:
|
||||
name: build_pr_image_amd64
|
||||
needs: check_changes
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
if: needs.check_changes.outputs.has_changes == 'true' && needs.check_changes.outputs.should_build == 'true'
|
||||
runs-on: ubicloud-standard-8
|
||||
steps:
|
||||
- name: Remove unused tools
|
||||
@@ -63,8 +33,8 @@ jobs:
|
||||
- name: Clone the current repo
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
repository: ${{ github.repository }}
|
||||
ref: ${{ inputs.branch }}
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
@@ -133,11 +103,9 @@ jobs:
|
||||
|
||||
build_pr_image_arm64:
|
||||
name: build_pr_image_arm64
|
||||
needs: check_changes
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
if: needs.check_changes.outputs.has_changes == 'true' && needs.check_changes.outputs.should_build == 'true'
|
||||
runs-on: "ubicloud-standard-16-arm"
|
||||
steps:
|
||||
- name: Remove unused tools
|
||||
@@ -150,8 +118,8 @@ jobs:
|
||||
- name: Clone the current repo
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
repository: ${{ github.repository }}
|
||||
ref: ${{ inputs.branch }}
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
@@ -229,8 +197,8 @@ jobs:
|
||||
- name: Clone the current repo
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
repository: ${{ github.repository }}
|
||||
ref: ${{ inputs.branch }}
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Set GIT_TAG env
|
||||
@@ -261,16 +229,11 @@ jobs:
|
||||
build_pr_image_summary:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
needs: [check_changes, build_pr_image_amd64, build_pr_image_arm64, build]
|
||||
needs: [build_pr_image_amd64, build_pr_image_arm64, build]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Check build results
|
||||
run: |
|
||||
if [ "${{ needs.check_changes.outputs.has_changes }}" != "true" ] || [ "${{ needs.check_changes.outputs.should_build }}" != "true" ]; then
|
||||
echo "No relevant changes or not a non-fork PR - builds skipped"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${{ needs.build_pr_image_amd64.result }}" == "success" ] || [ "${{ needs.build_pr_image_amd64.result }}" == "skipped" ]; then
|
||||
echo "AMD64 build passed or skipped"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user