setup the worker to stream results

This commit is contained in:
Brad Rydzewski 2014-07-11 15:29:31 -07:00
parent 4aba399b3b
commit 3e5035c254
6 changed files with 17 additions and 63 deletions

View file

@ -46,3 +46,7 @@ lessc:
# `sudo dpkg -i drone.deb`
deb:
dpkg-deb --build debian/drone
deploy:
scp -i $$DRONE_STAGING_KEY debian/drone.deb $$DRONE_STAGING_USER@$$DRONE_STAGING_HOST:/tmp
ssh -i $$DRONE_STAGING_KEY $$DRONE_STAGING_USER@$$DRONE_STAGING_HOST -- dpkg -i /tmp/drone.deb

View file

@ -1,9 +1,11 @@
start on (filesystem and net-device-up)
chdir /root/.drone
console log
script
mkdir -p /root/.drone
cd /root/.drone
DRONED_OPTS="--port=:80"
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB

View file

@ -139,10 +139,14 @@ app.config(['$routeProvider', '$locationProvider', function($routeProvider, $loc
$locationProvider.html5Mode(true);
}]);
/* Directives */
/* also see https://coderwall.com/p/vcfo4q */
app.run(['$location', '$rootScope', '$routeParams', function($location, $rootScope, $routeParams) {
app.run(['$location', '$rootScope', '$routeParams', 'feed', 'stdout', function($location, $rootScope, $routeParams, feed, stdout) {
$rootScope.$on('$routeChangeStart', function (event, next) {
feed.unsubscribe();
stdout.unsubscribe();
});
$rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
document.title = current.$$route.title + ' · drone.io';
});

View file

@ -19,6 +19,6 @@ angular.module('app').service('feed', ['$http', '$window', function($http, $wind
};
this.unsubscribe = function() {
ws.close();
wsCallback = undefined;
};
}]);

View file

@ -1,48 +0,0 @@
<h1>{{ repo.name }}</h1>
<a href="/{{ repo.remote }}/{{ repo.owner}}/{{ repo.name }}">Back</a>
<a href="/{{ repo.remote }}/{{ repo.owner}}/{{ repo.name }}/settings">Settings</a>
<div class="row">
<div class="col-xs-6 col-sm-3">
What to show here?
</div>
<!-- primary column -->
<div class="col-xs-12 col-sm-9">
<table class="table table-bordered">
<tr>
<th>Status</th>
<th>Branch</th>
<th>Sha</th>
<th>PR</th>
<th colspan=2>Author</th>
<th>Message</th>
<th>Started</th>
<th>Finished</th>
</tr>
<tr ng-repeat="commit in commits">
<td>
<a href="/{{ $parent.repo | fullPath }}/{{ commit.branch }}/{{ commit.sha }}">
<span>{{ commit.status }}</span>
</a>
</td>
<td>
<a href="/{{ $parent.repo | fullPath }}/{{ commit.branch }}">
<span>{{ commit.branch }}</span>
</a>
</td>
<td>
<a href="/{{ $parent.repo | fullPath }}/{{ commit.branch }}/{{ commit.sha }}">
<span>{{ commit.sha | shortHash }}</span>
</a>
</td>
<td>{{ commit.pull_request }}</td>
<td>{{ commit.author }}</td>
<td><img class="gravatar" ng-src="https://secure.gravatar.com/avatar/{{ commit.gravatar }}?s=32&d=mm" /></td>
<td>{{ commit.message }}</td>
<td>{{ commit.started_at | fromNow }}</td>
<td>{{ commit.finished_at | fromNow }}</td>
</tr>
</table>
</div>
</div>

View file

@ -119,16 +119,8 @@ func (w *worker) Execute(r *Request) {
builder.Timeout = time.Duration(r.Repo.Timeout) * time.Minute
builder.Privileged = r.Repo.Privileged
//err := builder.Run()
var err error
buf.WriteString("THIS\n")
time.Sleep(3 * time.Second)
buf.WriteString("IS\n")
time.Sleep(3 * time.Second)
buf.WriteString("A\n")
time.Sleep(3 * time.Second)
buf.WriteString("TEST\n")
time.Sleep(3 * time.Second)
// run the build
err := builder.Run()
// update the build status based on the results
// from the build runner.