Clean up config environment variables for server and agent (#218)

The goal here is to make consistent use of configuration environment variables prefixed `WOODPECKER_`. Where several variants existed, this PR aims to remove all but one option, leaving the most explicit.

This PR only changes server and agent code, but not documentation, in order to keep the PR digestible. Once we have consensus that this is correct, I'll change docs accordingly.

User (rather: admin) facing changes in this PR:

- In general, support for all server and agent config environment variables (env vars) starting with `DRONE_` is removed. The according `WOODPECKER_*` variables must be used instead.
- The env var `WOODPECKER_HOST` replaces `DRONE_HOST`, and `DRONE_SERVER_HOST`.
- The env var `WOODPECKER_AGENT_SECRET` is used to configure the shared secret which agents use to authenticate against the server. It replaces `WOODPECKER_SECRET`, `DRONE_SECRET`, `WOODPECKER_PASSWORD`, `DRONE_PASSWORD`, and `DRONE_AGENT_SECRET`.
- The env var `WOODPECKER_DATABASE_DRIVER` replaces `DRONE_DATABASE_DRIVER` and `DATABASE_DRIVER`.
- The env var `WOODPECKER_DATABASE_DATASOURCE` replaces `DRONE_DATABASE_DATASOURCE` and `DATABASE_CONFIG`.
This commit is contained in:
Marian Steinbach 2021-09-28 15:43:44 +02:00 committed by GitHub
parent 6144f16631
commit 17b8867b96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 220 additions and 207 deletions

View file

@ -24,8 +24,8 @@ pipeline:
image: golang:1.16 image: golang:1.16
group: db-test group: db-test
environment: environment:
- DATABASE_DRIVER=postgres - WOODPECKER_DATABASE_DRIVER=postgres
- DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
commands: commands:
- go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore
@ -33,8 +33,8 @@ pipeline:
image: golang:1.16 image: golang:1.16
group: db-test group: db-test
environment: environment:
- DATABASE_DRIVER=mysql - WOODPECKER_DATABASE_DRIVER=mysql
- DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
commands: commands:
- go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

View file

@ -3,10 +3,10 @@
FROM drone/ca-certs FROM drone/ca-certs
EXPOSE 8000 9000 80 443 EXPOSE 8000 9000 80 443
ENV DATABASE_DRIVER=sqlite3
ENV DATABASE_CONFIG=/var/lib/drone/drone.sqlite
ENV GODEBUG=netdns=go ENV GODEBUG=netdns=go
ENV XDG_CACHE_HOME /var/lib/drone ENV WOODPECKER_DATABASE_DATASOURCE=/var/lib/drone/drone.sqlite
ENV WOODPECKER_DATABASE_DRIVER=sqlite3
ENV XDG_CACHE_HOME=/var/lib/drone
ADD release/woodpecker-server /bin/ ADD release/woodpecker-server /bin/

View file

@ -3,10 +3,10 @@ EXPOSE 8000 9000 80 443
RUN apk add -U --no-cache ca-certificates RUN apk add -U --no-cache ca-certificates
ENV DATABASE_DRIVER=sqlite3
ENV DATABASE_CONFIG=/var/lib/drone/drone.sqlite
ENV GODEBUG=netdns=go ENV GODEBUG=netdns=go
ENV XDG_CACHE_HOME /var/lib/drone ENV WOODPECKER_DATABASE_DATASOURCE=/var/lib/drone/drone.sqlite
ENV WOODPECKER_DATABASE_DRIVER=sqlite3
ENV XDG_CACHE_HOME=/var/lib/drone
ADD release/woodpecker-server /bin/ ADD release/woodpecker-server /bin/

View file

@ -39,31 +39,31 @@ var Command = cli.Command{
}, },
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.BoolTFlag{ cli.BoolTFlag{
EnvVar: "WOODPECKER_LOCAL",
Name: "local", Name: "local",
Usage: "build from local directory", Usage: "build from local directory",
EnvVar: "DRONE_LOCAL,WOODPECKER_LOCAL",
}, },
cli.DurationFlag{ cli.DurationFlag{
EnvVar: "WOODPECKER_TIMEOUT",
Name: "timeout", Name: "timeout",
Usage: "build timeout", Usage: "build timeout",
Value: time.Hour, Value: time.Hour,
EnvVar: "DRONE_TIMEOUT,WOODPECKER_TIMEOUT",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "WOODPECKER_VOLUMES",
Name: "volumes", Name: "volumes",
Usage: "build volumes", Usage: "build volumes",
EnvVar: "DRONE_VOLUMES,WOODPECKER_VOLUMES",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "WOODPECKER_NETWORKS",
Name: "network", Name: "network",
Usage: "external networks", Usage: "external networks",
EnvVar: "DRONE_NETWORKS,WOODPECKER_NETWORKS",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_DOCKER_PREFIX",
Name: "prefix", Name: "prefix",
Value: "drone", Value: "drone",
Usage: "prefix containers created by drone", Usage: "prefix containers created by drone",
EnvVar: "DRONE_DOCKER_PREFIX,WOODPECKER_DOCKER_PREFIX",
Hidden: true, Hidden: true,
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
@ -86,199 +86,199 @@ var Command = cli.Command{
// workspace default // workspace default
// //
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_WORKSPACE_BASE",
Name: "workspace-base", Name: "workspace-base",
Value: "/drone", Value: "/drone",
EnvVar: "DRONE_WORKSPACE_BASE,WOODPECKER_WORKSPACE_BASE",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_WORKSPACE_PATH",
Name: "workspace-path", Name: "workspace-path",
Value: "src", Value: "src",
EnvVar: "DRONE_WORKSPACE_PATH,WOODPECKER_WORKSPACE_PATH",
}, },
// //
// netrc parameters // netrc parameters
// //
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_NETRC_USERNAME",
Name: "netrc-username", Name: "netrc-username",
EnvVar: "DRONE_NETRC_USERNAME,WOODPECKER_NETRC_USERNAME",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_NETRC_PASSWORD",
Name: "netrc-password", Name: "netrc-password",
EnvVar: "DRONE_NETRC_PASSWORD,WOODPECKER_NETRC_PASSWORD",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_NETRC_MACHINE",
Name: "netrc-machine", Name: "netrc-machine",
EnvVar: "DRONE_NETRC_MACHINE,WOODPECKER_NETRC_MACHINE",
}, },
// //
// metadata parameters // metadata parameters
// //
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_SYSTEM_ARCH",
Name: "system-arch", Name: "system-arch",
Value: "linux/amd64", Value: "linux/amd64",
EnvVar: "DRONE_SYSTEM_ARCH,WOODPECKER_SYSTEM_ARCH",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_SYSTEM_NAME",
Name: "system-name", Name: "system-name",
Value: "pipec", Value: "pipec",
EnvVar: "DRONE_SYSTEM_NAME,WOODPECKER_SYSTEM_NAME",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_SYSTEM_LINK",
Name: "system-link", Name: "system-link",
Value: "https://github.com/cncd/pipec", Value: "https://github.com/cncd/pipec",
EnvVar: "DRONE_SYSTEM_LINK,WOODPECKER_SYSTEM_LINK",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_REPO_NAME",
Name: "repo-name", Name: "repo-name",
EnvVar: "DRONE_REPO_NAME,WOODPECKER_REPO_NAME",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_REPO_LINK",
Name: "repo-link", Name: "repo-link",
EnvVar: "DRONE_REPO_LINK,WOODPECKER_REPO_LINK",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_REPO_REMOTE",
Name: "repo-remote-url", Name: "repo-remote-url",
EnvVar: "DRONE_REPO_REMOTE,WOODPECKER_REPO_REMOTE",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_REPO_PRIVATE",
Name: "repo-private", Name: "repo-private",
EnvVar: "DRONE_REPO_PRIVATE,WOODPECKER_REPO_PRIVATE",
}, },
cli.IntFlag{ cli.IntFlag{
EnvVar: "WOODPECKER_BUILD_NUMBER",
Name: "build-number", Name: "build-number",
EnvVar: "DRONE_BUILD_NUMBER,WOODPECKER_BUILD_NUMBER",
}, },
cli.IntFlag{ cli.IntFlag{
EnvVar: "WOODPECKER_PARENT_BUILD_NUMBER",
Name: "parent-build-number", Name: "parent-build-number",
EnvVar: "DRONE_PARENT_BUILD_NUMBER,WOODPECKER_PARENT_BUILD_NUMBER",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "WOODPECKER_BUILD_CREATED",
Name: "build-created", Name: "build-created",
EnvVar: "DRONE_BUILD_CREATED,WOODPECKER_BUILD_CREATED",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "WOODPECKER_BUILD_STARTED",
Name: "build-started", Name: "build-started",
EnvVar: "DRONE_BUILD_STARTED,WOODPECKER_BUILD_STARTED",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "WOODPECKER_BUILD_FINISHED",
Name: "build-finished", Name: "build-finished",
EnvVar: "DRONE_BUILD_FINISHED,WOODPECKER_BUILD_FINISHED",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_BUILD_STATUS",
Name: "build-status", Name: "build-status",
EnvVar: "DRONE_BUILD_STATUS,WOODPECKER_BUILD_STATUS",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_BUILD_EVENT",
Name: "build-event", Name: "build-event",
EnvVar: "DRONE_BUILD_EVENT,WOODPECKER_BUILD_EVENT",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_BUILD_LINK",
Name: "build-link", Name: "build-link",
EnvVar: "DRONE_BUILD_LINK,WOODPECKER_BUILD_LINK",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_BUILD_TARGET",
Name: "build-target", Name: "build-target",
EnvVar: "DRONE_BUILD_TARGET,WOODPECKER_BUILD_TARGET",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_COMMIT_SHA",
Name: "commit-sha", Name: "commit-sha",
EnvVar: "DRONE_COMMIT_SHA,WOODPECKER_COMMIT_SHA",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_COMMIT_REF",
Name: "commit-ref", Name: "commit-ref",
EnvVar: "DRONE_COMMIT_REF,WOODPECKER_COMMIT_REF",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_COMMIT_REFSPEC",
Name: "commit-refspec", Name: "commit-refspec",
EnvVar: "DRONE_COMMIT_REFSPEC,WOODPECKER_COMMIT_REFSPEC",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_COMMIT_BRANCH",
Name: "commit-branch", Name: "commit-branch",
EnvVar: "DRONE_COMMIT_BRANCH,WOODPECKER_COMMIT_BRANCH",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_COMMIT_MESSAGE",
Name: "commit-message", Name: "commit-message",
EnvVar: "DRONE_COMMIT_MESSAGE,WOODPECKER_COMMIT_MESSAGE",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_COMMIT_AUTHOR_NAME",
Name: "commit-author-name", Name: "commit-author-name",
EnvVar: "DRONE_COMMIT_AUTHOR_NAME,WOODPECKER_COMMIT_AUTHOR_NAME",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_COMMIT_AUTHOR_AVATAR",
Name: "commit-author-avatar", Name: "commit-author-avatar",
EnvVar: "DRONE_COMMIT_AUTHOR_AVATAR,WOODPECKER_COMMIT_AUTHOR_AVATAR",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_COMMIT_AUTHOR_EMAIL",
Name: "commit-author-email", Name: "commit-author-email",
EnvVar: "DRONE_COMMIT_AUTHOR_EMAIL,WOODPECKER_COMMIT_AUTHOR_EMAIL",
}, },
cli.IntFlag{ cli.IntFlag{
EnvVar: "WOODPECKER_PREV_BUILD_NUMBER",
Name: "prev-build-number", Name: "prev-build-number",
EnvVar: "DRONE_PREV_BUILD_NUMBER,WOODPECKER_PREV_BUILD_NUMBER",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "WOODPECKER_PREV_BUILD_CREATED",
Name: "prev-build-created", Name: "prev-build-created",
EnvVar: "DRONE_PREV_BUILD_CREATED,WOODPECKER_PREV_BUILD_CREATED",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "WOODPECKER_PREV_BUILD_STARTED",
Name: "prev-build-started", Name: "prev-build-started",
EnvVar: "DRONE_PREV_BUILD_STARTED,WOODPECKER_PREV_BUILD_STARTED",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "WOODPECKER_PREV_BUILD_FINISHED",
Name: "prev-build-finished", Name: "prev-build-finished",
EnvVar: "DRONE_PREV_BUILD_FINISHED,WOODPECKER_PREV_BUILD_FINISHED",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_BUILD_STATUS",
Name: "prev-build-status", Name: "prev-build-status",
EnvVar: "DRONE_PREV_BUILD_STATUS,WOODPECKER_PREV_BUILD_STATUS",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_BUILD_EVENT",
Name: "prev-build-event", Name: "prev-build-event",
EnvVar: "DRONE_PREV_BUILD_EVENT,WOODPECKER_PREV_BUILD_EVENT",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_BUILD_LINK",
Name: "prev-build-link", Name: "prev-build-link",
EnvVar: "DRONE_PREV_BUILD_LINK,WOODPECKER_PREV_BUILD_LINK",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_COMMIT_SHA",
Name: "prev-commit-sha", Name: "prev-commit-sha",
EnvVar: "DRONE_PREV_COMMIT_SHA,WOODPECKER_PREV_COMMIT_SHA",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_COMMIT_REF",
Name: "prev-commit-ref", Name: "prev-commit-ref",
EnvVar: "DRONE_PREV_COMMIT_REF,WOODPECKER_PREV_COMMIT_REF",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_COMMIT_REFSPEC",
Name: "prev-commit-refspec", Name: "prev-commit-refspec",
EnvVar: "DRONE_PREV_COMMIT_REFSPEC,WOODPECKER_PREV_COMMIT_REFSPEC",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_COMMIT_BRANCH",
Name: "prev-commit-branch", Name: "prev-commit-branch",
EnvVar: "DRONE_PREV_COMMIT_BRANCH,WOODPECKER_PREV_COMMIT_BRANCH",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_COMMIT_MESSAGE",
Name: "prev-commit-message", Name: "prev-commit-message",
EnvVar: "DRONE_PREV_COMMIT_MESSAGE,WOODPECKER_PREV_COMMIT_MESSAGE",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_COMMIT_AUTHOR_NAME",
Name: "prev-commit-author-name", Name: "prev-commit-author-name",
EnvVar: "DRONE_PREV_COMMIT_AUTHOR_NAME,WOODPECKER_PREV_COMMIT_AUTHOR_NAME",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_COMMIT_AUTHOR_AVATAR",
Name: "prev-commit-author-avatar", Name: "prev-commit-author-avatar",
EnvVar: "DRONE_PREV_COMMIT_AUTHOR_AVATAR,WOODPECKER_PREV_COMMIT_AUTHOR_AVATAR",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "WOODPECKER_PREV_COMMIT_AUTHOR_EMAIL",
Name: "prev-commit-author-email", Name: "prev-commit-author-email",
EnvVar: "DRONE_PREV_COMMIT_AUTHOR_EMAIL,WOODPECKER_PREV_COMMIT_AUTHOR_EMAIL",
}, },
cli.IntFlag{ cli.IntFlag{
EnvVar: "WOODPECKER_JOB_NUMBER",
Name: "job-number", Name: "job-number",
EnvVar: "DRONE_JOB_NUMBER,WOODPECKER_JOB_NUMBER",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "WOODPECKER_ENV",
Name: "env, e", Name: "env, e",
EnvVar: "DRONE_ENV,WOODPECKER_ENV",
}, },
}, },
} }
@ -286,7 +286,7 @@ var Command = cli.Command{
func exec(c *cli.Context) error { func exec(c *cli.Context) error {
file := c.Args().First() file := c.Args().First()
if file == "" { if file == "" {
file = ".drone.yml" file = ".woodpecker.yml"
} }
dat, err := ioutil.ReadFile(file) dat, err := ioutil.ReadFile(file)
@ -314,7 +314,7 @@ func exec(c *cli.Context) error {
func execWithAxis(c *cli.Context, axis matrix.Axis) error { func execWithAxis(c *cli.Context, axis matrix.Axis) error {
file := c.Args().First() file := c.Args().First()
if file == "" { if file == "" {
file = ".drone.yml" file = ".woodpecker.yml"
} }
metadata := metadataFromContext(c, axis) metadata := metadataFromContext(c, axis)

View file

@ -22,83 +22,83 @@ import (
var flags = []cli.Flag{ var flags = []cli.Flag{
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_SERVER,WOODPECKER_SERVER", EnvVar: "WOODPECKER_SERVER",
Name: "server", Name: "server",
Usage: "drone server address", Usage: "server address",
Value: "localhost:9000", Value: "localhost:9000",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_USERNAME,WOODPECKER_USERNAME", EnvVar: "WOODPECKER_USERNAME",
Name: "username", Name: "username",
Usage: "drone auth username", Usage: "auth username",
Value: "x-oauth-basic", Value: "x-oauth-basic",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_PASSWORD,DRONE_SECRET,WOODPECKER_PASSWORD,WOODPECKER_SECRET", EnvVar: "WOODPECKER_AGENT_SECRET",
Name: "password", Name: "password",
Usage: "server-agent shared password", Usage: "server-agent shared password",
}, },
cli.BoolTFlag{ cli.BoolTFlag{
EnvVar: "DRONE_DEBUG,WOODPECKER_DEBUG", EnvVar: "WOODPECKER_DEBUG",
Name: "debug", Name: "debug",
Usage: "enable agent debug mode", Usage: "enable agent debug mode",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_DEBUG_PRETTY,WOODPECKER_DEBUG_PRETTY", EnvVar: "WOODPECKER_DEBUG_PRETTY",
Name: "pretty", Name: "pretty",
Usage: "enable pretty-printed debug output", Usage: "enable pretty-printed debug output",
}, },
cli.BoolTFlag{ cli.BoolTFlag{
EnvVar: "DRONE_DEBUG_NOCOLOR,WOODPECKER_DEBUG_NOCOLOR", EnvVar: "WOODPECKER_DEBUG_NOCOLOR",
Name: "nocolor", Name: "nocolor",
Usage: "disable colored debug output", Usage: "disable colored debug output",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_HOSTNAME,HOSTNAME,WOODPECKER_HOSTNAME,HOSTNAME", EnvVar: "WOODPECKER_HOSTNAME",
Name: "hostname", Name: "hostname",
Usage: "agent hostname", Usage: "agent hostname",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_PLATFORM,WOODPECKER_PLATFORM", EnvVar: "WOODPECKER_PLATFORM",
Name: "platform", Name: "platform",
Usage: "restrict builds by platform conditions", Usage: "restrict builds by platform conditions",
Value: "linux/amd64", Value: "linux/amd64",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_FILTER,WOODPECKER_FILTER", EnvVar: "WOODPECKER_FILTER",
Name: "filter", Name: "filter",
Usage: "filter expression to restrict builds by label", Usage: "filter expression to restrict builds by label",
}, },
cli.IntFlag{ cli.IntFlag{
EnvVar: "DRONE_MAX_PROCS,WOODPECKER_MAX_PROCS", EnvVar: "WOODPECKER_MAX_PROCS",
Name: "max-procs", Name: "max-procs",
Usage: "agent parallel builds", Usage: "agent parallel builds",
Value: 1, Value: 1,
}, },
cli.BoolTFlag{ cli.BoolTFlag{
EnvVar: "DRONE_HEALTHCHECK,WOODPECKER_HEALTHCHECK", EnvVar: "WOODPECKER_HEALTHCHECK",
Name: "healthcheck", Name: "healthcheck",
Usage: "enable healthcheck endpoint", Usage: "enable healthcheck endpoint",
}, },
cli.DurationFlag{ cli.DurationFlag{
EnvVar: "DRONE_KEEPALIVE_TIME,WOODPECKER_KEEPALIVE_TIME", EnvVar: "WOODPECKER_KEEPALIVE_TIME",
Name: "keepalive-time", Name: "keepalive-time",
Usage: "after a duration of this time of no activity, the agent pings the server to check if the transport is still alive", Usage: "after a duration of this time of no activity, the agent pings the server to check if the transport is still alive",
}, },
cli.DurationFlag{ cli.DurationFlag{
EnvVar: "DRONE_KEEPALIVE_TIMEOUT,WOODPECKER_KEEPALIVE_TIMEOUT", EnvVar: "WOODPECKER_KEEPALIVE_TIMEOUT",
Name: "keepalive-timeout", Name: "keepalive-timeout",
Usage: "after pinging for a keepalive check, the agent waits for a duration of this time before closing the connection if no activity", Usage: "after pinging for a keepalive check, the agent waits for a duration of this time before closing the connection if no activity",
Value: time.Second * 20, Value: time.Second * 20,
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "WOODPECKER_GRPC_SECURE",
Name: "secure-grpc", Name: "secure-grpc",
Usage: "should the connection to DRONE_SERVER be made using a secure transport", Usage: "should the connection to WOODPECKER_SERVER be made using a secure transport",
EnvVar: "DRONE_GRPC_SECURE,WOODPECKER_GRPC_SECURE",
}, },
cli.BoolTFlag{ cli.BoolTFlag{
EnvVar: "WOODPECKER_GRPC_VERIFY",
Name: "skip-insecure-grpc", Name: "skip-insecure-grpc",
Usage: "should the grpc server certificate be verified, only valid when DRONE_GRPC_SECURE is true", Usage: "should the grpc server certificate be verified, only valid when WOODPECKER_GRPC_SECURE is true",
EnvVar: "DRONE_GRPC_VERIFY,WOODPECKER_GRPC_VERIFY",
}, },
} }

View file

@ -28,18 +28,20 @@ func main() {
app.EnableBashCompletion = true app.EnableBashCompletion = true
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_TOKEN,WOODPECKER_TOKEN", EnvVar: "WOODPECKER_TOKEN",
Name: "t, token", // TODO: rename to `token`
Usage: "server auth token", Name: "t, token",
Usage: "server auth token",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_SERVER,WOODPECKER_SERVER", EnvVar: "WOODPECKER_SERVER",
Name: "s, server", // TODO: rename to `server`
Usage: "server address", Name: "s, server",
Usage: "server address",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_SKIP_VERIFY,WOODPECKER_SKIP_VERIFY", EnvVar: "WOODPECKER_SKIP_VERIFY",
Name: "skip-verify", Name: "skip-verify",
Usage: "skip ssl verification", Usage: "skip ssl verification",
Hidden: true, Hidden: true,

View file

@ -22,28 +22,28 @@ import (
var flags = []cli.Flag{ var flags = []cli.Flag{
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_DEBUG,WOODPECKER_DEBUG", EnvVar: "WOODPECKER_DEBUG",
Name: "debug", Name: "debug",
Usage: "enable server debug mode", Usage: "enable server debug mode",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_SERVER_HOST,DRONE_HOST,WOODPECKER_SERVER_HOST,WOODPECKER_HOST", EnvVar: "WOODPECKER_HOST",
Name: "server-host", Name: "server-host",
Usage: "server fully qualified url (<scheme>://<host>)", Usage: "server fully qualified url (<scheme>://<host>)",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_SERVER_ADDR,WOODPECKER_SERVER_ADDR", EnvVar: "WOODPECKER_SERVER_ADDR",
Name: "server-addr", Name: "server-addr",
Usage: "server address", Usage: "server address",
Value: ":8000", Value: ":8000",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_SERVER_CERT,WOODPECKER_SERVER_CERT", EnvVar: "WOODPECKER_SERVER_CERT",
Name: "server-cert", Name: "server-cert",
Usage: "server ssl cert path", Usage: "server ssl cert path",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_SERVER_KEY,WOODPECKER_SERVER_KEY", EnvVar: "WOODPECKER_SERVER_KEY",
Name: "server-key", Name: "server-key",
Usage: "server ssl key path", Usage: "server ssl key path",
}, },
@ -54,12 +54,12 @@ var flags = []cli.Flag{
Value: ":9000", Value: ":9000",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_LETS_ENCRYPT,WOODPECKER_LETS_ENCRYPT", EnvVar: "WOODPECKER_LETS_ENCRYPT",
Name: "lets-encrypt", Name: "lets-encrypt",
Usage: "enable let's encrypt", Usage: "enable let's encrypt",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_QUIC,WOODPECKER_QUIC", EnvVar: "WOODPECKER_QUIC",
Name: "quic", Name: "quic",
Usage: "enable quic", Usage: "enable quic",
}, },
@ -70,39 +70,39 @@ var flags = []cli.Flag{
Hidden: true, Hidden: true,
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_ADMIN,WOODPECKER_ADMIN", EnvVar: "WOODPECKER_ADMIN",
Name: "admin", Name: "admin",
Usage: "list of admin users", Usage: "list of admin users",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_ORGS,WOODPECKER_ORGS", EnvVar: "WOODPECKER_ORGS",
Name: "orgs", Name: "orgs",
Usage: "list of approved organizations", Usage: "list of approved organizations",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_REPO_OWNERS,WOODPECKER_REPO_OWNERS", EnvVar: "WOODPECKER_REPO_OWNERS",
Name: "repo-owners", Name: "repo-owners",
Usage: "List of syncable repo owners", Usage: "List of syncable repo owners",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_OPEN,WOODPECKER_OPEN", EnvVar: "WOODPECKER_OPEN",
Name: "open", Name: "open",
Usage: "enable open user registration", Usage: "enable open user registration",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_DOCS,WOODPECKER_DOCS", EnvVar: "WOODPECKER_DOCS",
Name: "docs", Name: "docs",
Usage: "link to user documentation", Usage: "link to user documentation",
Value: "https://woodpecker-ci.github.io/", Value: "https://woodpecker-ci.github.io/",
}, },
cli.DurationFlag{ cli.DurationFlag{
EnvVar: "DRONE_SESSION_EXPIRES,WOODPECKER_SESSION_EXPIRES", EnvVar: "WOODPECKER_SESSION_EXPIRES",
Name: "session-expires", Name: "session-expires",
Usage: "session expiration time", Usage: "session expiration time",
Value: time.Hour * 72, Value: time.Hour * 72,
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_ESCALATE,WOODPECKER_ESCALATE", EnvVar: "WOODPECKER_ESCALATE",
Name: "escalate", Name: "escalate",
Usage: "images to run in privileged mode", Usage: "images to run in privileged mode",
Value: &cli.StringSlice{ Value: &cli.StringSlice{
@ -112,55 +112,55 @@ var flags = []cli.Flag{
}, },
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_VOLUME,WOODPECKER_VOLUME", EnvVar: "WOODPECKER_VOLUME",
Name: "volume", Name: "volume",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_DOCKER_CONFIG,WOODPECKER_DOCKER_CONFIG", EnvVar: "WOODPECKER_DOCKER_CONFIG",
Name: "docker-config", Name: "docker-config",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_ENVIRONMENT,WOODPECKER_ENVIRONMENT", EnvVar: "WOODPECKER_ENVIRONMENT",
Name: "environment", Name: "environment",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_NETWORK,WOODPECKER_NETWORK", EnvVar: "WOODPECKER_NETWORK",
Name: "network", Name: "network",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_AGENT_SECRET,DRONE_SECRET,WOODPECKER_AGENT_SECRET,WOODPECKER_SECRET", EnvVar: "WOODPECKER_AGENT_SECRET",
Name: "agent-secret", Name: "agent-secret",
Usage: "server-agent shared password", Usage: "server-agent shared password",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_SECRET_ENDPOINT,WOODPECKER_SECRET_ENDPOINT", EnvVar: "WOODPECKER_SECRET_ENDPOINT",
Name: "secret-service", Name: "secret-service",
Usage: "secret plugin endpoint", Usage: "secret plugin endpoint",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_REGISTRY_ENDPOINT,WOODPECKER_REGISTRY_ENDPOINT", EnvVar: "WOODPECKER_REGISTRY_ENDPOINT",
Name: "registry-service", Name: "registry-service",
Usage: "registry plugin endpoint", Usage: "registry plugin endpoint",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GATEKEEPER_ENDPOINT,WOODPECKER_GATEKEEPER_ENDPOINT", EnvVar: "WOODPECKER_GATEKEEPER_ENDPOINT",
Name: "gating-service", Name: "gating-service",
Usage: "gated build endpoint", Usage: "gated build endpoint",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_DATABASE_DRIVER,DATABASE_DRIVER,WOODPECKER_DATABASE_DRIVER,DATABASE_DRIVER", EnvVar: "WOODPECKER_DATABASE_DRIVER",
Name: "driver", Name: "driver",
Usage: "database driver", Usage: "database driver",
Value: "sqlite3", Value: "sqlite3",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_DATABASE_DATASOURCE,DATABASE_CONFIG,WOODPECKER_DATABASE_DATASOURCE,DATABASE_CONFIG", EnvVar: "WOODPECKER_DATABASE_DATASOURCE",
Name: "datasource", Name: "datasource",
Usage: "database driver configuration string", Usage: "database driver configuration string",
Value: "drone.sqlite", Value: "drone.sqlite",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_PROMETHEUS_AUTH_TOKEN,WOODPECKER_PROMETHEUS_AUTH_TOKEN", EnvVar: "WOODPECKER_PROMETHEUS_AUTH_TOKEN",
Name: "prometheus-auth-token", Name: "prometheus-auth-token",
Usage: "token to secure prometheus metrics endpoint", Usage: "token to secure prometheus metrics endpoint",
Value: "", Value: "",
@ -169,32 +169,32 @@ var flags = []cli.Flag{
// resource limit parameters // resource limit parameters
// //
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "DRONE_LIMIT_MEM_SWAP,WOODPECKER_LIMIT_MEM_SWAP", EnvVar: "WOODPECKER_LIMIT_MEM_SWAP",
Name: "limit-mem-swap", Name: "limit-mem-swap",
Usage: "maximum swappable memory allowed in bytes", Usage: "maximum swappable memory allowed in bytes",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "DRONE_LIMIT_MEM,WOODPECKER_LIMIT_MEM", EnvVar: "WOODPECKER_LIMIT_MEM",
Name: "limit-mem", Name: "limit-mem",
Usage: "maximum memory allowed in bytes", Usage: "maximum memory allowed in bytes",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "DRONE_LIMIT_SHM_SIZE,WOODPECKER_LIMIT_SHM_SIZE", EnvVar: "WOODPECKER_LIMIT_SHM_SIZE",
Name: "limit-shm-size", Name: "limit-shm-size",
Usage: "docker compose /dev/shm allowed in bytes", Usage: "docker compose /dev/shm allowed in bytes",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "DRONE_LIMIT_CPU_QUOTA,WOODPECKER_LIMIT_CPU_QUOTA", EnvVar: "WOODPECKER_LIMIT_CPU_QUOTA",
Name: "limit-cpu-quota", Name: "limit-cpu-quota",
Usage: "impose a cpu quota", Usage: "impose a cpu quota",
}, },
cli.Int64Flag{ cli.Int64Flag{
EnvVar: "DRONE_LIMIT_CPU_SHARES,WOODPECKER_LIMIT_CPU_SHARES", EnvVar: "WOODPECKER_LIMIT_CPU_SHARES",
Name: "limit-cpu-shares", Name: "limit-cpu-shares",
Usage: "change the cpu shares", Usage: "change the cpu shares",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_LIMIT_CPU_SET,WOODPECKER_LIMIT_CPU_SET", EnvVar: "WOODPECKER_LIMIT_CPU_SET",
Name: "limit-cpu-set", Name: "limit-cpu-set",
Usage: "set the cpus allowed to execute containers", Usage: "set the cpus allowed to execute containers",
}, },
@ -202,34 +202,34 @@ var flags = []cli.Flag{
// remote parameters // remote parameters
// //
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITHUB,WOODPECKER_GITHUB", EnvVar: "WOODPECKER_GITHUB",
Name: "github", Name: "github",
Usage: "github driver is enabled", Usage: "github driver is enabled",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITHUB_URL,WOODPECKER_GITHUB_URL", EnvVar: "WOODPECKER_GITHUB_URL",
Name: "github-server", Name: "github-server",
Usage: "github server address", Usage: "github server address",
Value: "https://github.com", Value: "https://github.com",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITHUB_CONTEXT,WOODPECKER_GITHUB_CONTEXT", EnvVar: "WOODPECKER_GITHUB_CONTEXT",
Name: "github-context", Name: "github-context",
Usage: "github status context", Usage: "github status context",
Value: "continuous-integration/drone", Value: "continuous-integration/woodpecker",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITHUB_CLIENT,WOODPECKER_GITHUB_CLIENT", EnvVar: "WOODPECKER_GITHUB_CLIENT",
Name: "github-client", Name: "github-client",
Usage: "github oauth2 client id", Usage: "github oauth2 client id",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITHUB_SECRET,WOODPECKER_GITHUB_SECRET", EnvVar: "WOODPECKER_GITHUB_SECRET",
Name: "github-secret", Name: "github-secret",
Usage: "github oauth2 client secret", Usage: "github oauth2 client secret",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_GITHUB_SCOPE,WOODPECKER_GITHUB_SCOPE", EnvVar: "WOODPECKER_GITHUB_SCOPE",
Name: "github-scope", Name: "github-scope",
Usage: "github oauth scope", Usage: "github oauth scope",
Value: &cli.StringSlice{ Value: &cli.StringSlice{
@ -240,232 +240,232 @@ var flags = []cli.Flag{
}, },
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITHUB_GIT_USERNAME,WOODPECKER_GITHUB_GIT_USERNAME", EnvVar: "WOODPECKER_GITHUB_GIT_USERNAME",
Name: "github-git-username", Name: "github-git-username",
Usage: "github machine user username", Usage: "github machine user username",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITHUB_GIT_PASSWORD,WOODPECKER_GITHUB_GIT_PASSWORD", EnvVar: "WOODPECKER_GITHUB_GIT_PASSWORD",
Name: "github-git-password", Name: "github-git-password",
Usage: "github machine user password", Usage: "github machine user password",
}, },
cli.BoolTFlag{ cli.BoolTFlag{
EnvVar: "DRONE_GITHUB_MERGE_REF,WOODPECKER_GITHUB_MERGE_REF", EnvVar: "WOODPECKER_GITHUB_MERGE_REF",
Name: "github-merge-ref", Name: "github-merge-ref",
Usage: "github pull requests use merge ref", Usage: "github pull requests use merge ref",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITHUB_PRIVATE_MODE,WOODPECKER_GITHUB_PRIVATE_MODE", EnvVar: "WOODPECKER_GITHUB_PRIVATE_MODE",
Name: "github-private-mode", Name: "github-private-mode",
Usage: "github is running in private mode", Usage: "github is running in private mode",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITHUB_SKIP_VERIFY,WOODPECKER_GITHUB_SKIP_VERIFY", EnvVar: "WOODPECKER_GITHUB_SKIP_VERIFY",
Name: "github-skip-verify", Name: "github-skip-verify",
Usage: "github skip ssl verification", Usage: "github skip ssl verification",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GOGS,WOODPECKER_GOGS", EnvVar: "WOODPECKER_GOGS",
Name: "gogs", Name: "gogs",
Usage: "gogs driver is enabled", Usage: "gogs driver is enabled",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GOGS_URL,WOODPECKER_GOGS_URL", EnvVar: "WOODPECKER_GOGS_URL",
Name: "gogs-server", Name: "gogs-server",
Usage: "gogs server address", Usage: "gogs server address",
Value: "https://github.com", Value: "https://github.com",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GOGS_GIT_USERNAME,WOODPECKER_GOGS_GIT_USERNAME", EnvVar: "WOODPECKER_GOGS_GIT_USERNAME",
Name: "gogs-git-username", Name: "gogs-git-username",
Usage: "gogs service account username", Usage: "gogs service account username",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GOGS_GIT_PASSWORD,WOODPECKER_GOGS_GIT_PASSWORD", EnvVar: "WOODPECKER_GOGS_GIT_PASSWORD",
Name: "gogs-git-password", Name: "gogs-git-password",
Usage: "gogs service account password", Usage: "gogs service account password",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GOGS_PRIVATE_MODE,WOODPECKER_GOGS_PRIVATE_MODE", EnvVar: "WOODPECKER_GOGS_PRIVATE_MODE",
Name: "gogs-private-mode", Name: "gogs-private-mode",
Usage: "gogs private mode enabled", Usage: "gogs private mode enabled",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GOGS_SKIP_VERIFY,WOODPECKER_GOGS_SKIP_VERIFY", EnvVar: "WOODPECKER_GOGS_SKIP_VERIFY",
Name: "gogs-skip-verify", Name: "gogs-skip-verify",
Usage: "gogs skip ssl verification", Usage: "gogs skip ssl verification",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITEA,WOODPECKER_GITEA", EnvVar: "WOODPECKER_GITEA",
Name: "gitea", Name: "gitea",
Usage: "gitea driver is enabled", Usage: "gitea driver is enabled",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITEA_URL,WOODPECKER_GITEA_URL", EnvVar: "WOODPECKER_GITEA_URL",
Name: "gitea-server", Name: "gitea-server",
Usage: "gitea server address", Usage: "gitea server address",
Value: "https://try.gitea.io", Value: "https://try.gitea.io",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITEA_CLIENT,WOODPECKER_GITEA_CLIENT", EnvVar: "WOODPECKER_GITEA_CLIENT",
Name: "gitea-client", Name: "gitea-client",
Usage: "gitea oauth2 client id", Usage: "gitea oauth2 client id",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITEA_SECRET,WOODPECKER_GITEA_SECRET", EnvVar: "WOODPECKER_GITEA_SECRET",
Name: "gitea-secret", Name: "gitea-secret",
Usage: "gitea oauth2 client secret", Usage: "gitea oauth2 client secret",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITEA_CONTEXT,WOODPECKER_GITEA_CONTEXT", EnvVar: "WOODPECKER_GITEA_CONTEXT",
Name: "gitea-context", Name: "gitea-context",
Usage: "gitea status context", Usage: "gitea status context",
Value: "continuous-integration/drone", Value: "continuous-integration/drone",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITEA_GIT_USERNAME,WOODPECKER_GITEA_GIT_USERNAME", EnvVar: "WOODPECKER_GITEA_GIT_USERNAME",
Name: "gitea-git-username", Name: "gitea-git-username",
Usage: "gitea service account username", Usage: "gitea service account username",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITEA_GIT_PASSWORD,WOODPECKER_GITEA_GIT_PASSWORD", EnvVar: "WOODPECKER_GITEA_GIT_PASSWORD",
Name: "gitea-git-password", Name: "gitea-git-password",
Usage: "gitea service account password", Usage: "gitea service account password",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITEA_PRIVATE_MODE,WOODPECKER_GITEA_PRIVATE_MODE", EnvVar: "WOODPECKER_GITEA_PRIVATE_MODE",
Name: "gitea-private-mode", Name: "gitea-private-mode",
Usage: "gitea private mode enabled", Usage: "gitea private mode enabled",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITEA_SKIP_VERIFY,WOODPECKER_GITEA_SKIP_VERIFY", EnvVar: "WOODPECKER_GITEA_SKIP_VERIFY",
Name: "gitea-skip-verify", Name: "gitea-skip-verify",
Usage: "gitea skip ssl verification", Usage: "gitea skip ssl verification",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_BITBUCKET,WOODPECKER_BITBUCKET", EnvVar: "WOODPECKER_BITBUCKET",
Name: "bitbucket", Name: "bitbucket",
Usage: "bitbucket driver is enabled", Usage: "bitbucket driver is enabled",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_BITBUCKET_CLIENT,WOODPECKER_BITBUCKET_CLIENT", EnvVar: "WOODPECKER_BITBUCKET_CLIENT",
Name: "bitbucket-client", Name: "bitbucket-client",
Usage: "bitbucket oauth2 client id", Usage: "bitbucket oauth2 client id",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_BITBUCKET_SECRET,WOODPECKER_BITBUCKET_SECRET", EnvVar: "WOODPECKER_BITBUCKET_SECRET",
Name: "bitbucket-secret", Name: "bitbucket-secret",
Usage: "bitbucket oauth2 client secret", Usage: "bitbucket oauth2 client secret",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITLAB,WOODPECKER_GITLAB", EnvVar: "WOODPECKER_GITLAB",
Name: "gitlab", Name: "gitlab",
Usage: "gitlab driver is enabled", Usage: "gitlab driver is enabled",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITLAB_URL,WOODPECKER_GITLAB_URL", EnvVar: "WOODPECKER_GITLAB_URL",
Name: "gitlab-server", Name: "gitlab-server",
Usage: "gitlab server address", Usage: "gitlab server address",
Value: "https://gitlab.com", Value: "https://gitlab.com",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITLAB_CLIENT,WOODPECKER_GITLAB_CLIENT", EnvVar: "WOODPECKER_GITLAB_CLIENT",
Name: "gitlab-client", Name: "gitlab-client",
Usage: "gitlab oauth2 client id", Usage: "gitlab oauth2 client id",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITLAB_SECRET,WOODPECKER_GITLAB_SECRET", EnvVar: "WOODPECKER_GITLAB_SECRET",
Name: "gitlab-secret", Name: "gitlab-secret",
Usage: "gitlab oauth2 client secret", Usage: "gitlab oauth2 client secret",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITLAB_GIT_USERNAME,WOODPECKER_GITLAB_GIT_USERNAME", EnvVar: "WOODPECKER_GITLAB_GIT_USERNAME",
Name: "gitlab-git-username", Name: "gitlab-git-username",
Usage: "gitlab service account username", Usage: "gitlab service account username",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_GITLAB_GIT_PASSWORD,WOODPECKER_GITLAB_GIT_PASSWORD", EnvVar: "WOODPECKER_GITLAB_GIT_PASSWORD",
Name: "gitlab-git-password", Name: "gitlab-git-password",
Usage: "gitlab service account password", Usage: "gitlab service account password",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITLAB_SKIP_VERIFY,WOODPECKER_GITLAB_SKIP_VERIFY", EnvVar: "WOODPECKER_GITLAB_SKIP_VERIFY",
Name: "gitlab-skip-verify", Name: "gitlab-skip-verify",
Usage: "gitlab skip ssl verification", Usage: "gitlab skip ssl verification",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITLAB_PRIVATE_MODE,WOODPECKER_GITLAB_PRIVATE_MODE", EnvVar: "WOODPECKER_GITLAB_PRIVATE_MODE",
Name: "gitlab-private-mode", Name: "gitlab-private-mode",
Usage: "gitlab is running in private mode", Usage: "gitlab is running in private mode",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_GITLAB_V3_API,WOODPECKER_GITLAB_V3_API", EnvVar: "WOODPECKER_GITLAB_V3_API",
Name: "gitlab-v3-api", Name: "gitlab-v3-api",
Usage: "gitlab is running the v3 api", Usage: "gitlab is running the v3 api",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_STASH,WOODPECKER_STASH", EnvVar: "WOODPECKER_STASH",
Name: "stash", Name: "stash",
Usage: "stash driver is enabled", Usage: "stash driver is enabled",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_STASH_URL,WOODPECKER_STASH_URL", EnvVar: "WOODPECKER_STASH_URL",
Name: "stash-server", Name: "stash-server",
Usage: "stash server address", Usage: "stash server address",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_STASH_CONSUMER_KEY,WOODPECKER_STASH_CONSUMER_KEY", EnvVar: "WOODPECKER_STASH_CONSUMER_KEY",
Name: "stash-consumer-key", Name: "stash-consumer-key",
Usage: "stash oauth1 consumer key", Usage: "stash oauth1 consumer key",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_STASH_CONSUMER_RSA,WOODPECKER_STASH_CONSUMER_RSA", EnvVar: "WOODPECKER_STASH_CONSUMER_RSA",
Name: "stash-consumer-rsa", Name: "stash-consumer-rsa",
Usage: "stash oauth1 private key file", Usage: "stash oauth1 private key file",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_STASH_CONSUMER_RSA_STRING,WOODPECKER_STASH_CONSUMER_RSA_STRING", EnvVar: "WOODPECKER_STASH_CONSUMER_RSA_STRING",
Name: "stash-consumer-rsa-string", Name: "stash-consumer-rsa-string",
Usage: "stash oauth1 private key string", Usage: "stash oauth1 private key string",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_STASH_GIT_USERNAME,WOODPECKER_STASH_GIT_USERNAME", EnvVar: "WOODPECKER_STASH_GIT_USERNAME",
Name: "stash-git-username", Name: "stash-git-username",
Usage: "stash service account username", Usage: "stash service account username",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_STASH_GIT_PASSWORD,WOODPECKER_STASH_GIT_PASSWORD", EnvVar: "WOODPECKER_STASH_GIT_PASSWORD",
Name: "stash-git-password", Name: "stash-git-password",
Usage: "stash service account password", Usage: "stash service account password",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_STASH_SKIP_VERIFY,WOODPECKER_STASH_SKIP_VERIFY", EnvVar: "WOODPECKER_STASH_SKIP_VERIFY",
Name: "stash-skip-verify", Name: "stash-skip-verify",
Usage: "stash skip ssl verification", Usage: "stash skip ssl verification",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_CODING,WOODPECKER_CODING", EnvVar: "WOODPECKER_CODING",
Name: "coding", Name: "coding",
Usage: "coding driver is enabled", Usage: "coding driver is enabled",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_CODING_URL,WOODPECKER_CODING_URL", EnvVar: "WOODPECKER_CODING_URL",
Name: "coding-server", Name: "coding-server",
Usage: "coding server address", Usage: "coding server address",
Value: "https://coding.net", Value: "https://coding.net",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_CODING_CLIENT,WOODPECKER_CODING_CLIENT", EnvVar: "WOODPECKER_CODING_CLIENT",
Name: "coding-client", Name: "coding-client",
Usage: "coding oauth2 client id", Usage: "coding oauth2 client id",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_CODING_SECRET,WOODPECKER_CODING_SECRET", EnvVar: "WOODPECKER_CODING_SECRET",
Name: "coding-secret", Name: "coding-secret",
Usage: "coding oauth2 client secret", Usage: "coding oauth2 client secret",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
EnvVar: "DRONE_CODING_SCOPE,WOODPECKER_CODING_SCOPE", EnvVar: "WOODPECKER_CODING_SCOPE",
Name: "coding-scope", Name: "coding-scope",
Usage: "coding oauth scope", Usage: "coding oauth scope",
Value: &cli.StringSlice{ Value: &cli.StringSlice{
@ -475,28 +475,28 @@ var flags = []cli.Flag{
}, },
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_CODING_GIT_MACHINE,WOODPECKER_CODING_GIT_MACHINE", EnvVar: "WOODPECKER_CODING_GIT_MACHINE",
Name: "coding-git-machine", Name: "coding-git-machine",
Usage: "coding machine name", Usage: "coding machine name",
Value: "git.coding.net", Value: "git.coding.net",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_CODING_GIT_USERNAME,WOODPECKER_CODING_GIT_USERNAME", EnvVar: "WOODPECKER_CODING_GIT_USERNAME",
Name: "coding-git-username", Name: "coding-git-username",
Usage: "coding machine user username", Usage: "coding machine user username",
}, },
cli.StringFlag{ cli.StringFlag{
EnvVar: "DRONE_CODING_GIT_PASSWORD,WOODPECKER_CODING_GIT_PASSWORD", EnvVar: "WOODPECKER_CODING_GIT_PASSWORD",
Name: "coding-git-password", Name: "coding-git-password",
Usage: "coding machine user password", Usage: "coding machine user password",
}, },
cli.BoolFlag{ cli.BoolFlag{
EnvVar: "DRONE_CODING_SKIP_VERIFY,WOODPECKER_CODING_SKIP_VERIFY", EnvVar: "WOODPECKER_CODING_SKIP_VERIFY",
Name: "coding-skip-verify", Name: "coding-skip-verify",
Usage: "coding skip ssl verification", Usage: "coding skip ssl verification",
}, },
cli.DurationFlag{ cli.DurationFlag{
EnvVar: "DRONE_KEEPALIVE_MIN_TIME,WOODPECKER_KEEPALIVE_MIN_TIME", EnvVar: "WOODPECKER_KEEPALIVE_MIN_TIME",
Name: "keepalive-min-time", Name: "keepalive-min-time",
Usage: "server-side enforcement policy on the minimum amount of time a client should wait before sending a keepalive ping.", Usage: "server-side enforcement policy on the minimum amount of time a client should wait before sending a keepalive ping.",
}, },

View file

@ -62,26 +62,25 @@ func loop(c *cli.Context) error {
logrus.SetLevel(logrus.WarnLevel) logrus.SetLevel(logrus.WarnLevel)
} }
// must configure the drone_host variable
if c.String("server-host") == "" { if c.String("server-host") == "" {
logrus.Fatalln("DRONE_HOST/DRONE_SERVER_HOST/WOODPECKER_HOST/WOODPECKER_SERVER_HOST is not properly configured") logrus.Fatalln("WOODPECKER_HOST is not properly configured")
} }
if !strings.Contains(c.String("server-host"), "://") { if !strings.Contains(c.String("server-host"), "://") {
logrus.Fatalln( logrus.Fatalln(
"DRONE_HOST/DRONE_SERVER_HOST/WOODPECKER_HOST/WOODPECKER_SERVER_HOST must be <scheme>://<hostname> format", "WOODPECKER_HOST must be <scheme>://<hostname> format",
) )
} }
if strings.Contains(c.String("server-host"), "://localhost") { if strings.Contains(c.String("server-host"), "://localhost") {
logrus.Warningln( logrus.Warningln(
"DRONE_HOST/DRONE_SERVER_HOST/WOODPECKER_HOST/WOODPECKER_SERVER_HOST should probably be publicly accessible (not localhost)", "WOODPECKER_HOST should probably be publicly accessible (not localhost)",
) )
} }
if strings.HasSuffix(c.String("server-host"), "/") { if strings.HasSuffix(c.String("server-host"), "/") {
logrus.Fatalln( logrus.Fatalln(
"DRONE_HOST/DRONE_SERVER_HOST/WOODPECKER_HOST/WOODPECKER_SERVER_HOST must not have trailing slash", "WOODPECKER_HOST must not have trailing slash",
) )
} }

View file

@ -18,9 +18,6 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/dimfeld/httptreemux"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/woodpecker-ci/woodpecker/server" "github.com/woodpecker-ci/woodpecker/server"
"github.com/woodpecker-ci/woodpecker/server/model" "github.com/woodpecker-ci/woodpecker/server/model"
"github.com/woodpecker-ci/woodpecker/server/plugins/environments" "github.com/woodpecker-ci/woodpecker/server/plugins/environments"
@ -39,9 +36,13 @@ import (
"github.com/woodpecker-ci/woodpecker/server/store" "github.com/woodpecker-ci/woodpecker/server/store"
"github.com/woodpecker-ci/woodpecker/server/store/datastore" "github.com/woodpecker-ci/woodpecker/server/store/datastore"
"github.com/woodpecker-ci/woodpecker/server/web" "github.com/woodpecker-ci/woodpecker/server/web"
"golang.org/x/sync/errgroup"
"github.com/dimfeld/httptreemux"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
"golang.org/x/sync/errgroup"
) )
func setupStore(c *cli.Context) store.Store { func setupStore(c *cli.Context) store.Store {
@ -117,7 +118,7 @@ func setupGogs(c *cli.Context) (remote.Remote, error) {
// helper function to setup the Gitea remote from the CLI arguments. // helper function to setup the Gitea remote from the CLI arguments.
func setupGitea(c *cli.Context) (remote.Remote, error) { func setupGitea(c *cli.Context) (remote.Remote, error) {
return gitea.New(gitea.Opts{ opts := gitea.Opts{
URL: c.String("gitea-server"), URL: c.String("gitea-server"),
Context: c.String("gitea-context"), Context: c.String("gitea-context"),
Username: c.String("gitea-git-username"), Username: c.String("gitea-git-username"),
@ -126,7 +127,11 @@ func setupGitea(c *cli.Context) (remote.Remote, error) {
Secret: c.String("gitea-secret"), Secret: c.String("gitea-secret"),
PrivateMode: c.Bool("gitea-private-mode"), PrivateMode: c.Bool("gitea-private-mode"),
SkipVerify: c.Bool("gitea-skip-verify"), SkipVerify: c.Bool("gitea-skip-verify"),
}) }
if len(opts.URL) == 0 {
logrus.Fatalln("WOODPECKER_GITEA_URL must be set")
}
return gitea.New(opts)
} }
// helper function to setup the Stash remote from the CLI arguments. // helper function to setup the Stash remote from the CLI arguments.

View file

@ -13,11 +13,11 @@ services:
environment: environment:
- WOODPECKER_OPEN=true - WOODPECKER_OPEN=true
- WOODPECKER_ADMIN=laszlocph - WOODPECKER_ADMIN=laszlocph
- WOODPECKER_HOST=${HOST} - WOODPECKER_HOST=${WOODPECKER_HOST}
- WOODPECKER_GITHUB=true - WOODPECKER_GITHUB=true
- WOODPECKER_GITHUB_CLIENT=${GITHUB_CLIENT} - WOODPECKER_GITHUB_CLIENT=${WOODPECKER_GITHUB_CLIENT}
- WOODPECKER_GITHUB_SECRET=${GITHUB_SECRET} - WOODPECKER_GITHUB_SECRET=${WOODPECKER_GITHUB_SECRET}
- WOODPECKER_SECRET=${WOODPECKER_SECRET} - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
woodpecker-agent: woodpecker-agent:
build: build:
context: . context: .
@ -27,5 +27,5 @@ services:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
environment: environment:
- WOODPECKER_SERVER=woodpecker-server:9000 - WOODPECKER_SERVER=woodpecker-server:9000
- WOODPECKER_SECRET=${WOODPECKER_SECRET} - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
- WOODPECKER_MAX_PROCS=2 - WOODPECKER_MAX_PROCS=2

View file

@ -40,7 +40,7 @@ services:
- WOODPECKER_GITHUB=true - WOODPECKER_GITHUB=true
- WOODPECKER_GITHUB_CLIENT=${WOODPECKER_GITHUB_CLIENT} - WOODPECKER_GITHUB_CLIENT=${WOODPECKER_GITHUB_CLIENT}
- WOODPECKER_GITHUB_SECRET=${WOODPECKER_GITHUB_SECRET} - WOODPECKER_GITHUB_SECRET=${WOODPECKER_GITHUB_SECRET}
- WOODPECKER_SECRET=${WOODPECKER_SECRET} - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
woodpecker-agent: woodpecker-agent:
image: woodpeckerci/woodpecker-agent:latest image: woodpeckerci/woodpecker-agent:latest
@ -52,7 +52,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
environment: environment:
- WOODPECKER_SERVER=woodpecker-server:9000 - WOODPECKER_SERVER=woodpecker-server:9000
- WOODPECKER_SECRET=${WOODPECKER_SECRET} - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
volumes: volumes:
woodpecker-server-data: woodpecker-server-data:
@ -110,12 +110,12 @@ services:
[...] [...]
environment: environment:
- [...] - [...]
+ - WOODPECKER_SECRET=${WOODPECKER_SECRET} + - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
woodpecker-agent: woodpecker-agent:
[...] [...]
environment: environment:
- [...] - [...]
+ - WOODPECKER_SECRET=${WOODPECKER_SECRET} + - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
``` ```
## Authentication ## Authentication

View file

@ -10,7 +10,7 @@ Woodpecker does not support Kubernetes natively, but being a container first CI
# create secrets # create secrets
kubectl create secret generic woodpecker-secret \ kubectl create secret generic woodpecker-secret \
--namespace <namespace> \ --namespace <namespace> \
--from-literal=WOODPECKER_SECRET=$(openssl rand -hex 32) --from-literal=WOODPECKER_AGENT_SECRET=$(openssl rand -hex 32)
kubectl create secret generic woodpecker-github-client \ kubectl create secret generic woodpecker-github-client \
--namespace <namespace> \ --namespace <namespace> \
@ -91,7 +91,7 @@ spec:
value: "xxx" value: "xxx"
- name: "WOODPECKER_GITHUB_SECRET" - name: "WOODPECKER_GITHUB_SECRET"
value: "xxx" value: "xxx"
- name: "WOODPECKER_SECRET" - name: "WOODPECKER_AGENT_SECRET"
value: "xxx" value: "xxx"
volumeMounts: volumeMounts:
- name: sqlite-volume - name: sqlite-volume
@ -183,7 +183,7 @@ spec:
env: env:
- name: WOODPECKER_SERVER - name: WOODPECKER_SERVER
value: woodpecker.tools.svc.cluster.local:9000 value: woodpecker.tools.svc.cluster.local:9000
- name: WOODPECKER_SECRET - name: WOODPECKER_AGENT_SECRET
value: "xxx" value: "xxx"
resources: resources:
limits: limits:

View file

@ -12,6 +12,13 @@ Some versions need some changes to the server configuration or the pipeline conf
Read more about it at the [Project Settings](/docs/usage/project-settings#pipeline-path) Read more about it at the [Project Settings](/docs/usage/project-settings#pipeline-path)
- Dropped support for `DRONE_*` environment variables. The according `WOODPECKER_*` variables must be used instead.
Additionally some alternative namings have been removed to simplify maintenance:
- `WOODPECKER_AGENT_SECRET` replaces `WOODPECKER_SECRET`, `DRONE_SECRET`, `WOODPECKER_PASSWORD`, `DRONE_PASSWORD` and `DRONE_AGENT_SECRET`.
- `WOODPECKER_HOST` replaces `DRONE_HOST` and `DRONE_SERVER_HOST`.
- `WOODPECKER_DATABASE_DRIVER` replaces `DRONE_DATABASE_DRIVER` and `DATABASE_DRIVER`.
- `WOODPECKER_DATABASE_DATASOURCE` replaces `DRONE_DATABASE_DATASOURCE` and `DATABASE_CONFIG`.
- ... - ...
## 0.14.0 ## 0.14.0

View file

@ -63,7 +63,7 @@ type User struct {
// Admin indicates the user is a system administrator. // Admin indicates the user is a system administrator.
// //
// NOTE: This is sourced from the DRONE_ADMINS environment variable and is no // NOTE: This is sourced from the WOODPECKER_ADMINS environment variable and is no
// longer persisted in the database. // longer persisted in the database.
Admin bool `json:"admin,omitempty" meddler:"-"` Admin bool `json:"admin,omitempty" meddler:"-"`

View file

@ -85,9 +85,9 @@ func openTest() *sql.DB {
driver = "sqlite3" driver = "sqlite3"
config = ":memory:" config = ":memory:"
) )
if os.Getenv("DATABASE_DRIVER") != "" { if os.Getenv("WOODPECKER_DATABASE_DRIVER") != "" {
driver = os.Getenv("DATABASE_DRIVER") driver = os.Getenv("WOODPECKER_DATABASE_DRIVER")
config = os.Getenv("DATABASE_CONFIG") config = os.Getenv("WOODPECKER_DATABASE_CONFIG")
} }
return open(driver, config) return open(driver, config)
} }
@ -100,9 +100,9 @@ func newTest() *datastore {
driver = "sqlite3" driver = "sqlite3"
config = ":memory:" config = ":memory:"
) )
if os.Getenv("DATABASE_DRIVER") != "" { if os.Getenv("WOODPECKER_DATABASE_DRIVER") != "" {
driver = os.Getenv("DATABASE_DRIVER") driver = os.Getenv("WOODPECKER_DATABASE_DRIVER")
config = os.Getenv("DATABASE_CONFIG") config = os.Getenv("WOODPECKER_DATABASE_CONFIG")
} }
return &datastore{ return &datastore{
DB: open(driver, config), DB: open(driver, config),