在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):csweichel/werft开源软件地址(OpenSource Url):https://github.com/csweichel/werft开源编程语言(OpenSource Language):Go 47.8%开源软件介绍(OpenSource Introduction):WerftWerft is a Kubernetes-native CI system. It knows no pipelines, just jobs and each job is a Kubernetes pod. What you do in that pod is up to you. We do not impose a "declarative pipeline syntax" or some groovy scripting language. Instead, Werft jobs have run Node, Golang or bash scripts in production environments.
InstallationThe easiest way to install Werft is using its Helm chart.
Clone this repo, cd into
Git-hoster integrationWerft integrates with Git hosting platforms using its plugin system. Currently, werft ships with support for GitHub only (plugins/github-repo and plugins/github-trigger). To add support for other Git hoster, the GitHubTo use werft with GitHub you'll need a GitHub app. To create the app, please follow the steps here. When creating the app, please use following values:
ConfigurationThe following table lists the (incomplete set of) configurable parameters of the Werft chart and their default values.
The helm chart's
Specify each parameter using the Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, $ helm install --name my-release -f values.yaml .
OAuthWerft does not support OAuth by itself. However, using OAuth Proxy that's easy enough to add. Setting up jobsWert jobs are files in your repository where one file represents one job.
A Werft job file mainly consists of the PodSpec that will be run.
Werft will add a For example: pod:
containers:
- name: hello-world
image: alpine:latest
workingDir: /workspace
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
echo Hello World
ls This job would print Hello World and list all files in the root of the repository. Checkout werft's own build job for a more complete example.
GitHub eventsWerft starts jobs based on GitHub push events if the repository contains a defaultJob: ".werft/build-job.yaml"
rules:
- path: ".werft/deploy.yaml"
matchesAll:
- or: ["repo.ref ~= refs/tags/"]
- or: ["trigger !== deleted"] The example above starts Log CuttingWerft extracts structure from the log output its jobs produce. We call this process log cutting, because Werft understands logs as a bunch of streams/slices which have to be demultiplexed. The default cutter in Werft expects the following syntax:
Authentication and PoliciesWerft supports authentication and API-based policies on its gRPC interface. This allows for great flexibility and control over the actions users can perform. AuthenticationAuthentication is performed using credential helper and auth plugins. The latter are plugins which can interpret tokens send as part of the gRPC metadata, e.g. by the CLI. See PoliciesWerft integrates the Open Policy Agent to afford flexible control over which actions are allowed via the API. Once enabled, all incoming gRPC calls are subject to the policy. Note: this does not affect the web UI or other plugins (e.g. the GitHub integration). To enable API policies, set service:
apiPolicy:
enabled: true
paths:
- testdata/policy/api.rego where paths is a list of files or directories which contain the policies. For each API request, werft will provide the following input to evaluate the policy: {
"method": "/v1.WerftService/StartGitHubJob",
"metadata": {
":authority": [
"localhost:7777"
],
"content-type": [
"application/grpc"
],
"user-agent": [
"grpc-go/1.36.1"
],
"x-auth-token": [
"some-value"
]
},
"message": {
"metadata": {
"owner": "Christian Weichel",
"repository": {
"host": "github.com",
"owner": "csweichel",
"repo": "werft",
"ref": "refs/heads/csweichel/support-token-based-access-116",
"revision": "d2c02a67c6e13fc5c3b3f5afb3ae60a66add5caa"
},
"trigger": 1
}
},
"auth": {
"known": true,
"username": "csweichel",
"metadata": {
"name": "Christian Weichel",
"two-factor-authentication": "true"
},
"emails": [
"[email protected]"
]
}
} The auth section is present only when an authentication plugin is configured, a token was sent, and the token/user is known to the auth plugins. You can find an example policy in Command Line InterfaceWerft sports a powerful CLI which can be used to create, list, start and listen to jobs. InstallationThe Werft CLI is available on the GitHub release page, or using this one-liner: curl -L werft.dev/get-cli.sh | sh Usage
Credential HelperThe werft CLI can send authentication tokens to werft, which are intepreted by the auth plugins for use with OPA policies. A credential helper is a program which prints a token on stdout and exits with code 0. Any other exit code will result in an error. The token is opaque to werft and interpreted by auth plugins (see Authentication and Policies). Werft's CLI will pass context as a single line JSON via stdin to the credential helper. See To enable this feature, set the AnnotationsAnnotations are used by your werft job to make runtime decesions. Werft supports passing annotation in three ways:
You can add annotations in the following form to your Pull request description and werft will pick them up /werft someAnnotation
/werft someAnnotation=foobar
- [x] /werft someAnnotation
- [x] /werft someAnnotation=foobar
Werft supports same format as above to pass annotations via commit message. Werft will use the top most commit only.
werft run github -a someAnnotation=foobar AttributionLogo based on Shipyard Vectors by Vecteezy Thank YouThank you to our contributors: |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论