Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private repos and restart builds #8

Closed
wants to merge 6 commits into from
Closed

Private repos and restart builds #8

wants to merge 6 commits into from

Conversation

doublejosh
Copy link

Updated the library to allow public repos in order to allow restarting builds via API. Found trouble using the file_get_contents() with authentication headers from within a framework. Curl is better for such things... and POST requests.

Notes:

  • Added a setApiUrlPrivate() function and private variable.
  • Added a tokenAuthListener to extend Buzz and allow the correct authorization header.
  • Added both a $clientInterface for curl, and $token param in the __construct() function, which uses an event listener in the Buzz library.
  • Run private API requests through the Curl interface.
  • Added a new $client->restartBuild($build) method.

See here:

Addresses:

@@ -59,6 +65,16 @@ public function fetchRepository($slug)
return $repository;
}

public function restartBuild($build) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you might want to move Client::restartBuild($build), to maybe Build::restart() that uses $build->id internally.

That way you could do something like...

$repository = $client->fetchRepository('org/repo-name');
$repsotory->getLastBuild()->restart();

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there is no instance of $client within a Build there are two options:

  1. Pass the client to the build (ok) $repsotory->getLastBuild()->restart($client);
  2. Add a __construct() to both Repository and Build that includes $client, and enable directly calling $build->restart(); (better)

Suggesting going for the full meal deal and allow for Travis objects to perform operations. The build restart action is just the first of many. Question: it ok to go forward with this pull request before doing so?

@doublejosh
Copy link
Author

A new API endpoint is almost available to restart builds...
https://gist.github.com/carlad/24a0d697e885a7d1b0c7

@doublejosh
Copy link
Author

Work linking to my fork, which is mostly to accomplish this...
https://github.com/tableau-mkt/php-travis-client

@rolebi
Copy link

rolebi commented Oct 16, 2015

What is left to be done here ? Would love to help if necessary : )

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants