4040 description : ' Filter tests to specific test directory (e.g., ./test/cloudwatchlogs)'
4141 type : string
4242 required : false
43+ helm_chart_branch :
44+ description : ' Override helm chart branch (default: latest release-* branch)'
45+ type : string
46+ required : false
4347 workflow_call :
4448 inputs :
4549 build_id :
5761 description : ' Filter tests to specific test directory (e.g., ./test/cloudwatchlogs)'
5862 type : string
5963 required : false
64+ helm_chart_branch :
65+ description : ' Override helm chart branch (default: latest release-* branch)'
66+ type : string
67+ required : false
6068
6169concurrency :
6270 group : ${{ github.workflow }}-${{ inputs.build_id }}
@@ -1186,6 +1194,8 @@ jobs:
11861194 id : terraform_apply
11871195 continue-on-error : true
11881196 uses : nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0
1197+ env :
1198+ HELM_CHART_BRANCH_INPUT : ${{ inputs.helm_chart_branch }}
11891199 with :
11901200 max_attempts : 2
11911201 timeout_minutes : 90 # EKS takes about 20 minutes to spin up a cluster and service on the cluster
@@ -1198,13 +1208,32 @@ jobs:
11981208 fi
11991209
12001210 terraform init
1211+ HELM_BRANCH=""
1212+ if grep -q 'helm_chart_branch' *.tf 2>/dev/null; then
1213+ HELM_BRANCH="${HELM_CHART_BRANCH_INPUT}"
1214+ if [ -z "$HELM_BRANCH" ]; then
1215+ HELM_BRANCH=$(curl -sL "https://api.github.com/repos/aws-observability/helm-charts/git/matching-refs/heads/release-" \
1216+ | jq -r '.[].ref | ltrimstr("refs/heads/")' \
1217+ | sort -V | tail -n 1)
1218+ fi
1219+ if [ -z "$HELM_BRANCH" ]; then
1220+ HELM_BRANCH="main"
1221+ fi
1222+ echo "Using helm chart branch: $HELM_BRANCH"
1223+ fi
1224+ HELM_VAR=""
1225+ if [ -n "$HELM_BRANCH" ]; then
1226+ HELM_VAR="-var=helm_chart_branch=$HELM_BRANCH"
1227+ fi
1228+
12011229 if terraform apply --auto-approve \
12021230 -var="test_dir=${{ matrix.arrays.test_dir }}"\
12031231 -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \
12041232 -var="cwagent_image_tag=${{ inputs.build_id }}" \
12051233 -var="ami_type=${{ matrix.arrays.ami }}" \
12061234 -var="instance_type=${{ matrix.arrays.instanceType }}" \
1207- -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then
1235+ -var="k8s_version=${{ matrix.arrays.k8sVersion }}" \
1236+ $HELM_VAR; then
12081237 terraform destroy -auto-approve
12091238 else
12101239 terraform destroy -auto-approve && exit 1
0 commit comments