SquareSquash / web

Squash’s front-end and API host.
http://www.squash.io
Apache License 2.0
963 stars 134 forks source link

build numbers #24

Open danehammer opened 11 years ago

danehammer commented 11 years ago

How do I associate a new build number with a Java project?

The java deobfuscator and java client both make use of a build number. If I just put a number like 1, requests to notify fail because the build number and the deobfuscator fails because of the build number. Is there something I need to be doing to associate a build number before trying to upload stuff?

log when calling deobfuscator:

Started POST "/api/1.0/deobfuscation.json" for ... at 2013-01-24 17:52:04 -0600 Processing by Api::V1Controller#deobfuscation as JSON Parameters: {"api_key"=>"...", "environment"=>"dev", "build"=>"1", "namespace"=>"eJzT1dVVUCwqTarUz0/KSk0usQouLE0szrCy8kosS7Sy8kvMTS0uSExO5QIS\n2YnpqfFF+fklxVZoelJLuBQUMkD6FKpruQDLghzW\n"} Project Load (0.5ms) SELECT "projects".* FROM "projects" WHERE "projects"."api_key" = '...' LIMIT 1 app/controllers/api/v1_controller.rb:128:in deobfuscation' Environment Load (0.4ms) SELECT "environments".* FROM "environments" WHERE "environments"."project_id" = 2 AND (LOWER(name) = 'dev') LIMIT 1 app/controllers/api/v1_controller.rb:128:indeobfuscation' Deploy Load (0.4ms) SELECT "deploys".* FROM "deploys" WHERE "deploys"."environment_id" = 2 AND "deploys"."build" = '1' LIMIT 1 app/controllers/api/v1_controller.rb:128:in `deobfuscation' Completed 404 Not Found in 14ms (ActiveRecord: 1.3ms)

danehammer commented 11 years ago

Sorry if I shouldn't have logged this here, as I was drafting it I was thinking the build number was something related across the entire app, not just related to java. It feels like there's something I need to post to /deploy before I can start posting to /notify, but I'm not finding what it is.

RISCfuture commented 11 years ago

Yes, you should be using the squash_release tool in the java_deobfuscator gem to notify Squash of a new release as part of your build process.

See https://github.com/SquareSquash/java_deobfuscator#release-notification

danehammer commented 11 years ago

I tried using an existing environment and a non-existent one, but the squash_release command gets me this (from the squash server log):

Rejecting Deploy: repository revision does not exist in the repository Completed 422 Unprocessable Entity in 119ms (ActiveRecord: 3.8ms)

danehammer commented 11 years ago

So I played with requests to /notify and found that if I send a revision instead of a build number it accepts it. That might be an enhancement I could make to the java client - it expects to use a build number. I think my problem with the squash_release was because the revision I was using by default wasn't in the history of the git repository URL I gave the project when I created it.

Two more questions: is there a discussion group I can ask these questions? If so can you add it to the README or the squash.io site? Also, I still don't understand the workflow I need to take to go from a git repository that hosts java to being able to post exceptions and have the git blame stuff work out. I'm going to try and keep finding that out, and maybe contribute something here. Would an FAQ be good? Maybe a wiki page on this repo?

RISCfuture commented 11 years ago

There's no discussion group yet. I'll try to help you as best I can, and you can also ask @edenman, being the original author and primary user of the Java client.

The /notify API endpoint expects both a revision and a build. This is not perfect because the Deploy record on Squash (corresponding to the build number) already has the revision, so it's not necessary to send it twice. It's on a TODO list for me to fix.

You can pass --revision=SOME_SHA to squash_release if it cannot automatically determine the project's revision at release time.

The workflow is fairly straightforward:

That should be all you need. Where is this process breaking down for you?

danehammer commented 11 years ago

Okay squash_release worked with the SHA, so now posts to /notify work now that I have a valid build number. The hangup is on the deobfuscate - it succeeds, but when I post a bug, I get the message about not finding a rename log.

I think I understand what I'm mixing up. The bug is occurring in code from a dependency of the project I initialized the project with. How does that flow work? An assembly of artifacts that all have their own git repositories?

In other news, if you forget to set the Content-Type to application/json, you get a 422 for missing fields, which took me a while to figure out.

Thanks again for all the help. When I get it all happy I'm going to write up a wiki page for the maven use case.

RISCfuture commented 11 years ago

The build number you use when you call deobfuscate must match the build number you're sending up with your bug reports. Otherwise it won't know which renamelog to use.

codewarrior0 commented 11 years ago

@danehammer Do you mean your project has submodules, making the git repository a nest of several smaller repositories? I have a project like that, and Squash will not check out the submodules for me when it clones the main repo. This appears to be a limitation of ruby-git, with whom I had this enlightening conversation:

rio@rio-VirtualBox:~/.bundler/ruby/1.9.1/ruby-git-473d8ecc1fd4$ grep -r submodule .
./TODO:* submodule support