Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziosestito committed Apr 17, 2023
1 parent d6d0fc7 commit c9f3888
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: e2e tests

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.PUBLIC_KEY }}'
TF_VAR_hana_instancetype: "r6i.xlarge"
TF_VAR_hana_image_ids: '["ami-073792bfce1223304", "ami-0c3df2b35c3b0ec6f"]'
TF_VAR_trento_server_image_id: "ami-073792bfce1223304"

on:
workflow_dispatch:

jobs:
deploy_e2e_infrastracture:
name: Deploy e2e infrastracture
runs-on: ubuntu-latest
steps:
- name: Checkout terraform repo
uses: actions/checkout@v3
with:
repository: fabriziosestito/trento-e2e
path: terraform
- name: Use branch workspace
uses: dflook/terraform-new-workspace@v1
with:
path: ./terraform/deployments/aws
workspace: "trentoe2e"
# workspace: ${{ github.head_ref }}
- name: Deploy test infrastrucutre
uses: dflook/terraform-apply@v1
continue-on-error: true
with:
path: ./terraform/deployments/aws
workspace: "trentoe2e"
# workspace: ${{ github.head_ref }}
auto_approve: true
- name: Upload tfstate
uses: actions/upload-artifact@v3
if: ${{ !env.ACT }}
with:
name: terraform-state
path: ./terraform/deployments/aws/terraform.tfstate.d
- name: Get outputs
uses: dflook/terraform-output@v1
id: tf-outputs
with:
path: ./terraform/deployments/aws
workspace: "trentoe2e"
# workspace: ${{ github.head_ref }}
- name: Checkout ansible repo
uses: actions/checkout@v3
with:
repository: CDimonaco/trento-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.PRIVATE_KEY }}
inventory: |
[all]
${{ steps.tf-outputs.outputs.trento_server_public_ip }}
[all:vars]
ansible_user=ec2-user
options: |
--extra-vars "web_postgres_password='pass' \
wanda_postgres_password='wanda' \
rabbitmq_password='trento' \
runner_url='' \
grafana_api_url='http://localhost' \
prometheus_url='' \
web_admin_password='adminpassword' \
trento_server_name='trento'"
- name: Destroy
uses: dflook/terraform-destroy-workspace@v1
continue-on-error: true
with:
path: ./terraform/deployments/aws
workspace: "trentoe2e"
- name: Install aws-delete-vpc
uses: jaxxstorm/[email protected]
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 }}

0 comments on commit c9f3888

Please sign in to comment.