Repository navigation
Add a validator for git / http sources - #137
Conversation
04dcc4e to
3f27ae9
Compare
There was a problem hiding this comment.
I couldn't think of a way to do the git lint without a subtle
There was a problem hiding this comment.
system(‘curl’, ‘-IL’, @specification.source[:http], ‘-f’)
On Jun 4, 2015, at 5:44 PM, Orta notifications@github.com wrote:
In app/models/specification_wrapper.rb #137 (comment):
@@ -48,6 +49,20 @@ def validation_errors
results
end
def validate_public_accessreturn validate_http if @specification.source[:http]return validate_git if @specification.source[:git]trueend
def validate_http I couldn't think of a way to do the git lint without a subtlesystem("curl -IL #{ Shellwords.escape @specification.source[:http] } -f")—
Reply to this email directly or view it on GitHub https://github.com/CocoaPods/trunk.cocoapods.org/pull/137/files#r31780251.
There was a problem hiding this comment.
also, will want to redirect out & err to /dev/null
There was a problem hiding this comment.
Why not just use validate_url from Core? https://github.com/CocoaPods/Core/blob/816eda9f90dd8fc54901b0fd4b768691fc1295bf/lib/cocoapods-core/http.rb#L35-39
|
I can write up specs tomorrow, if you'd like. |
|
@segiddins I can search my feelings ;) Not sure what problem it solves though. Help? |
|
It makes sure pods in trunk are actually public ally accessible before allowing them to be pushed. -Samuel E. Giddins On Jun 5, 2015, at 9:04 AM, Florian R. Hanke notifications@github.com wrote: @segiddins I can search my feelings ;) Not sure what problem it solves though. Help? — |
|
Ah thanks. Seems weird we haven't thought of this right when writing trunk. The current code probably needs more error handling (or rather, status codes checking) and better - and more precise - info for the user so they can act appropriately. Is it time yet for asynchronous processing of trunk pushes and reporting the running jobs on the command line? |
|
The only reason I see to do that is the heroku timeout... It's ok to me if the actual push takes a bit from the users perspective. -Samuel E. Giddins On Jun 5, 2015, at 9:22 AM, Florian R. Hanke notifications@github.com wrote: Ah thanks. Seems weird we haven't thought of this right when writing trunk. The current code probably needs more error handling (or rather, status codes checking) and better - and more precise - info for the user so they can act appropriately. Is it time yet for asynchronous processing of trunk pushes and reporting the running jobs on the command line? Checking if publicly available? ... Yes! () |
|
@segiddins We can set the Heroku timeout, should that be a problem. |
|
@floere pretty sure it's bounded at 30 seconds |
Trunk was really only interested in validating data it needed to be able to do its work, ensuring the rest of the podspec data is valid was upto the client. |
|
@alloy Not saying it needs to do it – saying it's weird we haven't considered the case (at least I can't remember). |
|
@segiddins @orta @alloy If the long-runny-ness of this becomes an issue, I see two solutions: background jobs/multi-request (the client periodically gets the latest state – good if we have many requests for trunk), or response streaming (updating the info the client has as we go – good if we don't have many requests for trunk). Putting this here so I don't forget. |
|
@alloy Would you then prefer this verification be in the client? |
|
Yeah I did consider it then, but left it to the client. Clearly that didn't turn out to be enough, probably because people push pods from private repos that their machines have access to at the time of validating :) |
|
@alloy Ah yes… good point. I do remember that we discussed that trunk act as a guard for ok pods – and that the client only does checks to provide a responsive/comfortable UI. According to that line of thought, this code would need to be in trunk. |
|
Yeah I think it’s fine to do this now in Trunk. I think it would just be good to keep these things to a minimum and not require an extra queue :) |
|
@alloy We're both from the "do the minimum that works" school :) |
|
@floere Yeah I know, it was a general statement ;) |
|
Got a sense of what I think it would just be good to keep these things to a minimum and not require an extra queue means here? What do I need to do to get this wrapped up? |
|
I think it would be a good idea to add a timeout block around the call and log how long it took to perform, then you an fine tune it after it's in use. I'd also urge you to not use a shell at all, but instead call open/spawn with an array of arguments. That way there can never be any illicit command execution. |
|
I’d just mock the call to |
acd14ee to
8ab7a4e
Compare
|
Alright, this is 👍 |
There was a problem hiding this comment.
Why not take an &blk arg so you don't have to create explicit procs?
There was a problem hiding this comment.
not sure how to do that, and the proc worked for QIs earlier /shrug
There was a problem hiding this comment.
This would be a bit nicer yeah, not a show stopper, though. @segiddins can you add it, if you feel strongly about it?
There was a problem hiding this comment.
shouldn't that be @specification.source[:tag] || @specification.source[:commit] || @specification.source[:branch] || 'HEAD' ?
There was a problem hiding this comment.
Given that it's trunk, it can only be :tag, and I'm validating it exists pod spec lint will have checked that the tag exists by this point.
There was a problem hiding this comment.
Given that it's trunk, it can only be :tag, and I'm validating the repo exists - pod spec lint will have checked that the tag exists by this point.
|
@alloy can you give this a final look? |
|
LGTM 👍 |
|
I'll make my few style changes, then merge tonight. Thanks @orta :) |
98deb0a to
95914cc
Compare
Add a validator for git / http sources
|
Nice work, fellas 👍 |
|
Thanks sir |

This is some of the initial work around #136
I'm struggling with figuring out how to test this and whether it is safe. Assigning to @alloy to give a one over.