mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 12:30:41 +01:00
Merge pull request #156 from tokuhirom/dry_run
Added dry_run button. close #152
This commit is contained in:
commit
47b1fcebf9
@ -258,6 +258,10 @@ func (t *task) runPlaybook() error {
|
||||
args = append(args, "-vvvv")
|
||||
}
|
||||
|
||||
if t.task.DryRun {
|
||||
args = append(args, "--check")
|
||||
}
|
||||
|
||||
if len(t.environment.JSON) > 0 {
|
||||
args = append(args, "--extra-vars", t.environment.JSON)
|
||||
}
|
||||
|
1
db/migrations/v1.8.0.sql
Normal file
1
db/migrations/v1.8.0.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE task ADD dry_run tinyint(1) NOT NULL DEFAULT 0 AFTER debug;
|
@ -64,5 +64,6 @@ func init() {
|
||||
{Minor: 1},
|
||||
{Major: 1, Minor: 6},
|
||||
{Major: 1, Minor: 7},
|
||||
{Major: 1, Minor: 8},
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ type Task struct {
|
||||
Status string `db:"status" json:"status"`
|
||||
Debug bool `db:"debug" json:"debug"`
|
||||
|
||||
DryRun bool `db:"dry_run" json:"dry_run"`
|
||||
|
||||
// override variables
|
||||
Playbook string `db:"playbook" json:"playbook"`
|
||||
Environment string `db:"environment" json:"environment"`
|
||||
|
@ -20,4 +20,5 @@
|
||||
|
||||
.modal-footer
|
||||
button.btn.btn-default.pull-left(ng-click="$dismiss()") Dismiss
|
||||
button.btn.btn-primary(ng-click="run(task, true)") Dry Run
|
||||
button.btn.btn-success(ng-click="run(task)") Run!
|
@ -3,10 +3,14 @@ define(function () {
|
||||
console.log(Template);
|
||||
$scope.task = {};
|
||||
|
||||
$scope.run = function (task) {
|
||||
$scope.run = function (task, dryRun) {
|
||||
task.template_id = Template.id;
|
||||
|
||||
$http.post(Project.getURL() + '/tasks', task).success(function (t) {
|
||||
var params = angular.copy(task);
|
||||
if (dryRun) {
|
||||
params.dry_run = true;
|
||||
}
|
||||
$http.post(Project.getURL() + '/tasks', params).success(function (t) {
|
||||
$scope.$close(t);
|
||||
}).error(function (_, status) {
|
||||
swal('Error', 'error launching task: HTTP ' + status, 'error');
|
||||
|
Loading…
Reference in New Issue
Block a user