Skip to content

Commit

Permalink
Update start_e2e_test.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
weiiwang01 committed Jun 18, 2023
1 parent 5c67e9a commit 24e3b9f
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/start_e2e_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,22 @@ jobs:
with:
name: github-runner_ubuntu-22.04-amd64.charm

- name: Generate Run ID
id: run-id
shell: python
run: |
import random
import os
import strings
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
run_id = "".join(random.choice(string.ascii_lowercase) for _ in range(8))
f.write(f"run-id={run_id}\n")
- name: Deploy github-runner Charm
run: |
cp github-runner_ubuntu-22.04-amd64.charm /home/$USER/github-runner_ubuntu-22.04-amd64.charm
juju deploy /home/$USER/github-runner_ubuntu-22.04-amd64.charm \
e${{ github.run_id }}n${{ github.run_number }}r \
${{ steps.run-id.outputs.run-id }} \
--base [email protected] \
--config path=${{ secrets.E2E_TESTING_REPO }} \
--config token=${{ secrets.E2E_TESTING_TOKEN }} \
Expand All @@ -110,13 +121,13 @@ jobs:
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ secrets.E2E_TESTING_REPO }}/git/refs \
-f ref='refs/heads/e${{ github.run_id }}n${{ github.run_number }}r' \
-f ref='refs/heads/${{ steps.run-id.outputs.run-id }}' \
-f sha=$MAIN_SHA
gh workflow run test.yaml \
-R ${{ secrets.E2E_TESTING_REPO }} \
--ref e${{ github.run_id }}n${{ github.run_number }}r \
-f runner=e${{ github.run_id }}n${{ github.run_number }}r
--ref ${{ steps.run-id.outputs.run-id }} \
-f runner=${{ steps.run-id.outputs.run-id }}
sleep 5
Expand All @@ -128,14 +139,14 @@ jobs:
-R ${{ secrets.E2E_TESTING_REPO }} \
-L 100 \
--json headBranch,status,workflowDatabaseId,conclusion \
| jq '.[] | select(.headBranch=="e${{ github.run_id }}n${{ github.run_number }}r")'
| jq '.[] | select(.headBranch=="${{ steps.run-id.outputs.run-id }}")'
get-workflow-status() {
output=$(gh run list \
-R ${{ secrets.E2E_TESTING_REPO }} \
-L 100 \
--json headBranch,status \
| jq '[.[] | select(.headBranch=="e${{ github.run_id }}n${{ github.run_number }}r")]')
| jq '[.[] | select(.headBranch=="${{ steps.run-id.outputs.run-id }}")]')
if [ $(echo "$output" | jq 'length') -eq 0 ]
then
Expand Down Expand Up @@ -165,7 +176,7 @@ jobs:
-R ${{ secrets.E2E_TESTING_REPO }} \
-L 100 \
--json headBranch,conclusion \
| jq '.[] | select(.headBranch=="e${{ github.run_id }}n${{ github.run_number }}r") | .conclusion')
| jq '.[] | select(.headBranch=="${{ steps.run-id.outputs.run-id }}") | .conclusion')
if [[ $status != "completed" || $conclusion != "success" ]]; then
echo "test workflow failed with status: $status, conclusion: $conclusion"
Expand Down

0 comments on commit 24e3b9f

Please sign in to comment.