Merge branch 'develop' of github.com:ansible-semaphore/semaphore into develop

This commit is contained in:
Denis Gukov 2021-12-16 02:23:02 +05:00
commit edddc78098
4 changed files with 87 additions and 111 deletions

View File

@ -4,11 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/ansible-semaphore/semaphore/api/helpers"
"github.com/ansible-semaphore/semaphore/api/sockets"
"github.com/ansible-semaphore/semaphore/db"
"github.com/ansible-semaphore/semaphore/util"
"io/ioutil"
"os"
"os/exec"
@ -16,6 +11,12 @@ import (
"strconv"
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/ansible-semaphore/semaphore/api/helpers"
"github.com/ansible-semaphore/semaphore/api/sockets"
"github.com/ansible-semaphore/semaphore/db"
"github.com/ansible-semaphore/semaphore/util"
)
const (
@ -92,7 +93,7 @@ func (t *task) updateStatus() {
"task_id": t.task.ID,
"template_id": t.task.TemplateID,
"project_id": t.projectID,
"version": t.task.Version,
"version": t.task.Version,
})
util.LogPanic(err)
@ -190,7 +191,7 @@ func (t *task) prepareRun() {
}
t.log("Prepare task with template: " + t.template.Alias + "\n")
t.updateStatus()
//if err := t.installKey(t.repository.SSHKey, db.AccessKeyUsagePrivateKey); err != nil {
@ -201,9 +202,11 @@ func (t *task) prepareRun() {
}
if strings.HasPrefix(t.repository.GitURL, gitURLFilePrefix) {
repositoryPath := strings.TrimPrefix(gitURLFilePrefix, t.repository.GitURL)
repositoryPath := strings.TrimPrefix(t.repository.GitURL, gitURLFilePrefix)
if _, err := os.Stat(repositoryPath); err != nil {
t.log("Failed in finding static repository at " + repositoryPath + ": " + err.Error())
t.fail()
return
}
} else {
if err := t.updateRepository(); err != nil {
@ -782,7 +785,7 @@ func (t *task) setCmdEnvironment(cmd *exec.Cmd, gitSSHCommand string) {
env = append(env, "SEMAPHORE_TASK_USERNAME="+user.Username)
}
if t.template.Type != db.TemplateTask {
if t.template.Type != db.TemplateTask {
env = append(env, "SEMAPHORE_TASK_TYPE="+string(t.template.Type))
var version string
switch t.template.Type {

133
web2/package-lock.json generated
View File

@ -1961,6 +1961,17 @@
"unique-filename": "^1.1.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
@ -2008,6 +2019,25 @@
"path-exists": "^4.0.0"
}
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
@ -2072,6 +2102,16 @@
"minipass": "^3.1.1"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"terser-webpack-plugin": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz",
@ -2089,6 +2129,18 @@
"webpack-sources": "^1.4.3"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
},
"wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
@ -14931,87 +14983,6 @@
}
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.1.tgz",
"integrity": "sha512-V53TJbHmzjBhCG5OYI2JWy/aYDspz4oVHKxS43Iy212GjGIG1T3EsB3+GWXFm/1z5VwjdjLmdZUFYM70y77vtQ==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": {
"version": "3.4.4",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.4.tgz",

View File

@ -13,10 +13,10 @@
</div>
</v-toolbar>
<v-data-table
:headers="headers"
:items="items"
:footer-props="{ itemsPerPageOptions: [20] }"
class="mt-4"
:headers="headers"
:items="items"
:footer-props="{ itemsPerPageOptions: [20] }"
class="mt-4"
>
<template v-slot:item.tpl_alias="{ item }">
<div class="d-flex">
@ -25,37 +25,38 @@
</v-icon>
<TaskLink
:task-id="item.id"
:tooltip="item.message"
:label="'#' + item.id"
:task-id="item.id"
:tooltip="item.message"
:label="'#' + item.id"
/>
<v-icon small class="ml-1 mr-1">mdi-arrow-left</v-icon>
<a :href="
'/project/' + item.project_id +
'/templates/' + item.template_id"
>{{ item.tpl_alias }}</a>
<router-link :to="
'/project/' + item.project_id +
'/templates/' + item.template_id"
>{{ item.tpl_alias }}
</router-link>
</div>
</template>
<template v-slot:item.version="{ item }">
<TaskLink
:disabled="item.tpl_type === 'build'"
class="ml-2"
v-if="item.tpl_type !== ''"
:status="item.status"
:disabled="item.tpl_type === 'build'"
class="ml-2"
v-if="item.tpl_type !== ''"
:status="item.status"
:task-id="item.tpl_type === 'build'
:task-id="item.tpl_type === 'build'
? item.id
: item.build_task.id"
: (item.build_task || {}).id"
:label="item.tpl_type === 'build'
:label="item.tpl_type === 'build'
? item.version
: item.build_task.version"
: (item.build_task || {}).version"
:tooltip="item.tpl_type === 'build'
:tooltip="item.tpl_type === 'build'
? item.message
: item.build_task.message"
: (item.build_task || {}).message"
/>
<div class="text-center" v-else>&mdash;</div>
</template>

View File

@ -27,6 +27,7 @@
</EditDialog>
<EditDialog
:max-width="700"
v-model="copyDialog"
save-button-text="Create"
title="New Template"