-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRoboFile.php
117 lines (105 loc) · 3.17 KB
/
RoboFile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
const CONTAINER_PATH = 'build/containers';
const CONTAINER_NAMESPACE = 'gcr.io/littleman-co/www-littleman-co';
/**
* Runs lints over the codebase
*
* @option files A space separated list of files to lint
*/
public function lint()
{
return $this->taskExecStack()
->stopOnFail()
->exec('yamllint .');
}
/**
* Runs unit tests on the codebase
*/
public function testUnit()
{
$this->say('This project has no unit tests; this is a demonstration task');
}
/**
* Runs integration tests on the codebase
*/
public function testIntegration()
{
$this->say('This project has no integration tests; this is a demonstration task');
}
/**
* Runs smoke tests on the codebase
*/
public function testSmoke()
{
$this->say('This project has no smoke tests; this is a demonstration task');
}
/**
* Runs stress tests on the codebase
*/
public function testStress()
{
$this->say('This project has no stress tests; this is a demonstration task');
}
/**
* Compiles the static site
*/
public function applicationCompile()
{
return $this->taskExec('hugo');
}
/**
* Builds containers. Available containers are those at the path "build/containers"
*
* @option container The container to build
*/
public function containerBuild($opts = ['container' => 'web'])
{
$refspec = exec('git rev-parse --short HEAD');
$containerName = self::CONTAINER_NAMESPACE . '--' . $opts['container'];
return $this->taskExec('img')
->args([
"build",
"--file=" . self::CONTAINER_PATH . '/' . $opts['container'] . '/' . 'Dockerfile',
"--tag=" . $containerName . ':' . $refspec,
"--tag=" . $containerName . ':latest',
"."
]);
}
/**
* Pushes containers
*
* @option container The container to push upstream
*/
public function containerPush($opts = ['container' => 'web'])
{
$refspec = exec('git rev-parse --short HEAD');
$containerName = self::CONTAINER_NAMESPACE . '--' . $opts['container'];
return $this->taskExecStack()
->stopOnFail()
->exec('img push ' . $containerName . ':' . $refspec)
->exec('img push ' . $containerName . ':latest');
}
/**
* Pushes a change to a given environment
*
* @option environment The environment to push to. Should be one of "testing", "canary" or "production"
*/
public function deploy($opts = ['environment' => 'testing'])
{
$this->say('This project does not deploy with this yet, though it would deploy to ' . $opts['environment']);
}
/**
* Rolls back a change to a given environment to the previous version of that change.
*/
public function rollback()
{
$this->say('This project does not rollback yet');
}
}