Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 39 additions & 31 deletions .github/workflows/caller-comment-triggered-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ jobs:
# DEFINITION from the pull request and run it with this token.
- name: Parse the command and open the pro check
id: pro
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: start
command: /test-e2e
check-name-prefix: e2e-pro
parse-focus: true
target-name: pro
reply: "true"
comment-id: ${{ github.event.comment.id }}
run-label: Pro
comment-body: ${{ github.event.comment.body }}
comment-author: ${{ github.event.comment.user.login }}
author-association: ${{ github.event.comment.author_association }}
Expand All @@ -84,13 +87,16 @@ jobs:
- name: Open the oss check
id: oss
if: ${{ steps.pro.outputs.target == 'oss' || (steps.pro.outputs.target == '' && steps.pro.outputs.should-run == 'true') }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: start
command: /test-e2e
check-name-prefix: e2e-oss
parse-focus: true
target-name: oss
reply: "true"
comment-id: ${{ github.event.comment.id }}
run-label: OSS
comment-body: ${{ github.event.comment.body }}
comment-author: ${{ github.event.comment.user.login }}
author-association: ${{ github.event.comment.author_association }}
Expand Down Expand Up @@ -135,7 +141,7 @@ jobs:

- name: Close the pro check if the branch has no contract
if: ${{ always() && steps.pro.outputs.should-run == 'true' && steps.contract.outcome != 'success' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ steps.pro.outputs.check-run-id }}
Expand All @@ -145,7 +151,7 @@ jobs:

- name: Close the oss check if the branch has no contract
if: ${{ always() && steps.oss.outputs.should-run == 'true' && steps.contract.outcome != 'success' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ steps.oss.outputs.check-run-id }}
Expand All @@ -155,7 +161,7 @@ jobs:

- name: Close whatever was opened if preparing failed
if: failure()
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ steps.pro.outputs.check-run-id }}
Expand Down Expand Up @@ -262,14 +268,26 @@ jobs:
env:
CHECK_RUN_ID: ${{ needs.prepare.outputs.pro-check-run-id }}
run: |
gh workflow run caller-e2e-pro-run.yaml \
output="$(gh workflow run caller-e2e-pro-run.yaml \
--ref "$WORKFLOW_REF" \
-f "ginkgo-label=$FILTER" \
-f "ginkgo-focus=$FOCUS" \
-f "head-sha=$HEAD_SHA" \
-f "compose-with-pr=false" \
-f "concurrency-key=$KEY" \
-f "check-run-id=$CHECK_RUN_ID"
-f "check-run-id=$CHECK_RUN_ID" 2>&1)" || { echo "$output"; exit 1; }
echo "$output"
# gh prints the URL of the run it started.
url="$(grep -Eo 'https://[^[:space:]]+/actions/runs/[0-9]+' <<< "$output" | head -n1 || true)"
echo "url=${url}" >> "$GITHUB_OUTPUT"

- name: Link the pro run in the reply
if: ${{ steps.dispatch-pro.outputs.url != '' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: link
check-run-id: ${{ needs.prepare.outputs.pro-check-run-id }}
run-url: ${{ steps.dispatch-pro.outputs.url }}

- name: Run the oss suite
id: dispatch-oss
Expand All @@ -278,40 +296,30 @@ jobs:
env:
CHECK_RUN_ID: ${{ needs.prepare.outputs.oss-check-run-id }}
run: |
gh workflow run caller-e2e-oss-run.yaml \
output="$(gh workflow run caller-e2e-oss-run.yaml \
--ref "$WORKFLOW_REF" \
-f "ginkgo-label=$FILTER" \
-f "ginkgo-focus=$FOCUS" \
-f "head-sha=$HEAD_SHA" \
-f "compose-with-pr=false" \
-f "concurrency-key=$KEY" \
-f "check-run-id=$CHECK_RUN_ID"
-f "check-run-id=$CHECK_RUN_ID" 2>&1)" || { echo "$output"; exit 1; }
echo "$output"
# gh prints the URL of the run it started.
url="$(grep -Eo 'https://[^[:space:]]+/actions/runs/[0-9]+' <<< "$output" | head -n1 || true)"
echo "url=${url}" >> "$GITHUB_OUTPUT"

- name: Say what it picked
if: always()
uses: loft-sh/github-actions/.github/actions/sticky-pr-comment@ee112eee4fb449b7b1e78f63fdec314563be534d # sticky-pr-comment/v1
- name: Link the oss run in the reply
if: ${{ steps.dispatch-oss.outputs.url != '' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
# Required here. The input defaults to github.event.pull_request.number,
# which is empty on issue_comment, and the action then refuses.
pr-number: ${{ github.event.issue.number }}
marker: '<!-- e2e-command-status -->'
body: |
### `/test-e2e` started

Target: `${{ needs.prepare.outputs.target != '' && needs.prepare.outputs.target || 'pro + oss' }}`

- **Pro:** ${{ needs.prepare.outputs.target == 'oss' && 'Not requested' || steps.dispatch-pro.outcome == 'success' && 'Started' || 'Failed to start' }}
- **OSS:** ${{ needs.prepare.outputs.target == 'pro' && 'Not requested' || steps.dispatch-oss.outcome == 'success' && 'Started' || 'Failed to start' }}

Filter: `${{ needs.prepare.outputs.filter }}`
${{ needs.prepare.outputs.focus != '' && format('Focus: `{0}`', needs.prepare.outputs.focus) || '' }}

If no specs match in a selected tree, its check reports **Nothing to run**.
github-token: ${{ secrets.GITHUB_TOKEN }}
mode: link
check-run-id: ${{ needs.prepare.outputs.oss-check-run-id }}
run-url: ${{ steps.dispatch-oss.outputs.url }}

- name: Close the pro check if its dispatch failed
if: ${{ steps.dispatch-pro.outcome == 'failure' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ needs.prepare.outputs.pro-check-run-id }}
Expand All @@ -321,7 +329,7 @@ jobs:

- name: Close the oss check if its dispatch failed
if: ${{ steps.dispatch-oss.outcome == 'failure' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ needs.prepare.outputs.oss-check-run-id }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/caller-e2e-oss-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ jobs:
runs-on: ubuntu-latest
permissions:
checks: write
# Redraws the command's reply.
pull-requests: write

steps:
- name: Complete the check-run
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ inputs.check-run-id }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/caller-e2e-pro-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ jobs:
runs-on: ubuntu-latest
permissions:
checks: write
# Redraws the command's reply.
pull-requests: write

steps:
- name: Complete the check-run
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ inputs.check-run-id }}
Expand Down
50 changes: 31 additions & 19 deletions .github/workflows/caller-platform-command.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@ jobs:
head-sha: ${{ steps.command.outputs.head-sha }}
key: ${{ steps.command.outputs.concurrency-key }}
check-run-id: ${{ steps.command.outputs.check-run-id }}
runs: ${{ steps.command.outputs.runs }}

steps:
- name: Parse command and open check
id: command
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: start
command: /test-platform-e2e
check-name-prefix: e2e-platform
parse-focus: true
parse-runs: true
reply: "true"
comment-id: ${{ github.event.comment.id }}
run-label: Platform
comment-body: ${{ github.event.comment.body }}
comment-author: ${{ github.event.comment.user.login }}
author-association: ${{ github.event.comment.author_association }}
Expand All @@ -58,7 +63,7 @@ jobs:

- name: Close the check if the branch has no contract
if: ${{ always() && steps.command.outputs.should-run == 'true' && steps.contract.outcome != 'success' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ steps.command.outputs.check-run-id }}
Expand All @@ -77,10 +82,15 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

dispatch:
name: Dispatch suite
name: Dispatch suite (${{ matrix.run.check-name }})
needs: [prepare]
if: ${{ needs.prepare.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
# One job per --runs run, like loft-enterprise, so the links race for the reply.
strategy:
fail-fast: false
matrix:
run: ${{ fromJSON(needs.prepare.outputs.runs) }}
permissions:
actions: write
checks: write
Expand All @@ -94,44 +104,46 @@ jobs:
HEAD_SHA: ${{ needs.prepare.outputs.head-sha }}
FILTER: ${{ needs.prepare.outputs.filter }}
FOCUS: ${{ needs.prepare.outputs.focus }}
KEY: ${{ needs.prepare.outputs.key }}
CHECK_RUN_ID: ${{ needs.prepare.outputs.check-run-id }}
KEY: ${{ matrix.run.concurrency-key }}
CHECK_RUN_ID: ${{ matrix.run.check-run-id }}
PR_NUMBER: ${{ github.event.issue.number }}

steps:
- name: Dispatch mock Platform suite
id: dispatch
continue-on-error: true
run: |
gh workflow run caller-platform-run.yaml \
output="$(gh workflow run caller-platform-run.yaml \
--ref "$WORKFLOW_REF" \
-f "ginkgo-label=$FILTER" \
-f "ginkgo-focus=$FOCUS" \
-f "head-sha=$HEAD_SHA" \
-f "concurrency-key=$KEY" \
-f "pr-number=$PR_NUMBER" \
-f "check-run-id=$CHECK_RUN_ID"
-f "check-run-id=$CHECK_RUN_ID" 2>&1)" || { echo "$output"; exit 1; }
echo "$output"
# gh prints the URL of the run it started.
url="$(grep -Eo 'https://[^[:space:]]+/actions/runs/[0-9]+' <<< "$output" | head -n1 || true)"
echo "url=${url}" >> "$GITHUB_OUTPUT"

- name: Link the run in the reply
if: ${{ steps.dispatch.outputs.url != '' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: link
check-run-id: ${{ matrix.run.check-run-id }}
run-url: ${{ steps.dispatch.outputs.url }}

- name: Close check if dispatch failed
if: ${{ always() && steps.dispatch.outcome == 'failure' }}
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ needs.prepare.outputs.check-run-id }}
check-run-id: ${{ matrix.run.check-run-id }}
suite-result: failure
summary: "Could not start the mock Platform suite."
details-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

- name: Report dispatch
if: always()
uses: loft-sh/github-actions/.github/actions/sticky-pr-comment@sticky-pr-comment/v1
with:
pr-number: ${{ github.event.issue.number }}
marker: '<!-- platform-e2e-command-status-${{ needs.prepare.outputs.key }} -->'
body: |
`/test-platform-e2e ${{ needs.prepare.outputs.filter }}${{ needs.prepare.outputs.focus != '' && format(' --focus "{0}"', needs.prepare.outputs.focus) || '' }}`: `${{ steps.dispatch.outcome }}`.
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Fail if dispatch failed
if: ${{ always() && steps.dispatch.outcome == 'failure' }}
run: exit 1
4 changes: 3 additions & 1 deletion .github/workflows/caller-platform-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ jobs:
runs-on: ubuntu-latest
permissions:
checks: write
# Redraws the command's reply.
pull-requests: write
steps:
- name: Complete check
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@comment-triggered-check/v1
uses: loft-sh/github-actions/.github/actions/comment-triggered-check@devops-1843/test-e2e-run-reply
with:
mode: finish
check-run-id: ${{ inputs.check-run-id }}
Expand Down
Loading