Skip to content

Commit

Permalink
Use md5 hashes for unique prefixes instead of shippable regex
Browse files Browse the repository at this point in the history
  • Loading branch information
jillr committed May 20, 2021
1 parent 30bd11d commit b6185d2
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 37 deletions.
7 changes: 2 additions & 5 deletions tests/integration/targets/aws_codebuild/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# defaults file for aws_codebuild

# IAM role names have to be less than 64 characters
# The 8 digit identifier at the end of resource_prefix helps determine during
# which test something was created and allows tests to be run in parallel
# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases
# we need both sets of digits to keep the resource name unique
unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}"
# we hash the resource_prefix to get a shorter, unique string
unique_id: "{{ resource_prefix | hash('md5') }}"
iam_role_name: "ansible-test-sts-{{ unique_id }}-codebuild-service-role"
7 changes: 2 additions & 5 deletions tests/integration/targets/aws_codepipeline/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
codepipeline_name: "{{ resource_prefix }}-test-codepipeline"

# IAM role names have to be less than 64 characters
# The 8 digit identifier at the end of resource_prefix helps determine during
# which test something was created and allows tests to be run in parallel
# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases
# we need both sets of digits to keep the resource name unique
unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}"
# we hash the resource_prefix to get a shorter, unique string
unique_id: "{{ resource_prefix | hash('md5') }}"
codepipeline_service_role_name: "ansible-test-sts-{{ unique_id }}-codepipeline-role"
4 changes: 2 additions & 2 deletions tests/integration/targets/ec2_eip/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# VPCs are identified by the CIDR. Don't hard code the CIDR. shippable will
# run multiple copies of the test concurrently (Python 2.x and Python 3.x)
# VPCs are identified by the CIDR. Don't hard code the CIDR. CI may
# run multiple copies of the test concurrently.
vpc_cidr: '10.{{ 256 | random(seed=resource_prefix) }}.0.0/16'
subnet_cidr: '10.{{ 256 | random(seed=resource_prefix) }}.42.0/24'
7 changes: 2 additions & 5 deletions tests/integration/targets/lambda/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# defaults file for lambda integration test
lambda_function_name: '{{ resource_prefix }}'
# IAM role names have to be less than 64 characters
# The 8 digit identifier at the end of resource_prefix helps determine during
# which test something was created and allows tests to be run in parallel
# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases
# we need both sets of digits to keep the resource name unique
unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}"
# we hash the resource_prefix to get a shorter, unique string
unique_id: "{{ resource_prefix | hash('md5') }}"
lambda_role_name: 'ansible-test-{{ unique_id }}-lambda'
7 changes: 2 additions & 5 deletions tests/integration/targets/lambda_alias/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# defaults file for lambda integration test
lambda_function_name: '{{ resource_prefix }}'
# IAM role names have to be less than 64 characters
# The 8 digit identifier at the end of resource_prefix helps determine during
# which test something was created and allows tests to be run in parallel
# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases
# we need both sets of digits to keep the resource name unique
unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}"
# we hash the resource_prefix to get a shorter, unique string
unique_id: "{{ resource_prefix | hash('md5') }}"
lambda_role_name: 'ansible-test-{{ unique_id }}-lambda'
7 changes: 2 additions & 5 deletions tests/integration/targets/lambda_policy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# defaults file for lambda_policy integration test
lambda_function_name: '{{ resource_prefix }}-api-endpoint'
# IAM role names have to be less than 64 characters
# The 8 digit identifier at the end of resource_prefix helps determine during
# which test something was created and allows tests to be run in parallel
# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases
# we need both sets of digits to keep the resource name unique
unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}"
# we hash the resource_prefix to get a shorter, unique string
unique_id: "{{ resource_prefix | hash('md5') }}"
lambda_role_name: 'ansible-test-{{ unique_id }}-lambda-policy'
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# defaults file for s3_bucket_notifications integration test
lambda_function_name: '{{ resource_prefix }}'
# IAM role names have to be less than 64 characters
# The 8 digit identifier at the end of resource_prefix helps determine during
# which test something was created and allows tests to be run in parallel
# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases
# we need both sets of digits to keep the resource name unique
unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}"
# we hash the resource_prefix to get a shorter, unique string
unique_id: "{{ resource_prefix | hash('md5') }}"
lambda_role_name: 'ansible-test-{{ unique_id }}-s3-notifications'
7 changes: 2 additions & 5 deletions tests/integration/targets/sns_topic/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ sns_topic_third_party_region: "{{ sns_topic_third_party_topic_arn.split(':')[3]
sns_topic_lambda_function: "sns_topic_lambda"
sns_topic_lambda_name: "{{ resource_prefix }}-{{ sns_topic_lambda_function }}"
# IAM role names have to be less than 64 characters
# The 8 digit identifier at the end of resource_prefix helps determine during
# which test something was created and allows tests to be run in parallel
# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases
# we need both sets of digits to keep the resource name unique
unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}"
# we hash the resource_prefix to get a shorter, unique string
unique_id: "{{ resource_prefix | hash('md5') }}"
sns_topic_lambda_role: "ansible-test-{{ unique_id }}-sns-lambda"

0 comments on commit b6185d2

Please sign in to comment.