Skip to content

Commit

Permalink
trigger argocd only on master, split /beekeeper and master push (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
vandot authored Oct 9, 2020
1 parent 2c41dff commit 9917a71
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 20 deletions.
22 changes: 2 additions & 20 deletions .github/workflows/beekeeper.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
name: Beekeeper

on:
issue_comment:
types: [created]
repository_dispatch:
types: [trigger-beekeeper]

jobs:
beekeeper:
name: Execute "/beekeeper" slash command
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/beekeeper')
env:
REPLICA: 3
runs-on: ubuntu-latest
steps:
- name: Check for Command
id: command
uses: xt0rted/slash-command-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: beekeeper
reaction-type: "rocket"
- name: Get PR Branch
if: steps.command.outputs.command-arguments == 'beekeeper'
id: comment-branch
uses: xt0rted/pull-request-comment-branch@v1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Echo command (debug)
run: echo "The command was '${{ steps.command.outputs.command-name }}' with arguments '${{ steps.command.outputs.command-arguments }}'"
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.comment-branch.outputs.ref }}
fetch-depth: 1
- name: Install bee-local
run: |
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,11 @@ jobs:
./bin/deepsource report --analyzer test-coverage --key go --value-file ./cover.out
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
- name: Trigger Beekeeper
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest' && success()
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_GHA_PAT }}
repository: ${{ github.repository }}
event-type: trigger-beekeeper
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
159 changes: 159 additions & 0 deletions .github/workflows/slash-beekeeper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Slash Beekeeper

on:
issue_comment:
types: [created]

jobs:
beekeeper:
name: Execute "/beekeeper" slash command
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/beekeeper')
env:
REPLICA: 3
runs-on: ubuntu-latest
steps:
- name: Check for Command
id: command
uses: xt0rted/slash-command-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: beekeeper
reaction-type: "rocket"
- name: Get PR Branch
if: steps.command.outputs.command-arguments == 'beekeeper'
id: comment-branch
uses: xt0rted/pull-request-comment-branch@v1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Echo command (debug)
run: echo "The command was '${{ steps.command.outputs.command-name }}' with arguments '${{ steps.command.outputs.command-arguments }}'"
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.comment-branch.outputs.ref }}
fetch-depth: 1
- name: Install bee-local
run: |
sudo mv $(command -v brew){,_disable}
export URL=$(curl -s https://api.github.com/repos/ethersphere/bee-local/releases/latest | jq -r .tarball_url)
curl -Ls ${URL} -o bee-local.tar.gz
tar --strip-components=1 --wildcards -xzf bee-local.tar.gz ethersphere-bee-local-*/{beeinfra.sh,helm-values,hack}
- name: Install latest beekeeper
run: |
export TAG=$(curl -s https://api.github.com/repos/ethersphere/beekeeper/releases/latest | jq -r .tag_name)
curl -Ls https://github.com/ethersphere/beekeeper/releases/download/${TAG}/beekeeper-linux-amd64 -o beekeeper
chmod +x beekeeper
- name: Prepare testing cluster (DNS discovery)
run: |
./beeinfra.sh prepare --dns-disco --geth
- name: Set kube config
run: |
mkdir -p ~/.kube
cp $(k3d get-kubeconfig --name='k3s-default') ~/.kube/config
- name: Set testing cluster (DNS discovery)
run: |
echo -e "127.0.0.10\tregistry.localhost" | sudo tee -a /etc/hosts
for ((i=0; i<REPLICA; i++)); do echo -e "127.0.1.$((i+1))\tbee-${i}.localhost bee-${i}-debug.localhost"; done | sudo tee -a /etc/hosts
./beeinfra.sh install --dns-disco --local -r "${REPLICA}" --bootnode /dnsaddr/localhost --pay-threshold 10000 --geth
- name: Test fullconnectivity
id: fullconnectivity-1
run: ./beekeeper check fullconnectivity --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test pingpong
id: pingpong-1
run: ./beekeeper check pingpong --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test settlements
id: settlements
run: ./beekeeper check settlements --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count 10 -t 10000
- name: Destroy the cluster
run: |
./beeinfra.sh destroy
- name: Prepare testing cluster (Node connection)
run: |
./beeinfra.sh prepare --geth
- name: Set kube config
run: |
mkdir -p ~/.kube
cp $(k3d get-kubeconfig --name='k3s-default') ~/.kube/config
- name: Set testing cluster (Node connection)
run: |
./beeinfra.sh install --local -r "${REPLICA}" --geth
- name: Test fullconnectivity
id: fullconnectivity-2
run: ./beekeeper check fullconnectivity --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test pingpong
id: pingpong-2
run: ./beekeeper check pingpong --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test balances
id: balances
run: ./beekeeper check balances --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}"
- name: Test pushsync (bytes)
id: pushsync-bytes
run: ./beekeeper check pushsync --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3
- name: Test pushsync (chunks)
id: pushsync-chunks
run: ./beekeeper check pushsync --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3 --upload-chunks
- name: Test retrieval
id: retrieval
run: ./beekeeper check retrieval --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3
- name: Test pullsync
id: pullsync
run: ./beekeeper check pullsync --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3
- name: Test chunkrepair
id: chunkrepair
run: ./beekeeper check chunkrepair --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test manifest
id: manifest
run: ./beekeeper check manifest --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Destroy the cluster
run: |
./beeinfra.sh destroy
grep -vE 'bee|registry.localhost' /etc/hosts | sudo tee /etc/hosts
- name: Prepare testing cluster (Node connection) 5 bee nodes
run: |
./beeinfra.sh prepare --geth
- name: Set kube config
run: |
mkdir -p ~/.kube
cp $(k3d get-kubeconfig --name='k3s-default') ~/.kube/config
- name: Increase REPLICA to 5
run: |
echo "::set-env name=REPLICA::5"
- name: Set testing cluster (Node connection) 5 bee nodes
run: |
echo -e "127.0.0.10\tregistry.localhost" | sudo tee -a /etc/hosts
for ((i=0; i<REPLICA; i++)); do echo -e "127.0.1.$((i+1))\tbee-${i}.localhost bee-${i}-debug.localhost"; done | sudo tee -a /etc/hosts
./beeinfra.sh install --local -r "${REPLICA}" --geth
- name: Test localpinning 1
id: localpinning-1
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test localpinning 2
id: localpinning-2
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --large-file-disk-ratio 2
- name: Test localpinning 3
id: localpinning-3
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --large-file-disk-ratio 2 --large-file-count 10
- name: Debug workflow if failed
if: failure()
run: |
export FAILED='no-test'
if ${{ steps.fullconnectivity-1.outcome=='failure' }}; then FAILED=fullconnectivity-1; fi
if ${{ steps.pingpong-1.outcome=='failure' }}; then FAILED=pingpong-1; fi
if ${{ steps.fullconnectivity-2.outcome=='failure' }}; then FAILED=fullconnectivity-2; fi
if ${{ steps.pingpong-2.outcome=='failure' }}; then FAILED=pingpong-2; fi
if ${{ steps.balances.outcome=='failure' }}; then FAILED=balances; fi
if ${{ steps.settlements.outcome=='failure' }}; then FAILED=settlements; fi
if ${{ steps.pushsync-bytes.outcome=='failure' }}; then FAILED=pushsync-bytes; fi
if ${{ steps.pushsync-chunks.outcome=='failure' }}; then FAILED=pushsync-chunks; fi
if ${{ steps.retrieval.outcome=='failure' }}; then FAILED=retrieval; fi
if ${{ steps.pullsync.outcome=='failure' }}; then FAILED=pullsync; fi
if ${{ steps.chunkrepair.outcome=='failure' }}; then FAILED=chunkrepair; fi
if ${{ steps.manifest.outcome=='failure' }}; then FAILED=manifest; fi
if ${{ steps.localpinning-1.outcome=='failure' }}; then FAILED=localpinning-1; fi
if ${{ steps.localpinning-2.outcome=='failure' }}; then FAILED=localpinning-2; fi
if ${{ steps.localpinning-3.outcome=='failure' }}; then FAILED=localpinning-3; fi
KEYS=$(curl -sSf -X POST https://eu.relay.tunshell.com/api/sessions)
curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"Failed -> \`${FAILED}\`\nDebug -> \`sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} eu.relay.tunshell.com\`\"}" https://beehive.ethswarm.org/hooks/${{ secrets.WEBHOOK_KEY }}
echo "Failed test: ${FAILED}"
echo "Connect to github actions node using"
echo "sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} eu.relay.tunshell.com"
curl -sSf https://lets.tunshell.com/init.sh | sh /dev/stdin T $(echo $KEYS | jq -r .peer1_key) ${{ secrets.TUNSHELL_SECRET }} eu.relay.tunshell.com

0 comments on commit 9917a71

Please sign in to comment.