mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-25 07:31:01 +02:00
Look for /update-sdk in PR description
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
215fb8f823
commit
66bfe6a6e5
@ -13,11 +13,11 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
run_pre_checks:
|
run_pre_checks:
|
||||||
# Only run if this is a PR comment that contains a valid command
|
# Only run if this is a PR comment that contains a valid command
|
||||||
if: ${{ github.event.issue.pull_request }} && contains(github.event.comment.body, '/build-image')
|
if: ${{ github.event.issue.pull_request }} && ( contains(github.event.comment.body, '/build-image') || contains(github.event.comment.body, '/update-sdk'))
|
||||||
name: Check if commenter is in the Flatcar maintainers team
|
name: Check if commenter is in the Flatcar maintainers team
|
||||||
outputs:
|
outputs:
|
||||||
maintainers: steps.step1.output.maintainers
|
maintainers: steps.step1.output.maintainers
|
||||||
sdk_changes: steps.step3.outputs.sdk_changes
|
sdk_changes: ${{ steps.step3.outputs.sdk_changes }}
|
||||||
runs-on:
|
runs-on:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -49,29 +49,14 @@ jobs:
|
|||||||
|
|
||||||
$res
|
$res
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
id: step2
|
|
||||||
with:
|
|
||||||
path: scripts
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- uses: dorny/paths-filter@v2
|
|
||||||
id: filter
|
|
||||||
with:
|
|
||||||
working-directory: scripts
|
|
||||||
filters: |
|
|
||||||
sdk_changes:
|
|
||||||
- 'sdk_container/**'
|
|
||||||
- 'sdk_libs/**'
|
|
||||||
|
|
||||||
- name: Set outputs
|
- name: Set outputs
|
||||||
id: step3
|
id: step2
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "sdk_changes=${{ steps.filter.outputs.sdk_changes }}" >> $GITHUB_OUTPUT
|
echo "sdk_changes=${{ contains(github.event.comment.body, '/update-sdk') }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Post a link to the workflow run to the PR
|
- name: Post a link to the workflow run to the PR
|
||||||
id: step4
|
id: step3
|
||||||
uses: mshick/add-pr-comment@v2
|
uses: mshick/add-pr-comment@v2
|
||||||
with:
|
with:
|
||||||
issue: ${{ github.event.issue.pull_request.number }}
|
issue: ${{ github.event.issue.pull_request.number }}
|
||||||
@ -87,7 +72,7 @@ jobs:
|
|||||||
|
|
||||||
build_image:
|
build_image:
|
||||||
needs: [ run_pre_checks, update_sdk ]
|
needs: [ run_pre_checks, update_sdk ]
|
||||||
if: (always() && ! cancelled()) && needs.run_pre_checks.result == 'success' && contains(github.event.comment.body, '/build-image')
|
if: (always() && ! cancelled()) && needs.run_pre_checks.result == 'success' && needs.update_sdk.result != 'failure' && contains(github.event.comment.body, '/build-image')
|
||||||
name: "Build the OS image"
|
name: "Build the OS image"
|
||||||
uses: ./.github/workflows/ci.yaml
|
uses: ./.github/workflows/ci.yaml
|
||||||
with:
|
with:
|
||||||
|
37
.github/workflows/pr-workflows.yaml
vendored
37
.github/workflows/pr-workflows.yaml
vendored
@ -10,44 +10,37 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_for_sdk_changes:
|
pre_check:
|
||||||
name: "Check for SDK changes"
|
name: "Check if we need to update the SDK"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Setting the environment is the more important reason we need this job.
|
||||||
|
# We use this job as a gate, so we can approve the PR workflow only once. If
|
||||||
|
# we set this in the update_sdk job and in the build_image job, we would have
|
||||||
|
# to approve the workflow for every job that kicks off. Given that the jobs
|
||||||
|
# are sequenced, this is cumbersome. Use this job as a gate and make the rest
|
||||||
|
# dependent on it.
|
||||||
environment: development
|
environment: development
|
||||||
outputs:
|
outputs:
|
||||||
sdk_changes: ${{ steps.step2.outputs.sdk_changes }}
|
sdk_changes: ${{ steps.step1.outputs.sdk_changes }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
|
||||||
id: step1
|
|
||||||
with:
|
|
||||||
path: scripts
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- uses: dorny/paths-filter@v2
|
|
||||||
id: filter
|
|
||||||
with:
|
|
||||||
working-directory: scripts
|
|
||||||
filters: |
|
|
||||||
sdk_changes:
|
|
||||||
- 'sdk_container/**'
|
|
||||||
- 'sdk_libs/**'
|
|
||||||
|
|
||||||
- name: Set outputs
|
- name: Set outputs
|
||||||
id: step2
|
id: step1
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "sdk_changes=${{ steps.filter.outputs.sdk_changes }}" >> $GITHUB_OUTPUT
|
echo "sdk_changes=${{ contains(github.event.pull_request.body, '/update-sdk') }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
update_sdk:
|
update_sdk:
|
||||||
name: "Build an updated SDK container"
|
name: "Build an updated SDK container"
|
||||||
needs: [ check_for_sdk_changes ]
|
needs: [ pre_check ]
|
||||||
if: needs.check_for_sdk_changes.sdk_changes == 'true'
|
if: needs.pre_check.outputs.sdk_changes == 'true'
|
||||||
# SDK build needs access to bincache ssh secret
|
# SDK build needs access to bincache ssh secret
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
uses: ./.github/workflows/update-sdk.yaml
|
uses: ./.github/workflows/update-sdk.yaml
|
||||||
|
|
||||||
build_image:
|
build_image:
|
||||||
needs: [ update_sdk ]
|
needs: [ update_sdk ]
|
||||||
|
# The update-sdk job may be skipped, which is fine. We only care if it tried to
|
||||||
|
# run, but failed.
|
||||||
if: (always() && ! cancelled()) && needs.update_sdk.result != 'failure'
|
if: (always() && ! cancelled()) && needs.update_sdk.result != 'failure'
|
||||||
name: "Build the OS image"
|
name: "Build the OS image"
|
||||||
uses: ./.github/workflows/ci.yaml
|
uses: ./.github/workflows/ci.yaml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user