2023-08-07 19:13:26 +00:00
|
|
|
// Copyright 2023 Woodpecker Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package docker
|
|
|
|
|
|
|
|
import (
|
2024-07-17 23:26:35 +00:00
|
|
|
"github.com/urfave/cli/v3"
|
2023-08-07 19:13:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var Flags = []cli.Flag{
|
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_HOST", "DOCKER_HOST"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-docker-host",
|
|
|
|
Usage: "path to docker socket or url to the docker server",
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_API_VERSION", "DOCKER_API_VERSION"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-docker-api-version",
|
|
|
|
Usage: "the version of the API to reach, leave empty for latest.",
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_CERT_PATH", "DOCKER_CERT_PATH"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-docker-cert",
|
|
|
|
Usage: "path to load the TLS certificates for connecting to docker server",
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_TLS_VERIFY", "DOCKER_TLS_VERIFY"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-docker-tls-verify",
|
|
|
|
Usage: "enable or disable TLS verification for connecting to docker server",
|
|
|
|
Value: true,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_ENABLE_IPV6"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-docker-ipv6",
|
|
|
|
Usage: "backend docker enable IPV6",
|
|
|
|
Value: false,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_NETWORK"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-docker-network",
|
|
|
|
Usage: "backend docker network",
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_VOLUMES"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-docker-volumes",
|
|
|
|
Usage: "backend docker volumes (comma separated)",
|
|
|
|
},
|
2024-09-26 15:56:59 +00:00
|
|
|
//
|
|
|
|
// resource limit parameters
|
|
|
|
//
|
|
|
|
&cli.IntFlag{
|
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_LIMIT_MEM_SWAP", "WOODPECKER_LIMIT_MEM_SWAP"),
|
|
|
|
Name: "backend-docker-limit-mem-swap",
|
|
|
|
Usage: "maximum memory used for swap in bytes",
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_LIMIT_MEM", "WOODPECKER_LIMIT_MEM"),
|
|
|
|
Name: "backend-docker-limit-mem",
|
|
|
|
Usage: "maximum memory allowed in bytes",
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_LIMIT_SHM_SIZE", "WOODPECKER_LIMIT_SHM_SIZE"),
|
|
|
|
Name: "backend-docker-limit-shm-size",
|
|
|
|
Usage: "docker /dev/shm allowed in bytes",
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_LIMIT_CPU_QUOTA", "WOODPECKER_LIMIT_CPU_QUOTA"),
|
|
|
|
Name: "backend-docker-limit-cpu-quota",
|
|
|
|
Usage: "impose a cpu quota",
|
|
|
|
},
|
|
|
|
&cli.IntFlag{
|
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_LIMIT_CPU_SHARES", "WOODPECKER_LIMIT_CPU_SHARES"),
|
|
|
|
Name: "backend-docker-limit-cpu-shares",
|
|
|
|
Usage: "change the cpu shares",
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_LIMIT_CPU_SET", "WOODPECKER_LIMIT_CPU_SET"),
|
|
|
|
Name: "backend-docker-limit-cpu-set",
|
|
|
|
Usage: "set the cpus allowed to execute containers",
|
|
|
|
},
|
2023-08-07 19:13:26 +00:00
|
|
|
}
|