forked from trento-project/web
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (142 loc) · 5.44 KB
/
e2e.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# This workflow requires the following secrets:
# `SSH_PUBLIC_KEY`, `SSH_PRIVATE_KEY` ssh keys to access the e2e machines
# `AWS_SECRET_ACCESS_KEY`, `AWS_ACCESS_KEY_ID` aws credentials,
# used by terraform to deploy the infrastructure.
#
# An artifact containing the terraform state is uploaded in case something goes wrong,
# so it's easy to destroy the infrastructure.
name: e2e tests
on:
workflow_dispatch:
concurrency: cluster_e2e_tests
jobs:
e2e_tests:
name: E2E tests
runs-on: ubuntu-latest
env:
TF_VAR_aws_region: "eu-central-1"
TF_VAR_aws_secret_key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
TF_VAR_aws_access_key_id: "${{ secrets.AWS_ACCESS_KEY_ID }}"
TF_VAR_public_key: "${{ secrets.SSH_PUBLIC_KEY }}"
TF_VAR_hana_instancetype: "r6i.xlarge"
# vmhana01 and vmhana02 images built from https://github.com/SUSE/ha-sap-terraform-deployments
TF_VAR_hana_image_ids: '["ami-073792bfce1223304", "ami-0c3df2b35c3b0ec6f"]'
# OpenSUSE Leap 15.4
TF_VAR_trento_server_image_id: "ami-094a0810ca766cdce"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "16"
cache: "npm"
cache-dependency-path: test/e2e/package-lock.json
- name: Checkout terraform repo
uses: actions/checkout@v4
with:
repository: trento-project/trento-e2e
path: terraform
- name: Use branch workspace
uses: dflook/terraform-new-workspace@v1
with:
path: terraform/deployments/aws/hana_ha_enabled
workspace: "trentoe2e"
# workspace: ${{ github.head_ref }}
- name: Deploy test infrastructure
uses: dflook/terraform-apply@v1
continue-on-error: true
with:
path: terraform/deployments/aws/hana_ha_enabled
workspace: "trentoe2e"
# workspace: ${{ github.head_ref }}
auto_approve: true
- name: Upload tfstate
uses: actions/upload-artifact@v4
if: ${{ !env.ACT }}
with:
name: terraform-state
path: terraform/deployments/aws/hana_ha_enabled/terraform.tfstate.d
- name: Get outputs
uses: dflook/terraform-output@v1
id: tf-outputs
with:
path: terraform/deployments/aws/hana_ha_enabled
workspace: "trentoe2e"
# workspace: ${{ github.head_ref }}
- name: Checkout ansible repo
uses: actions/checkout@v4
with:
repository: trento-project/ansible
path: ansible
- name: Add pipx_bin to path
if: ${{ env.ACT }}
run: echo '/opt/pipx_bin' >> $GITHUB_PATH
- name: Install galaxy deps
run: ansible-galaxy install -r ansible/requirements.yml
- name: Run playbook
uses: dawidd6/action-ansible-playbook@v2
continue-on-error: true
with:
playbook: ansible/playbook.yml
key: ${{ secrets.SSH_PRIVATE_KEY }}
inventory: |
all:
vars:
ansible_user: ec2-user
children:
trento-server:
hosts:
server:
ansible_host: ${{ steps.tf-outputs.outputs.trento_server_public_ip }}
postgres-hosts:
hosts:
server:
ansible_host: ${{ steps.tf-outputs.outputs.trento_server_public_ip }}
rabbitmq-hosts:
hosts:
server:
ansible_host: ${{ steps.tf-outputs.outputs.trento_server_public_ip }}
agents:
hosts:
hana01:
ansible_host: ${{ fromJson(steps.tf-outputs.outputs.hana_public_ip)[0] }}
hana02:
ansible_host: ${{ fromJson(steps.tf-outputs.outputs.hana_public_ip)[1] }}
options: |
--extra-vars "web_postgres_password='pass' \
wanda_postgres_password='wanda' \
rabbitmq_password='trento' \
prometheus_url='http://localhost' \
web_admin_password='adminpassword' \
enable_api_key='false' \
trento_server_name='trento' \
trento_server_url='http://${{ steps.tf-outputs.outputs.trento_server_ip }}' \
rabbitmq_host='${{ steps.tf-outputs.outputs.trento_server_ip }}:5672' \
api_key='api-key'"
- name: Cypress run
uses: cypress-io/github-action@v6
env:
CYPRESS_BASE_URL: http://${{ steps.tf-outputs.outputs.trento_server_public_ip }}
CYPRESS_REAL_CLUSTER_TESTS: true
continue-on-error: true
with:
working-directory: test/e2e
spec: cypress/e2e/hana_scale_up_checks.cy.js
- name: Destroy
uses: dflook/terraform-destroy-workspace@v1
continue-on-error: true
with:
path: terraform/deployments/aws/hana_ha_enabled
workspace: "trentoe2e"
- name: Install aws-delete-vpc
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
repo: isovalent/aws-delete-vpc
cache: enable
- name: Destroy VPC
env:
AWS_REGION: "eu-central-1"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
run: aws-delete-vpc --vpc-id ${{ steps.tf-outputs.outputs.vpc_id }}