Skip to content

Commit 8cdc51d

Browse files
authored
Adds step to get RDS DB Cluster Identifier per each cluster (#136)
This commit adds a step that maps from the EKS cluster to the RDS DB cluster identifier, so that we can get the endpoint and the credentials that are going to be used by the sample app in both Python and Java.
1 parent af5bff3 commit 8cdc51d

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

.github/workflows/java-eks-e2e-test.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,24 @@ jobs:
140140
- name: Get RDS database cluster metadata
141141
continue-on-error: true
142142
run: |
143-
RDS_MYSQL_CLUSTER_ENDPOINT=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier "rdsaurorajavaclusterformysql" --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].Endpoint" --output text)
143+
if [ "${{ env.CLUSTER_NAME }}" = "e2e-enablement-script-test" ]; then
144+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraenablementscriptpythone2eclusterformysql"
145+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-cw-agent-test" ]; then
146+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroracwagente2eclusterformysql"
147+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-adot-test" ]; then
148+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraadote2eclusterformysql"
149+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-cw-agent-operator-test" ]; then
150+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroracwagentoperatore2eclusterformysql"
151+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-canary-test" ]; then
152+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsaurorajavaclusterformysql"
153+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-playground" ]; then
154+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraplaygroundclusterformysql"
155+
else
156+
echo "${{ env.CLUSTER_NAME }} is not a known cluster name"
157+
exit 1
158+
fi
159+
RDS_MYSQL_CLUSTER_ENDPOINT=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier $RDS_MYSQL_CLUSTER_IDENTIFIER --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].Endpoint" --output text)
144160
echo RDS_MYSQL_CLUSTER_ENDPOINT="$RDS_MYSQL_CLUSTER_ENDPOINT" >> $GITHUB_ENV
145-
RDS_MYSQL_CLUSTER_IDENTIFIER=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier "rdsaurorajavaclusterformysql" --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].DBClusterIdentifier" --output text)
146161
RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME=$(aws secretsmanager list-secrets --region ${{inputs.aws-region}} --query "SecretList[?Tags[?Value=='arn:aws:rds:${{inputs.aws-region}}:${{env.ACCOUNT_ID}}:cluster:$RDS_MYSQL_CLUSTER_IDENTIFIER']].Name" --output text)
147162
echo RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME="$RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME" >> $GITHUB_ENV
148163

.github/workflows/python-eks-e2e-test.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,24 @@ jobs:
141141
- name: Get RDS database cluster metadata
142142
continue-on-error: true
143143
run: |
144-
RDS_MYSQL_CLUSTER_ENDPOINT=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier "rdsaurorapythonclusterformysql" --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].Endpoint | [0]" --output text)
144+
if [ "${{ env.CLUSTER_NAME }}" = "e2e-enablement-script-test" ]; then
145+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraenablementscriptpythone2eclusterformysql"
146+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-cw-agent-test" ]; then
147+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroracwagente2eclusterformysql"
148+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-python-adot-test" ]; then
149+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraadotpythone2eclusterformysql"
150+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-cw-agent-operator-python-test" ]; then
151+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroracwagentoperatorpythone2eclusterformysql"
152+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-python-canary-test" ]; then
153+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsaurorapythonclusterformysql"
154+
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-playground" ]; then
155+
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraplaygroundclusterformysql"
156+
else
157+
echo "${{ env.CLUSTER_NAME }} is not a known cluster name"
158+
exit 1
159+
fi
160+
RDS_MYSQL_CLUSTER_ENDPOINT=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier $RDS_MYSQL_CLUSTER_IDENTIFIER --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].Endpoint | [0]" --output text)
145161
echo RDS_MYSQL_CLUSTER_ENDPOINT="$RDS_MYSQL_CLUSTER_ENDPOINT" >> $GITHUB_ENV
146-
RDS_MYSQL_CLUSTER_IDENTIFIER=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier "rdsaurorapythonclusterformysql" --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].DBClusterIdentifier | [0]" --output text)
147162
RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME=$(aws secretsmanager list-secrets --region ${{inputs.aws-region}} --query "SecretList[?Tags[?Value=='arn:aws:rds:${{inputs.aws-region}}:${{env.ACCOUNT_ID}}:cluster:$RDS_MYSQL_CLUSTER_IDENTIFIER']].Name | [0]" --output text)
148163
echo RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME="$RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME" >> $GITHUB_ENV
149164

0 commit comments

Comments
 (0)