Skip to content

build: correct jq checks to be valid against task def files#28

Merged
iBotPeaches merged 1 commit intomasterfrom
fix-json-validation
Jan 29, 2026
Merged

build: correct jq checks to be valid against task def files#28
iBotPeaches merged 1 commit intomasterfrom
fix-json-validation

Conversation

@iBotPeaches
Copy link
Member

@iBotPeaches iBotPeaches commented Jan 28, 2026

The older logic was wrong - always passing (during a failure) and failing during a pass. It seems earlier versions of JQ had a different default mode when invoked without parameters which generated invalid json (escaped chars) which failed the check.

In modern jq the default execution no longer does that, so it works (but then fails since our logic was inverted).

I moved this to properly look at exit code -e.

Testing

bash-3.2$ export TASK_DEFINITION_FILE=test.json 
bash-3.2$     if ! jq -e . < "$TASK_DEFINITION_FILE" >/dev/null 2>&1; then
>         echo -e "${RED}Task Definition became invalid JSON after modifications (invalid_task_definition)."
> 
>         if [ -n "$RUNNER_DEBUG" ]; then
>             echo "::debug::Debug enabled. Outputting modified Task Definition file.";
>             cat "$TASK_DEFINITION_FILE"
>         fi
> 
>         exit 1;
>     fi
bash-3.2$

Fixes #25

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes inverted logic in JSON validation checks that were causing the script to fail when JSON was valid and pass when JSON was invalid. The fix uses jq -e with proper exit code checking instead of relying on jq's default behavior.

Changes:

  • Fixed JSON validation logic for task definition files to properly detect invalid JSON
  • Fixed JSON validation logic for network configuration files to properly detect invalid JSON

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iBotPeaches iBotPeaches merged commit 88fcaa1 into master Jan 29, 2026
7 checks passed
@iBotPeaches iBotPeaches deleted the fix-json-validation branch January 29, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

v1.1.9 - mass failure.

4 participants