"[Error] Could not parse compose file" when pushing a local branch to Balena

I have created a new application and when I want to deploy a local branch (which is not the master branch) to Balena then I get the error “Could not parse compose file …”. See extract below:

Jans-MBP:balena-google-assistant jan$ git checkout dev_pa
Already on 'dev_pa'
Your branch is ahead of 'origin/dev_pa' by 1 commit.
  (use "git push" to publish your local commits)
Jans-MBP:balena-google-assistant jan$ git push balena dev_pa:master --force
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 12 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (6/6), 767 bytes | 767.00 KiB/s, done.
Total 6 (delta 3), reused 3 (delta 2)

[Error]    Could not parse compose file
[Error]      data should NOT have additional properties
[Error]    Not deploying release.

remote: error: hook declined to update refs/heads/master
To git.balena-cloud.com:gh_janvda/assistant.git
 ! [remote rejected] dev_pa -> master (hook declined)
error: failed to push some refs to 'gh_janvda@git.balena-cloud.com:gh_janvda/assistant.git'
Jans-MBP:balena-google-assistant jan$ 

I have also made the same changes to the master branch and pushing those exact changes worked.
See log below

Jans-MBP:balena-google-assistant jan$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Jans-MBP:balena-google-assistant jan$ git push balena master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 12 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 510 bytes | 510.00 KiB/s, done.
Total 3 (delta 1), reused 1 (delta 1)

[Info]              Starting build for assistant, user gh_janvda
...

maybe this error is related to "error: unable to write sha1 filename" when trying to push my code to balena as this post also refers to a problem when pushing a local branch (!= master branch) to Balena.

Hi @janvda and thank you for reporting this issue,

How did you copy those changes across from your dev_pa branch to your master branch? Was it a cherry-pick operation, or simply re-committing the same change manually?

This comment does not address the issue, but you may find it useful to try the balena CLI instead of git push. Specifically the balena push command, documented in Deploy to your Fleet. In case you had considered the CLI before, note that recently we’ve made improvements to make it easier to install. You can choose a graphical installer for Windows or macOS, or a standalone zip file for Linux, macOS or Windows, where the installation consists of simply unzipping it.

balena push does not “see” or “care” about git branches: it will push whatever is currently checked out.

Hi @janvda and thank you for reporting this issue,

How did you copy those changes across from your dev_pa branch to your master branch? Was it a cherry-pick operation, or simply re-committing the same change manually?

@xginn8 I just manually copy-pasted the changes to the master branch and recommitted it.

Note also that branch dev_pa was not the branch I got initially problems with (i.e. dev_pulseaudio). I have just created that branch based on the master and also made in that branch the changes manually.

FYI. the manual changes are nothing more than adding an extra service section for the pulseaudio service in the docker-compose.yml file.

I just installed the Balena CLI and I got the same error when pushing branch dev_pa.
see log below

Jans-MacBook-Pro:balena-google-assistant jan$ balena push assistant
Debug: original argv0="balena" argv=[/Applications/balena-cli/balena,/snapshot/balena-cli/bin/balena,push,assistant] length=4
[debug] Using . as build source
[debug] Connecting to builder at https://builder.balena-cloud.com/v3/build?owner=gh_janvda&app=assistant&dockerfilePath=&emulated=false&nocache=false
\ Uploading source package to balena cloud[debug] received HTTP 200 OK
[debug] handling message: {"message":"\u001b[31m[Error]\u001b[39m    Could not parse compose file","isError":true}
[Error]    Could not parse compose file
[debug] handling message: {"message":"\u001b[31m[Error]\u001b[39m      data should NOT have additional properties","isError":true}
[Error]      data should NOT have additional properties
[debug] handling message: {"message":"\u001b[31m[Error]\u001b[39m    Not deploying release.","isError":true}
[Error]    Not deploying release.
RemoteBuildFailedError: Remote build failed
    at Bluebird.then (/snapshot/balena-cli/build/utils/remote-build.js:53:19)
    at tryCatcher (/snapshot/balena-cli/node_modules/bluebird/js/release/util.js:16:23)
    at Promise.module.exports.Promise._settlePromiseFromHandler (/snapshot/balena-cli/node_modules/bluebird/js/release/promise.js:517:31)
    at Promise.module.exports.Promise._settlePromise (/snapshot/balena-cli/node_modules/bluebird/js/release/promise.js:574:18)
    at Promise.module.exports.Promise._settlePromise0 (/snapshot/balena-cli/node_modules/bluebird/js/release/promise.js:619:10)
    at Promise.module.exports.Promise._settlePromises (/snapshot/balena-cli/node_modules/bluebird/js/release/promise.js:699:18)
    at _drainQueueStep (/snapshot/balena-cli/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/snapshot/balena-cli/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/snapshot/balena-cli/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/snapshot/balena-cli/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
    at process.topLevelDomainCallback (domain.js:121:23)

If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io

For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

Jans-MacBook-Pro:balena-google-assistant jan$ 

I just installed the Balena CLI and I got the same error when pushing branch dev_pa

Oh, that’s an interesting result. I would conclude that:

  • Either you get the same error with balena push on the master branch,
  • Or the master and the dev_pa branches differ in some meaningful way.

A diff of the branches shows a newline character difference:

I wouldn’t have thought that that newline change was “meaningful”, but it is indeed a modification to docker-compose.yml which is exactly what the error messages “Could not parse compose file”, “data should NOT have additional properties” point to. Could you try having an exact copy of docker-compose.yml in both branches (master and dev_pa), and have the branches differ trivially elsewhere?

Thanks, indeed the special character must be causing the problem.
When I copy paste the complete docker-compose.yml from master to dev_pa branch then I can successfully push the changes to balena.

Thanks a lot.
Jan