-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PENV-630 run gbe-system-tests on pull requests (#188)
- Loading branch information
1 parent
2c3f594
commit db18879
Showing
5 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: system-tests | ||
on: | ||
pull_request: | ||
schedule: | ||
- cron: 0 2 * * * | ||
env: | ||
KUBECONFIG: k3s.yaml | ||
GITOPS_BRANCH: ?ref=REL-57 | ||
jobs: | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 2 | ||
matrix: | ||
target: [gbe-system-tests] | ||
steps: | ||
- name: Set up go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.14' | ||
- name: checkout code | ||
uses: actions/checkout@master | ||
- name: build block-explorer image | ||
run: docker build -t localhost/block-explorer:local . | ||
- name: spin up k3s | ||
uses: insolar/[email protected] | ||
with: | ||
kubectl_version: "v1.18.2" | ||
k3s_tag: "v1.17.4-k3s1" | ||
custom_registry: true | ||
registries_yaml_path: "deploy/registries.yaml" | ||
- name: set PAT for github http auth | ||
run: | | ||
git config --global url."https://${{secrets.INS_SERVICE_PAT}}@github.com/".insteadOf "https://github.com/" | ||
kubectl create ns insolar && kubectl -n insolar create secret generic ins-service-pat --from-literal=INS_SERVICE_PAT=${{secrets.INS_SERVICE_PAT}} | ||
- name: set up local registry | ||
run: kubectl apply -k https://github.com/insolar/gitops/k3s-registry | ||
- name: wait for registry to be up and running | ||
run: kubectl -n registry rollout status deploy/registry --timeout=80s | ||
- name: push block-explorer image to local registry | ||
run: docker push localhost/block-explorer:local | ||
- name: deploy insolar-mainnet | ||
run: kubectl apply -k "https://github.com/insolar/gitops/mainnet/overlays/autotests/${{env.GITOPS_BRANCH}}" | ||
- name: wait for bootstrap completion | ||
run: | | ||
echo "waiting for bootstrap completion…" | ||
for attempt in {1..120}; do | ||
STATUS=$(kubectl -n insolar get po bootstrap -o jsonpath='{.status.phase}') | ||
[[ "${STATUS}" == "Succeeded" ]] && exit 0 || sleep 1 | ||
done | ||
exit 1 | ||
- name: wait for insolar network initialization | ||
run: | | ||
echo "waiting for insolar network initialization…" | ||
for try in {0..180}; do | ||
if kubectl -n insolar exec -i deploy/pulsewatcher -- bash -c 'pulsewatcher -c /etc/pulsewatcher/pulsewatcher.yaml -s' | grep 'READY' | grep -v 'NOT'; then | ||
exit 0 | ||
else | ||
sleep 1 | ||
fi | ||
done | ||
exit 1 | ||
- name: deploy block-explorer | ||
run: kubectl -n insolar apply -k deploy/block-explorer | ||
- name: spawn autotests pod | ||
run: | | ||
# create secret | ||
kubectl -n insolar create secret docker-registry ins-registry \ | ||
--docker-server=${{ secrets.REGISTRY_URL }} \ | ||
--docker-username=${{ secrets.REGISTRY_USERNAME }} \ | ||
--docker-password=${{ secrets.REGISTRY_PASSWORD }} | ||
# patch sa | ||
kubectl -n insolar patch sa default -p '{"imagePullSecrets":[{"name":"ins-registry"}]}' | ||
kubectl -n insolar apply -k deploy/autotests | ||
- name: wait for pod initialization | ||
run: | | ||
for attempt in {1..10}; do | ||
STATUS=$(kubectl -n insolar get po go-autotests -o jsonpath='{.status.phase}') | ||
[[ "${STATUS}" == "Running" ]] && exit 0 || sleep $attempt | ||
done | ||
- name: run autotests | ||
run: | | ||
kubectl -n insolar exec go-autotests -- /bin/sh -c 'git config --global url."https://${INS_SERVICE_PAT}@github.com".insteadOf "https://github.com"' | ||
kubectl -n insolar exec go-autotests -- /bin/sh -c 'TEST_COUNT=1 make ${{matrix.target}}' > logs.log | ||
- name: display logs | ||
if: always() | ||
run: cat logs.log | ||
- name: create tests report | ||
if: failure() | ||
run: | | ||
go get github.com/tsovak/go-test-parser/... | ||
go-test-parser logs.log -o report | ||
- name: Upload report to artifacts | ||
if: failure() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: report | ||
path: "report" | ||
- name: Send failure notification to Slack | ||
if: failure() && github.event_name == 'schedule' | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,message,commit,author,action,eventName,ref,workflow | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.ACTIONS_NOTIFICATIONS_SLACK_HOOK_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
namespace: insolar | ||
bases: | ||
- https://github.com/insolar/go-autotests/deploy/autotests-pod | ||
images: | ||
- name: localhost/go-autotests | ||
newName: registry.insolar.io/insolar/go-autotests | ||
newTag: latest | ||
generatorOptions: | ||
disableNameSuffixHash: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: block-explorer | ||
spec: | ||
template: | ||
spec: | ||
initContainers: | ||
- name: check-platform-status | ||
env: | ||
- { name: SLEEP_TIME_BEFORE_START, value: '30' } | ||
image: ellerbrock/alpine-bash-curl-ssl:0.3.0 | ||
command: [ 'bash', '-c' ] | ||
args: | ||
- "for i in {1..60}; do res=$(curl -s 'http://virtual-0.platform-network.insolar.svc.cluster.local:8001/metrics' | grep insolar_network_state | grep -v '#' | awk '{print $2}'); echo $res; if [[ $res = '6' ]];then sleep $SLEEP_TIME_BEFORE_START; exit 0; fi ; sleep 1; done; exit 1" | ||
containers: | ||
- name: block-explorer | ||
env: | ||
- { name: BLOCK_EXPLORER_REPLICATOR_AUTH_INSECURETLS, value: 'true' } | ||
- { name: BLOCK_EXPLORER_REPLICATOR_AUTH_REQUIRED, value: 'true' } | ||
- { name: BLOCK_EXPLORER_REPLICATOR_AUTH_URL, value: 'http://auth-service:8080/auth/token' } | ||
- { name: BLOCK_EXPLORER_REPLICATOR_AUTH_LOGIN, value: 'replicator' } | ||
- { name: BLOCK_EXPLORER_REPLICATOR_AUTH_PASSWORD, value: 'replicator' } | ||
- { name: BLOCK_EXPLORER_REPLICATOR_ADDR, value: heavy-0.platform-network.insolar.svc.cluster.local:5678 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: block-explorer-api-external | ||
spec: | ||
type: NodePort | ||
ports: | ||
- name: http | ||
port: 8080 | ||
nodePort: 32199 | ||
selector: | ||
app: block-explorer-api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
namespace: insolar | ||
bases: | ||
- https://github.com:insolar/adm/kustomize/generic-block-explorer/overlays/docker-for-desktop | ||
patches: | ||
- block-explorer-patch.yaml | ||
resources: | ||
- external-svc.yaml | ||
images: | ||
- name: block-explorer | ||
newName: localhost/block-explorer | ||
newTag: local | ||
generatorOptions: | ||
disableNameSuffixHash: true |