Extracted files are 0.
Hi,
Thanks for this great script. But unfortunately I can't get it to work. It looks like the file is empty after getFileContents gets executed. The path to the master is correct, I'm able to download the zip file through my browser.
Verbose log:
BitBucket Sync - Full Deploy
- Fetching archive from https://bitbucket.org/boldinteractive/test/get/master.zip
- Extracting archive to commits/ # Unable to find the extracted files in commits/
PHP Info > http://deploy.boldinteractive.nl/info.php
Comments (24)
-
reporter -
repo owner Hello,
The API user and pw are your bitbucket credentials indeed.
Most of the time issues are caused by incorrect write permissions. You need to make sure the commits folder is write-accessible by the www user. Does your error_log say anything interesting?
Regards, Alex
-
repo owner Oh. I see boldinteractive is a team user. Did you specify the team parameter when accessing the deploy.php URL? i.e.
?setup=test&team=boldinteractive
-
reporter No interesting stuff in the error logs and yes I specified the team parameter. This is the url I use:
deploy.boldinteractive.nl/deploy.php?setup=test&key=XXXXXX&team=boldinteractive
-
repo owner OK, then can you check the permissions for
commits
folder? -
reporter It's 755 also tried 777. I think it's not a permission thing.
After getFileContents is executed Curl is writing a file to the commits folder but it's empty. See screenshot.
-
repo owner It's definitely not a permission, since new files are created. There might be 2 things: the response from bitbucket is really empty or there might be something exotic with your setup (for instance, i once had issues with some versions of curl which were too new for the script at that time).
One thing to check is that your server is allowed to reach bitbucket and get data (maybe login through SSH and try a wget with the zip URL).
Apart from that, I think enabling versobe mode for CURL would be a good idea. Add
curl_setopt($ch, CURLOPT_VERBOSE, true);
on line 406 and check the error_log.Apart from this, there's not much I can suggest...
Let me know how it goes.
Thanks, Alex
-
reporter Cannot wget the file > 401 UNAUTHORIZED Trying to figure out why. I don't need to enable something in my Bitbucket account right for wget? Because wget is just regular download request, like in a browser. I use the following command
wget https://colinory:XXXXXX@bitbucket.org/boldinteractive/test/get/master.zip
-
reporter And nothing appends to my error log after turning verbose mode to true for Curl..
But I think it's auth thing... Will keep trying the wget.. Maybe I use the wrong parameters for wget for https requests..
-
repo owner Bitbucket uses Basic Auth, so the request is correct and it should work. However, it's not working for me either with wget. We'll keep trying myself also.
-
reporter This worked:
-
repo owner FYI - I was able to get a private repo zip with wget from an ubuntu machine. So you it should work for you as well.
-
repo owner Did your URL have /get/master.zip or simply /master.zip? Could that be an issue? Otherwise, not sure what could be. Connectivity, authentication, permissions - all are OK. I'm out of clues...
-
reporter simply /master!
-
reporter hm without get is not the right file. But when I add /get/ it retrieves the right file after all. So Curl is working!
-
reporter Alex! My bad. There was a weird typo in my password in the config.php. It's working!
:( bad case of the mondays
-
repo owner Ah. That's OK. Hehe, I'm glad when things like this happen - in the end you know it's not something wrong with the code :)
Take it easy! Do let me know if you run into other issues.
-
repo owner - changed status to resolved
-
reporter Suggestion: create error notification when user creds are wrong?
-
reporter Maybe a cool feature to add > Manage deployment Interface.
Just builded my own :)
-
repo owner It's on the ToDo list, but no time to work on :( Would be glad if you would like to share what you have. That would be a starting point.
-
reporter It's very very very simple (and quick&dirty ;)). I could e-mail it to you! What's your mail?
-
reporter config.php - Add rows from DB to $DEPLOY
$sql = "SELECT * FROM deployments"; $result = $conn->query($sql);
$DEPLOY = array();
if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) {
$DEPLOY[$row['name']] = $row['path'];
}}
-
reporter -- -- Table structure for table
deployments
--CREATE TABLE IF NOT EXISTS
deployments
(id
smallint(6) NOT NULL auto_increment,name
varchar(256) NOT NULL,path
varchar(256) NOT NULL,timestamp
timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (id
) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - Log in to comment
p.s. It's a private repository. I filled in the API user & API password field in config.php. But I don't know if this is just my regular login credentials for Bitbucket?