Error doing git push


#1

Follows is the error I’m observing

git push resin master
Counting objects: 98, done. 
Delta compression using up to 4 threads.
Compressing objects: 100% (95/95), done.
Writing objects: 100% (98/98), 60.30 KiB | 0 bytes/s, done.
Total 98 (delta 43), reused 0 (delta 0)

[Info]     Starting build for[MYGITHUBPROJECT], user [ME]
[Info]     Dashboard link: {MYDASHBOARD]
[Info]     Building on ARM01
[Error]    Project type resolution could not be performed, please add one of the following:
[Error]    	Dockerfile
[Error]    	Dockerfile.template
[Error]    	package.json
[Error]    Could not determine the project type

remote: error: hook declined to update refs/heads/master
To [MYGITLOCATION]
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 
'[MYGITLOCATION]'

This is the dir structure of my project:

ls
Dockerfile		client-certs		logs			node_modules		package.json
app.js			config.js		mqtt-log-pub-js.initd	package-lock.json	service

This is the contents of the Dockerfile:

more Dockerfile 
FROM resin/%%RESIN_MACHINE_NAME%%-node:6-slim

RUN mkdir -p /usr/src/mqtt-log-pub-js
WORKDIR /usr/src/mqtt-log-pub-js

COPY . /usr/src/mqtt-log-pub-js
RUN JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*

ENV INITSYSTEM on

CMD [ "node", "app.js" ]

This is the contents of the package.json file:

more package.json 
{
  "name": "mqtt-node",
  "version": "0.0.1",
  "description": "",
  "main": "app.js",
  "scripts": {
    "start": "node app.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "MIT",
  "dependencies": {
    "dotenv": "^4.0.0",
    "mqtt": "^2.12.0",
    "object-sizeof": "^1.2.0",
    "request": "^2.81.0",
    "traverse": "^0.6.6",
    "url": "^0.11.0"
  }
}

To my knowledge, I have both the Dockerfile and package.json file required to build and package up this project. I can deploy this to a standard alpine linux docker container as-is. What am i doing wrong here?


#3

BTW, I just found this issue:

None of these represents the problem I’m facing.


#4

Hi @awolverton since you are using template variables, the %%RESIN_MACHINE_NAME%%, you should use Dockerfile.template, instead of Dockerfile. You can just rename it in git (git mv Dockerfile Dockerfile.template and then a git commit).

See more in the docs at https://docs.resin.io/deployment/docker-templates/


#5

@imrehg I just tried that, and still no love. I get the same error.


#6

It might be a silly question, but the more Dockerfile line is actually inside your Dockerfile?
Would it be possible to share your project with us, so we can look at it in its entirety? (e.g. if it’s on Github, or such). What device type are you using?


#7

To simplify the Dockerfile.template, I copied the one from the simple server example app you have an am using that one.

FROM resin/%%RESIN_MACHINE_NAME%%-node:6-slim

WORKDIR /usr/src/app

COPY package.json package.json

RUN JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*

COPY . ./

ENV INITSYSTEM on

CMD ["npm", "start"]

Isn’t it pushing to YOUR github repo? Can’t the contents be checked there?


#8

Hey @awolverton, I’ve tried that Dockerfile.temple content, and it processes it perfectly fine (using an application set up for the raspberrypi3 device type).

You are pushing to the resin servers, but since they were rejected, they are never stored by us, so we won’t see anything (also, we are not looking at our users’ code through there, but ask for explicit consent and external access).

What device type are you using?
Are you sure that your Dockerfile.template is checked in and committed in git? (sorry for the simple questions, just trying to cover all the bases).

As an alternate test, could you clone and push this simple-server-node to your application? (later you can overwrite that with your own project doing a git push --force resin master with your own code to reset the repo to yours)


#9

This is an RPI 1

Yes, all of the code including the template file is def checked in.


#10

BTW… the simple server checks in and deploys just fine.


#11

That points towards something unfortunately not-quite-right with the code you are trying to deploy. Hence our questions regarding the complete setup (since simple-server-node and your dockerfile example both works when we try it without seeing the complete repo).

Would it be possible to share your code with us, as mentioned before, to try to replicate what you experience?

Or instead of that, you could take the simple-server-node code and adjust it to your project by adding your files and updating the Dockerfile.template. That would let you start from a known working stage, which might make things more simple and quicker.


#12

I think I figured it out.

i was doing a push like:

git push resin resin-master:master

your checking process barfs on this. It will only accept the local master branch for check in.

How do you deal with projects that MUST have different deploy targets? For example, this app is being containerized in a different base image for other uses, but in the resinOS image here? How can i use multiple Docker files for your check in procedure and explicitly define which one to use for resin?


#13

Now that the app is actually downloading, I see this error in the device logs. I have no clue how to diagnose this:

27.08.17 13:40:18 (-0500) Failed to start application 'registry2.resin.io/qiotmqttagentrpi1/0a40648adc7806d049bf6172e44e98aa5f53bedb' due to '[object Object]'


#14

It is highly unlikely that this was the real reason, because the remote git endpoint does not ever know your local git branch name. As long as you are pushing to master, you can push from any branch, let it be master, resin-master, or anything… (and just tried it out to sanity check too).

Not 100% sure about the Failed to start application issue. For this we need some more info (since don’t know what code are you pusing exactly). Can you send us the device’s dashboard link in private? (just click on my profile picture and send message).


#15

You should give it a test. It fails consistently for me in that manner. The only difference in which branch I check in from.

How do I find this dashboard link you’re refering to? And how do I privately send it to you?


#16

No links in this to send you a message.


#17

Hi, as mentioned above, I gave it a test, and no matter what the local branch name is, the push succeeds. Send you a private message from our side then.


#18

That’s quite odd. I can reproduce it with a brand new repository as well.


#19

Would you mind providing a link to the brand new repository, and the version of git that you are running? Now that it can be replicated using a demonstration repository this hopefully shouldn’t require any publication of secrets. There is something weird happening here because, as @imrehg states, when aliasing branches using the : your local execution of git should not be letting the remote know your local branch name.


#20

I tried to respond to your DM and got this error.


#21

Pi 1’s. I have 2 of these behaving the same way.

https://dashboard.resin.io/apps/520452/devices/678163/summary
https://dashboard.resin.io/apps/520452/devices/679090/summary

Rebooting them doesn’t help. Restarting the app doesn’t help. Hard power cycling doesn’t help. Sometimes after a day or so, it resolves itself… until I deploy another app version.

This is a Pi3 running the same project. It works 100% of the time:

https://dashboard.resin.io/apps/520648/devices/678780/summary