Skip to content

Commit

Permalink
Modify workflow to validate storagecluster template and values.yaml f…
Browse files Browse the repository at this point in the history
…ile for user configurable field changes

Signed-off-by: hitesh-wani-px <hwani+github@purestorage.com>
  • Loading branch information
hitesh-wani-px committed Aug 13, 2024
1 parent 16524e4 commit 7188517
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/on-pr-helm-stc-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ jobs:
# Extract the HELM_PR_LINK value
HELM_PR_LINK=$(echo "$PR_BODY" | grep -oP 'HELM_PR_LINK[[:space:]]*=[[:space:]]*.*' | awk -F '=' '{print $2}' | xargs)
IS_CONFIGURABLE = $(echo "$PR_BODY" | grep -oP 'IS_USER_CONFIGURABLE_FIELD_ADDED[[:space:]]*=[[:space:]]*.*' | awk -F '=' '{print $2}' | xargs)
echo "HELM_PR_LINK: '$HELM_PR_LINK'"
echo "IS_USER_CONFIGURABLE_FIELD_ADDED": '$IS_CONFIGURABLE'
if [[ -z "$HELM_PR_LINK" ]]; then
echo "Changes detected in storageCluster CRD file"
Expand All @@ -47,6 +49,16 @@ jobs:
echo "helm_pr_link_url=$HELM_PR_LINK" >> $GITHUB_ENV
fi
if [[ "$IS_CONFIGURABLE" == "YES" ]]; then
echo "is_configurable=true" >> $GITHUB_ENV
elif [[ "$IS_CONFIGURABLE" == "NO" ]]; then
echo "is_configurable=false" >> $GITHUB_ENV
else
echo "Error: Please specify IS_USER_CONFIGURABLE_FIELD_ADDED as either YES or NO."
echo "If you are adding a new field in the storageCluster CRD that is configurable or editable by the user, it should be added in the helm storageCluster template and values.yaml."
exit 1
fi
- name: Extract Branch Name from Helm PR Link
id: extract_branch
if: env.helm_pr_link == 'true'
Expand Down Expand Up @@ -91,6 +103,26 @@ jobs:
else
echo "Helm storagecluster CRD changes detected."
fi
- name: Verify Helm StorageCluster template and values.yaml file changes
if: env.crd_changed == 'true' && env.helm_pr_link == 'true' && env.is_configurable== 'true'
run: |
echo "Checking Helm storagecluster template changes..."
if git diff --exit-code HEAD^ HEAD -- charts/portworx/crds/core_v1_storagecluster_crd.yaml; then
echo "Error: No changes detected in Helm storagecluster template file."
exit 1
else
echo "Helm storagecluster template changes detected."
fi
echo "Checking Helm storagecluster template changes..."
if git diff --exit-code HEAD^ HEAD -- charts/portworx/values.yaml; then
echo "Error: No changes detected in Helm values.yaml file."
exit 1
else
echo "Helm values.yaml file changes detected."
fi
- name: Final Status
run: echo "Validation completed successfully."

0 comments on commit 7188517

Please sign in to comment.