Skip to content

Commit

Permalink
Merge branch 'main' of github.com:TykTechnologies/tyk-cicd-dev-demo i…
Browse files Browse the repository at this point in the history
…nto schema-validation-dev
  • Loading branch information
Long Le authored and Long Le committed Sep 4, 2024
2 parents ec17680 + ffa0961 commit 17b6806
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/tyk-schema-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,33 @@ jobs:
# Install JQ library used to introspect the API and Policy definitions
- name: 'Install JQ Library'
uses: dcarbone/install-jq-action@v2
id: version
with:
cmd: 'echo "version ${{ steps.version.outputs.value }}"'
- name: 'Check JQ Library'
run: |
which jq
jq --version
# Governance to validate minimum required fields
- name: 'Validate min fields for APIs and Policies'
run: |
for file in $(find . -name "*.json"); do
echo "Checking $file"
if jq -e '.proxy.target_url | length > 0' "$file" > /dev/null; then
echo "$file contains a valid proxy.target_url."
else
echo "$file does NOT contain a valid proxy.target_url."
exit 1
fi
done
echo "Validating $file"
# Check if target_url is valid and not empty
if jq -e '.proxy.target_url | length > 0' "$file" > /dev/null; then
echo "$file contains a valid proxy.target_url."
target_url=$(jq -r '.proxy.target_url' "$file")
echo "proxy.target_url: $target_url"
else
echo "$file does NOT contain a valid proxy.target_url."
exit 1
fi
# Check if either JWT auth or or StaticMTLS is enabled
if jq -e '.enable_jwt == true or .auth_configs.use_mutual_tls_auth == true' "$file" > /dev/null; then
echo "$file has either enable_jwt or auth_configs.use_mutual_tls_auth set to true."
else
echo "$file does NOT have either enable_jwt or auth_configs.use_mutual_tls_auth set to true."
exit 1
fi
done

0 comments on commit 17b6806

Please sign in to comment.