Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Net 1507 terraform fix #448

Merged
merged 8 commits into from
Aug 7, 2024
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
65 changes: 32 additions & 33 deletions .github/workflows/branchtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,37 +51,37 @@ jobs:
run: |
curl -L ${{ inputs.api }}/api/users/adm/createsuperadmin -d '{"username":"${{ secrets.NM_USER }}","password":"${{ secrets.NM_PASSWORD }}"}'

clean:
name: remove all gateways
runs-on: ubuntu-latest
steps:
- name: get binary
run: |
mkdir bin
wget -O bin/test fileserver.clustercat.com/testing/test
- name: run tests
id: clean
run: |
chmod +x bin/test
bin/test clean
env:
DIGITALOCEAN_TOKEN: ${{ secrets.TESTING_DO_TOKEN }}
KEY: ${{ secrets.TESTING_SSH_KEY }}
TAG: ${{ inputs.tag }}
NETWORK: ${{ inputs.network}}
MASTERKEY: ${{ inputs.masterkey }}
API: ${{ inputs.api }}
- name: save logs
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: clean
path: /tmp/clean.log
retention-days: 3
# clean:
# name: remove all gateways
# runs-on: ubuntu-latest
# steps:
# - name: get binary
# run: |
# mkdir bin
# wget -O bin/test fileserver.clustercat.com/testing/test
# - name: run tests
# id: clean
# run: |
# chmod +x bin/test
# bin/test clean
# env:
# DIGITALOCEAN_TOKEN: ${{ secrets.TESTING_DO_TOKEN }}
# KEY: ${{ secrets.TESTING_SSH_KEY }}
# TAG: ${{ inputs.tag }}
# NETWORK: ${{ inputs.network}}
# MASTERKEY: ${{ inputs.masterkey }}
# API: ${{ inputs.api }}
# - name: save logs
# if: success() || failure()
# uses: actions/upload-artifact@v3
# with:
# name: clean
# path: /tmp/clean.log
# retention-days: 3


initial-ping:
needs: [clean]
# needs: [clean]
name: initial ping
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
retention-days: 3

tests:
needs: [initial-ping, clean]
needs: [initial-ping]
name: tests
runs-on: ubuntu-latest
steps:
Expand All @@ -125,8 +125,7 @@ jobs:
bin/test peerUpdate -s ${{ inputs.server }}
bin/test ingress
bin/test egress
bin/test relay
bin/test internetGateway

env:
DIGITALOCEAN_TOKEN: ${{ secrets.TESTING_DO_TOKEN }}
KEY: ${{ secrets.TESTING_SSH_KEY }}
Expand Down Expand Up @@ -173,7 +172,7 @@ jobs:

results:
if: success() || failure()
needs: [clean, initial-ping, tests, final-ping]
needs: [initial-ping, tests, final-ping]
name: sumarize results
runs-on: ubuntu-latest
steps:
Expand All @@ -188,7 +187,7 @@ jobs:
path: /tmp
- name: generate results
run: |
test/scripts/results.sh
test/scripts/branchresults.sh
- name: upload results
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testdeploybranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:

testbranch:
needs: [getserver, terraform, masterkey]
uses: gravitl/devops/.github/workflows/branchtest.yml@NET-1485-b
uses: ./.github/workflows/branchtest.yml
with:
tag: ${{ inputs.tag }}
network: netmaker
Expand Down
3 changes: 2 additions & 1 deletion netmaker/gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ func CreateExtClient(client Netclient, network string) string {
"devops": "road-warrior",
"devops4": "road-warrior2",
"devopsv6": "road-warrior3",
"netmaker": "road-warrior4",
}
slog.Info("creating ext client", clients[network], network)
clientID, exists := clients[network]
if !exists {
slog.Error("No client ID found for network '%s'\n", network)
slog.Error("No client ID found for network", network)
return ""
}

Expand Down
97 changes: 97 additions & 0 deletions test/scripts/branchresults.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#! /bin/bash
if [ -f /tmp/clean/clean.log ]
then
grep ERROR /tmp/clean/clean.log >> /tmp/errors.log
if [ $? -eq 0 ]
then
echo "removing gateways: FAILED" >> /tmp/results.log
else
echo "removing gateways: PASSED" >> /tmp/results.log
fi
else
echo "removing gateways: NOT RUN" >> /tmp/results.log
fi

if [ -f /tmp/ping/ping.log ]
then
grep ERROR /tmp/ping/ping.log >> /tmp/errors.log
if [ $? -eq 0 ]
then
echo "initial ping: FAILED" >> /tmp/results.log
else
echo "initial ping: PASSED" >> /tmp/results.log
fi
else
echo "initial ping: NOT RUN" >> /tmp/results.log
fi

if [ -f /tmp/tests/peerupdate.log ]
then
grep ERROR /tmp/tests/peerupdate.log >> /tmp/errors.log
if [ $? -eq 0 ]
then
echo "peerupdate: FAILED" >> /tmp/results.log
else
echo "peerupdate: PASSED" >> /tmp/results.log
fi
else
echo "peerupdate: NOT RUN" >> /tmp/results.log
fi

if [ -f /tmp/tests/ingress.log ]
then
grep ERROR /tmp/tests/ingress.log >> /tmp/errors.log
if [ $? -eq 0 ]
then
echo "ingress: FAILED" >> /tmp/results.log
else
echo "ingress: PASSED" >> /tmp/results.log
fi
else
echo "ingress: NOT RUN" >> /tmp/results.log
fi

if [ -f /tmp/tests/egress.log ]
then
grep ERROR /tmp/tests/egress.log >> /tmp/errors.log
if [ $? -eq 0 ]
then
echo "egress: FAILED" >> /tmp/results.log
else
echo "egress: PASSED" >> /tmp/results.log
fi
else
echo "egress: NOT RUN" >> /tmp/results.log
fi

if [ -f /tmp/tests/relay.log ]
then
grep ERROR /tmp/tests/relay.log >> /tmp/errors.log
if [ $? -eq 0 ]
then
echo "relay: FAILED" >> /tmp/results.log
else
grep "WARN" /tmp/tests/relay.log
if [ $? -eq 0 ]
then
echo "relay: SKIPPED" >> /tmp/results.log
else
echo "relay: PASSED" >> /tmp/results.log
fi
fi
else
echo "relay: NOT RUN" >> /tmp/results.log
fi

if [ -f /tmp/ping2/ping.log ]
then
grep ERROR /tmp/ping2/ping.log >> /tmp/errors.log
if [ $? -eq 0 ]
then
echo "final ping: FAILED" >> /tmp/results.log
else
echo "final ping: PASSED" >> /tmp/results.log
fi
else
echo "final ping: NOT RUN" >> /tmp/results.log
fi
Loading