-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run private link test as part of e2e
- Loading branch information
Showing
34 changed files
with
431 additions
and
606 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,73 @@ | ||
name: "Cleanup AWS leftovers" | ||
description: "Cleanup any AWS leftovers of e2e test" | ||
inputs: | ||
service_name: | ||
required: true | ||
description: "The full name of the service for filtering purposes" | ||
aws_role_arn: | ||
required: true | ||
description: "The ARN of the AWS role to assume for AWS tests" | ||
aws_region: | ||
required: true | ||
description: "The AWS region to use for AWS tests" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Configure AWS credentials | ||
id: aws-auth | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ inputs.aws_role_arn }} | ||
aws-region: ${{ inputs.aws_region }} | ||
|
||
- name: Cleanup AWS | ||
shell: bash | ||
run: | | ||
echo "::group::Deleting VPC Endpoints" | ||
attempts=10 | ||
while [ $attempts -gt 0 ]; do | ||
attempts=$((attempts - 1)) | ||
endpointids="$(aws ec2 --region eu-west-2 describe-vpc-endpoints|jq --arg name "${{ inputs.service_name }}" -r '.VpcEndpoints[] | select(.Tags[0].Value == $name) | .VpcEndpointId')" | ||
if [ "$endpointids" == "" ] | ||
then | ||
break | ||
fi | ||
echo "Deleting endpoints $endpointids" | ||
for endpointid in $endpointids | ||
do | ||
echo "Deleting vpc endpoint $endpointid" | ||
aws ec2 --region "${{ inputs.aws_region }}" delete-vpc-endpoints --vpc-endpoint-ids "$endpointid" | ||
done | ||
sleep 60 | ||
done | ||
echo "::endgroup::" | ||
echo "::group::Deleting Security Groups" | ||
sgids="$(aws ec2 --region "${{ inputs.aws_region }}" describe-security-groups|jq --arg name "${{ inputs.service_name }}" -r '.SecurityGroups[] | select(.Tags[0].Value == $name) | .GroupId')" | ||
for sgid in $sgids | ||
do | ||
echo "Deleting SG $sgid" | ||
aws ec2 --region "${{ inputs.aws_region }}" delete-security-group --group-id "$sgid" | ||
done | ||
echo "::endgroup::" | ||
echo "::group::Deleting Subnets" | ||
subnetids="$(aws ec2 --region "${{ inputs.aws_region }}" describe-subnets|jq --arg name "${{ inputs.service_name }}" -r '.Subnets[] | select(.Tags[0].Value == $name) | .SubnetId')" | ||
for subnetid in $subnetids | ||
do | ||
echo "Deleting subnet $subnetid" | ||
aws ec2 --region "${{ inputs.aws_region }}" delete-subnet --subnet-id "$subnetid" | ||
done | ||
echo "::endgroup::" | ||
echo "::group::Deleting VPCs" | ||
vpcids="$(aws ec2 --region "${{ inputs.aws_region }}" describe-vpcs|jq --arg name "${{ inputs.service_name }}" -r '.Vpcs[] | select(.Tags[0].Value == $name) | .VpcId')" | ||
for vpcid in $vpcids | ||
do | ||
echo "Deleting vpc $vpcid" | ||
aws ec2 --region "${{ inputs.aws_region }}" delete-vpc --vpc-id "$vpcid" | ||
done | ||
echo "::endgroup::" |
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
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.