Skip to content

Commit 5ad7d9a

Browse files
authored
Add Itar Integration Tests (#1051)
1 parent 0abf927 commit 5ad7d9a

9 files changed

+763
-365
lines changed

.github/workflows/ec2-integration-test.yml

+18-10
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ name: Reusable EC2 Integration Test
55

66
env:
77
PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }}
8-
TERRAFORM_AWS_ASSUME_ROLE: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }}
9-
S3_INTEGRATION_BUCKET: ${{ secrets.S3_INTEGRATION_BUCKET }}
108
KEY_NAME: ${{ secrets.KEY_NAME }}
9+
TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours
1110

1211
on:
1312
workflow_call:
@@ -35,6 +34,12 @@ on:
3534
type: string
3635
localstack_host:
3736
type: string
37+
region:
38+
type: string
39+
terraform_assume_role:
40+
type: string
41+
s3_integration_bucket:
42+
type: string
3843

3944
jobs:
4045
EC2IntegrationTest:
@@ -56,8 +61,9 @@ jobs:
5661
- name: Configure AWS Credentials
5762
uses: aws-actions/configure-aws-credentials@v1
5863
with:
59-
role-to-assume: ${{env.TERRAFORM_AWS_ASSUME_ROLE}}
60-
aws-region: us-west-2
64+
role-to-assume: ${{ inputs.terraform_assume_role }}
65+
aws-region: ${{inputs.region}}
66+
role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }}
6167

6268
- name: Cache if success
6369
id: cache_if_success
@@ -67,8 +73,9 @@ jobs:
6773
key: cache_if_success-${{ github.sha }}-${{ matrix.arrays.os }}-${{ matrix.arrays.arc }}-${{ matrix.arrays.test_dir }}
6874

6975
- name: Echo Test Info
70-
run: echo run cache_if_success os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }}
71-
76+
run: |
77+
echo run cache_if_success os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }}
78+
echo localstack input ${{ inputs.localstack_host }}
7279
- name: Verify Terraform version
7380
run: terraform --version
7481

@@ -100,14 +107,15 @@ jobs:
100107
-var="arc=${{ matrix.arrays.arc }}" \
101108
-var="binary_name=${{ matrix.arrays.binaryName }}" \
102109
-var="local_stack_host_name=${{ inputs.localstack_host }}" \
103-
-var="s3_bucket=${{env.S3_INTEGRATION_BUCKET}}" \
110+
-var="region=${{ inputs.region }}" \
111+
-var="s3_bucket=${{ inputs.s3_integration_bucket }}" \
104112
-var="plugin_tests='${{ github.event.inputs.plugins }}'" \
105113
-var="excluded_tests='${{ matrix.arrays.excludedTests }}'" \
106114
-var="ssh_key_name=${{env.KEY_NAME}}" \
107115
-var="test_dir=${{ matrix.arrays.test_dir }}" \
108-
-var="agent_start=${{ matrix.arrays.agentStartCommand }}"; then terraform destroy -auto-approve
116+
-var="agent_start=${{ matrix.arrays.agentStartCommand }}"; then terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve
109117
else
110-
terraform destroy -auto-approve && exit 1
118+
terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve && exit 1
111119
fi
112120
#This is here just in case workflow cancel
113121
- name: Terraform destroy
@@ -117,4 +125,4 @@ jobs:
117125
max_attempts: 3
118126
timeout_minutes: 8
119127
retry_wait_seconds: 5
120-
command: cd ${{ inputs.test_dir }} && terraform destroy --auto-approve
128+
command: cd ${{ inputs.test_dir }} && terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" --auto-approve

0 commit comments

Comments
 (0)