You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-06-03 16:35:37 +02:00
Show correct default paths in UI (#6665)
This commit is contained in:
@@ -227,6 +227,10 @@ func setupEvilGlobals(ctx context.Context, c *cli.Command, s store.Store) (err e
|
||||
server.Config.Pipeline.Proxy.HTTP = c.String("backend-http-proxy")
|
||||
server.Config.Pipeline.Proxy.HTTPS = c.String("backend-https-proxy")
|
||||
|
||||
// pipeline config paths
|
||||
server.Config.Pipeline.ConfigPaths = c.StringSlice("default-pipeline-configs")
|
||||
server.Config.Pipeline.ConfigExtensions = c.StringSlice("default-pipeline-config-extensions")
|
||||
|
||||
// server configuration
|
||||
server.Config.Server.JWTSecret, err = setupJWTSecret(s)
|
||||
if err != nil {
|
||||
|
||||
@@ -81,6 +81,8 @@ var Config = struct {
|
||||
HTTP string
|
||||
HTTPS string
|
||||
}
|
||||
ConfigPaths []string
|
||||
ConfigExtensions []string
|
||||
// TODO: remove with version 4.x
|
||||
ForceIgnoreServiceFailure bool
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@ package web
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -39,6 +41,23 @@ func Config(c *gin.Context) {
|
||||
csrf, _ = t.Sign(user.Hash)
|
||||
}
|
||||
|
||||
var configPaths []string
|
||||
|
||||
extensionsClean := make([]string, len(server.Config.Pipeline.ConfigExtensions))
|
||||
for i, e := range server.Config.Pipeline.ConfigExtensions {
|
||||
extensionsClean[i] = strings.TrimPrefix(e, ".")
|
||||
}
|
||||
|
||||
extensions := strings.Join(extensionsClean, ",")
|
||||
for _, p := range server.Config.Pipeline.ConfigPaths {
|
||||
if strings.HasSuffix(p, "/") {
|
||||
// it's a directory -> add extensions
|
||||
configPaths = append(configPaths, fmt.Sprintf("%s*.{%s}", p, extensions))
|
||||
} else {
|
||||
configPaths = append(configPaths, p)
|
||||
}
|
||||
}
|
||||
|
||||
configData := map[string]any{
|
||||
"user": user,
|
||||
"csrf": csrf,
|
||||
@@ -48,6 +67,7 @@ func Config(c *gin.Context) {
|
||||
"enable_swagger": server.Config.WebUI.EnableSwagger,
|
||||
"user_registered_agents": !server.Config.Agent.DisableUserRegisteredAgentRegistration,
|
||||
"max_pipeline_log_line_count": server.Config.WebUI.MaxPipelineLogLineCount,
|
||||
"default_config_paths": configPaths,
|
||||
}
|
||||
|
||||
// default func map with json parser.
|
||||
@@ -83,4 +103,5 @@ window.WOODPECKER_ENABLE_SWAGGER = {{ .enable_swagger }};
|
||||
window.WOODPECKER_SKIP_VERSION_CHECK = {{ .skip_version_check }}
|
||||
window.WOODPECKER_USER_REGISTERED_AGENTS = {{ .user_registered_agents }}
|
||||
window.WOODPECKER_MAX_PIPELINE_LOG_LINE_COUNT = {{ .max_pipeline_log_line_count }}
|
||||
window.WOODPECKER_DEFAULT_CONFIG_PATHS = {{ json .default_config_paths }}
|
||||
`
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
"success": "Project settings updated",
|
||||
"pipeline_path": {
|
||||
"path": "Pipeline path",
|
||||
"default": "By default: .woodpecker/*.{'{yaml,yml}'} -> .woodpecker.yaml -> .woodpecker.yml",
|
||||
"by_default": "By default: {paths}",
|
||||
"desc": "Path to your pipeline config (for example {0}). Folders should end with a {1}.",
|
||||
"desc_path_example": "my/path/"
|
||||
},
|
||||
|
||||
@@ -10,6 +10,7 @@ declare global {
|
||||
WOODPECKER_ENABLE_SWAGGER: boolean | undefined;
|
||||
WOODPECKER_USER_REGISTERED_AGENTS: boolean | undefined;
|
||||
WOODPECKER_MAX_PIPELINE_LOG_LINE_COUNT: number | undefined;
|
||||
WOODPECKER_DEFAULT_CONFIG_PATHS: string[] | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +23,5 @@ export default () => ({
|
||||
enableSwagger: window.WOODPECKER_ENABLE_SWAGGER === true || false,
|
||||
userRegisteredAgents: window.WOODPECKER_USER_REGISTERED_AGENTS || false,
|
||||
maxPipelineLogLineCount: window.WOODPECKER_MAX_PIPELINE_LOG_LINE_COUNT ?? 5000,
|
||||
defaultConfigPaths: window.WOODPECKER_DEFAULT_CONFIG_PATHS || [],
|
||||
});
|
||||
|
||||
@@ -142,7 +142,9 @@
|
||||
<TextField
|
||||
:id="id"
|
||||
v-model="repoSettings.config_file"
|
||||
:placeholder="$t('repo.settings.general.pipeline_path.default')"
|
||||
:placeholder="
|
||||
$t('repo.settings.general.pipeline_path.by_default', { paths: defaultConfigPaths.join(' ➔ ') })
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -196,6 +198,7 @@ import Settings from '~/components/layout/Settings.vue';
|
||||
import useApiClient from '~/compositions/useApiClient';
|
||||
import { useAsyncAction } from '~/compositions/useAsyncAction';
|
||||
import useAuthentication from '~/compositions/useAuthentication';
|
||||
import useConfig from '~/compositions/useConfig';
|
||||
import { requiredInject } from '~/compositions/useInjectProvide';
|
||||
import useNotifications from '~/compositions/useNotifications';
|
||||
import { useWPTitle } from '~/compositions/useWPTitle';
|
||||
@@ -208,6 +211,7 @@ const notifications = useNotifications();
|
||||
const { user } = useAuthentication();
|
||||
const repoStore = useRepoStore();
|
||||
const i18n = useI18n();
|
||||
const { defaultConfigPaths } = useConfig();
|
||||
|
||||
const repo = requiredInject('repo');
|
||||
const repoSettings = ref<RepoSettings>();
|
||||
|
||||
Reference in New Issue
Block a user