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 375b448 commit 73fae16
Showing 1 changed file with 11 additions and 113 deletions.
124 changes: 11 additions & 113 deletions .github/workflows/start_e2e_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ jobs:
runs-on: ubuntu-latest
needs: build-charm
steps:
# - name: Setup Lxd Juju Controller
# uses: charmed-kubernetes/actions-operator@main
# with:
# juju-channel: 3.1/stable
# provider: lxd
- name: Initialize LXD
run: |
sudo snap refresh lxd --channel=latest/stable
Expand Down Expand Up @@ -144,7 +139,7 @@ jobs:
if [ $(echo "$output" | jq 'length') -eq 0 ]
then
echo "not-started"
echo "not_started"
else
# Parse output with jq to get the status field of the first object
status=$(echo "$output" | jq -r '.[0].status')
Expand All @@ -156,110 +151,13 @@ jobs:
for i in {1..120}
do
echo workflow status: $(get-workflow-status)
sleep 30
done; kill $(jobs -p) &
#
# deploy-e2e-test-runner:
# runs-on: ubuntu-latest
# needs: build-charm
# steps:
# - name: Setup Lxd Juju Controller
# uses: charmed-kubernetes/actions-operator@main
# with:
# juju-channel: 3.1/stable
# provider: lxd
#
# - name: Create Testing Juju Model
# run: juju add-model testing
#
# - name: Setting Testing Model Constraints
# run: juju set-model-constraints "virt-type=virtual-machine mem=24G cores=6"
#
# - name: Change Testing Model Logging Level
# run: juju model-config logging-config="<root>=INFO;unit=DEBUG"
#
# - name: Set Testing Model Proxy Configuration
# run: |
# juju model-config juju-http-proxy=$http_proxy
# juju model-config juju-https-proxy=$https_proxy
# juju model-config juju-no-proxy=$no_proxy
#
# - name: Download github-runner Charm
# uses: actions/download-artifact@v3
# with:
# name: github-runner_ubuntu-22.04-amd64.charm
#
# - name: Deploy github-runner Charm
# run: |
# cp github-runner_ubuntu-22.04-amd64.charm /home/ubuntu/github-runner_ubuntu-22.04-amd64.charm
# juju deploy /home/ubuntu/github-runner_ubuntu-22.04-amd64.charm \
# e${{ github.run_id }}n${{ github.run_number }}r \
# --base [email protected] \
# --config path=${{ secrets.E2E_TESTING_REPO }} \
# --config token=${{ secrets.E2E_TESTING_TOKEN }} \
# --config virtual-machines=1 \
# --config vm-cpu=4 \
# --config vm-memory=16GiB
#
# - name: Install GitHub Cli
# run: which gh || sudo apt install gh -y
#
# - name: Dispatch Workflow on Testing Runner
# env:
# GH_TOKEN: ${{ secrets.E2E_TESTING_TOKEN }}
# run: |
# MAIN_SHA=$(gh api \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ secrets.E2E_TESTING_REPO }}/git/ref/heads/main --jq .object.sha)
#
# gh api \
# --method POST \
# -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 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
#
# sleep 5
#
# - name: Watch github-runner
# env:
# GH_TOKEN: ${{ secrets.E2E_TESTING_TOKEN }}
# run: |
# gh run list \
# -R ${{ secrets.E2E_TESTING_REPO }} \
# -L 100 \
# --json headBranch,status,workflowDatabaseId \
# | jq '.[] | select(.headBranch=="e${{ github.run_id }}n${{ github.run_number }}r")'
#
# 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")]')
#
# if [ $(echo "$output" | jq 'length') -eq 0 ]
# then
# echo "not-started"
# else
# # Parse output with jq to get the status field of the first object
# status=$(echo "$output" | jq -r '.[0].status')
# echo "$status"
# fi
# }
#
# juju debug-log --replay --tail &
#
# for i in {1..120}
# do
# echo workflow status: $(get-workflow-status)
# sleep 30
# done; kill $(jobs -p) &
sleep 30
echo workflow status: $(get-workflow-status)
if [[ $status != "not-started" && $status != "queued" && $status != "in_progress" ]]; then
break
fi
done
kill $(jobs -p)
if [[ $status != "not-started" && $status != "queued" && $status != "in_progress" ]]; then
exit 1
fi

0 comments on commit 73fae16

Please sign in to comment.