From 9917a7155d6232d28849d7cba83ce1d6c66b1d80 Mon Sep 17 00:00:00 2001 From: Ivan Vandot Date: Fri, 9 Oct 2020 18:25:32 +0200 Subject: [PATCH] trigger argocd only on master, split /beekeeper and master push (#825) --- .github/workflows/beekeeper.yml | 22 +--- .github/workflows/go.yml | 8 ++ .github/workflows/slash-beekeeper.yml | 159 ++++++++++++++++++++++++++ 3 files changed, 169 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/slash-beekeeper.yml diff --git a/.github/workflows/beekeeper.yml b/.github/workflows/beekeeper.yml index e411e45f9d9..a85fdaba982 100644 --- a/.github/workflows/beekeeper.yml +++ b/.github/workflows/beekeeper.yml @@ -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: | diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e1f2b4a895a..211788b2b19 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 }}"}' diff --git a/.github/workflows/slash-beekeeper.yml b/.github/workflows/slash-beekeeper.yml new file mode 100644 index 00000000000..a454b13e0c9 --- /dev/null +++ b/.github/workflows/slash-beekeeper.yml @@ -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 \`${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