Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Alex Eftimie 2021-05-25 16:43:03 +02:00
commit f694d6f2e4
220 changed files with 1371 additions and 480 deletions

10
.cli.sh
View file

@ -6,11 +6,11 @@ set -x
export CGO_ENABLED=0 export CGO_ENABLED=0
# compile for all architectures # compile for all architectures
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/amd64/woodpecker github.com/laszlocph/woodpecker/cli/drone GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm64/woodpecker github.com/laszlocph/woodpecker/cli/drone GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
GOOS=linux GOARCH=arm go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm/woodpecker github.com/laszlocph/woodpecker/cli/drone GOOS=linux GOARCH=arm go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/windows/amd64/woodpecker github.com/laszlocph/woodpecker/cli/drone GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/windows/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/darwin/amd64/woodpecker github.com/laszlocph/woodpecker/cli/drone GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/darwin/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
# tar binary files prior to upload # tar binary files prior to upload
tar -cvzf cli/release/woodpecker_linux_amd64.tar.gz -C cli/release/linux/amd64 woodpecker tar -cvzf cli/release/woodpecker_linux_amd64.tar.gz -C cli/release/linux/amd64 woodpecker

View file

@ -11,5 +11,5 @@ fi
echo "Building $VERSION" echo "Building $VERSION"
go build -ldflags '-extldflags "-static" -X github.com/laszlocph/woodpecker/version.Version='${VERSION} -o release/drone-server github.com/laszlocph/woodpecker/cmd/drone-server go build -ldflags '-extldflags "-static" -X github.com/woodpecker-ci/woodpecker/version.Version='${VERSION} -o release/drone-server github.com/woodpecker-ci/woodpecker/cmd/drone-server
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/woodpecker/version.Version='${VERSION} -o release/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/woodpecker-ci/woodpecker/version.Version='${VERSION} -o release/drone-agent github.com/woodpecker-ci/woodpecker/cmd/drone-agent

View file

@ -26,7 +26,7 @@ pipeline:
- DATABASE_DRIVER=postgres - DATABASE_DRIVER=postgres
- DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
commands: commands:
- go test -timeout 30s github.com/laszlocph/woodpecker/store/datastore - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore
test-mysql: test-mysql:
image: golang:1.16 image: golang:1.16
@ -35,7 +35,7 @@ pipeline:
- DATABASE_DRIVER=mysql - DATABASE_DRIVER=mysql
- DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
commands: commands:
- go test -timeout 30s github.com/laszlocph/woodpecker/store/datastore - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore
build-frontend: build-frontend:
image: node:10.17.0-stretch image: node:10.17.0-stretch
@ -45,7 +45,7 @@ pipeline:
build: build:
image: golang:1.16 image: golang:1.16
commands: commands:
- go get github.com/laszlocph/togo - go get github.com/woodpecker-ci/togo
- (cd web/; go generate ./...) - (cd web/; go generate ./...)
- ./.drone.sh - ./.drone.sh
when: when:
@ -53,7 +53,7 @@ pipeline:
# publish-server-alpine: # publish-server-alpine:
# image: plugins/docker # image: plugins/docker
# repo: laszlocloud/woodpecker-server # repo: woodpeckerci/woodpecker-server
# dockerfile: Dockerfile.alpine # dockerfile: Dockerfile.alpine
# secrets: [ docker_username, docker_password ] # secrets: [ docker_username, docker_password ]
# tag: [ alpine ] # tag: [ alpine ]
@ -67,7 +67,7 @@ pipeline:
publish-server: publish-server:
image: plugins/docker image: plugins/docker
repo: laszlocloud/woodpecker-server repo: woodpeckerci/woodpecker-server
secrets: [ docker_username, docker_password ] secrets: [ docker_username, docker_password ]
tag: [ latest ] tag: [ latest ]
when: when:
@ -76,7 +76,7 @@ pipeline:
publish-agent: publish-agent:
image: plugins/docker image: plugins/docker
repo: laszlocloud/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: Dockerfile.agent dockerfile: Dockerfile.agent
secrets: [ docker_username, docker_password ] secrets: [ docker_username, docker_password ]
tag: [ latest ] tag: [ latest ]
@ -86,7 +86,7 @@ pipeline:
# publish-agent-alpine: # publish-agent-alpine:
# image: plugins/docker # image: plugins/docker
# repo: laszlocloud/woodpecker-agent # repo: woodpeckerci/woodpecker-agent
# dockerfile: Dockerfile.agent.alpine # dockerfile: Dockerfile.agent.alpine
# secrets: [ docker_username, docker_password ] # secrets: [ docker_username, docker_password ]
# tag: [ alpine ] # tag: [ alpine ]
@ -96,7 +96,7 @@ pipeline:
# release-server-alpine: # release-server-alpine:
# image: plugins/docker # image: plugins/docker
# repo: laszlocloud/woodpecker-server # repo: woodpeckerci/woodpecker-server
# dockerfile: Dockerfile.alpine # dockerfile: Dockerfile.alpine
# secrets: [ docker_username, docker_password ] # secrets: [ docker_username, docker_password ]
# tag: "${DRONE_TAG}-alpine" # tag: "${DRONE_TAG}-alpine"
@ -105,7 +105,7 @@ pipeline:
# #
# release-agent-alpine: # release-agent-alpine:
# image: plugins/docker # image: plugins/docker
# repo: laszlocloud/woodpecker-agent # repo: woodpeckerci/woodpecker-agent
# dockerfile: Dockerfile.agent.alpine # dockerfile: Dockerfile.agent.alpine
# secrets: [ docker_username, docker_password ] # secrets: [ docker_username, docker_password ]
# tag: "${DRONE_TAG}-alpine" # tag: "${DRONE_TAG}-alpine"
@ -114,7 +114,7 @@ pipeline:
release-server: release-server:
image: plugins/docker image: plugins/docker
repo: laszlocloud/woodpecker-server repo: woodpeckerci/woodpecker-server
secrets: [ docker_username, docker_password ] secrets: [ docker_username, docker_password ]
tag: ${DRONE_TAG} tag: ${DRONE_TAG}
when: when:
@ -122,7 +122,7 @@ pipeline:
release-agent: release-agent:
image: plugins/docker image: plugins/docker
repo: laszlocloud/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: Dockerfile.agent dockerfile: Dockerfile.agent
secrets: [ docker_username, docker_password ] secrets: [ docker_username, docker_password ]
tag: ${DRONE_TAG} tag: ${DRONE_TAG}

View file

@ -14,7 +14,7 @@ curl -o swagger -L'#' "$download_url"
chmod +x swagger chmod +x swagger
sudo mv swagger /usr/local/bin sudo mv swagger /usr/local/bin
go get github.com/laszlocph/togo go get github.com/woodpecker-ci/togo
go generate go generate

View file

@ -22,28 +22,28 @@ format:
@gofmt -w ${GOFILES_NOVENDOR} @gofmt -w ${GOFILES_NOVENDOR}
test-agent: test-agent:
$(DOCKER_RUN) go test -race -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-agent $(go list ./... | grep -v /vendor/) $(DOCKER_RUN) go test -race -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/drone-agent $(go list ./... | grep -v /vendor/)
test-server: test-server:
$(DOCKER_RUN) go test -race -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-server $(DOCKER_RUN) go test -race -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/drone-server
test-frontend: test-frontend:
(cd web/; yarn run test) (cd web/; yarn run test)
test-lib: test-lib:
go get github.com/laszlocph/woodpecker/cncd/pipeline/pipec go get github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipec
go get github.com/laszlocph/woodpecker/remote/mock go get github.com/woodpecker-ci/woodpecker/remote/mock
go get github.com/laszlocph/woodpecker/cli/drone/internal go get github.com/woodpecker-ci/woodpecker/cli/drone/internal
go get -t github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml go get -t github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml
$(DOCKER_RUN) go test -race -timeout 30s $(shell go list ./... | grep -v '/cmd/') $(DOCKER_RUN) go test -race -timeout 30s $(shell go list ./... | grep -v '/cmd/')
test: test-lib test-agent test-server test: test-lib test-agent test-server
build-agent: build-agent:
$(DOCKER_RUN) go build -o build/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent $(DOCKER_RUN) go build -o build/drone-agent github.com/woodpecker-ci/woodpecker/cmd/drone-agent
build-server: build-server:
$(DOCKER_RUN) go build -o build/drone-server github.com/laszlocph/woodpecker/cmd/drone-server $(DOCKER_RUN) go build -o build/drone-server github.com/woodpecker-ci/woodpecker/cmd/drone-server
build-frontend: build-frontend:
(cd web/; yarn run build) (cd web/; yarn run build)
@ -52,5 +52,5 @@ build-frontend:
build: build-agent build-server build: build-agent build-server
install: install:
go install github.com/laszlocph/woodpecker/cmd/drone-agent go install github.com/woodpecker-ci/woodpecker/cmd/drone-agent
go install github.com/laszlocph/woodpecker/cmd/drone-server go install github.com/woodpecker-ci/woodpecker/cmd/drone-server

View file

@ -5,7 +5,7 @@ A fork of the Drone CI system.
- Based on the v0.8 code tree - Based on the v0.8 code tree
- Fully Apache 2.0, no tiers - Fully Apache 2.0, no tiers
[![Go Report Card](https://goreportcard.com/badge/github.com/laszlocph/woodpecker)](https://goreportcard.com/report/github.com/laszlocph/woodpecker) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Go Report Card](https://goreportcard.com/badge/github.com/woodpecker-ci/woodpecker)](https://goreportcard.com/report/github.com/woodpecker-ci/woodpecker) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![https://discord.gg/fcMQqSMXJy](https://img.shields.io/discord/838698813463724034.svg)](https://discord.gg/fcMQqSMXJy)
![woodpecker](docs/docs/images/woodpecker.png) ![woodpecker](docs/docs/images/woodpecker.png)
@ -95,7 +95,7 @@ https://woodpecker.laszlo.cloud
Currently, I know of one organization using this fork. With 50+ users, 130+ repos and more than 1100 builds a week. Currently, I know of one organization using this fork. With 50+ users, 130+ repos and more than 1100 builds a week.
Leave a note here if you are using it: https://github.com/laszlocph/woodpecker/issues/122 Leave a note here if you are using it: https://github.com/woodpecker-ci/woodpecker/issues/122
## License ## License

49
charts/README.md Normal file
View file

@ -0,0 +1,49 @@
# Woodpecker
[Woodpecker](https://woodpecker.laszlo.cloud/) is a fork of the Drone CI system version 0.8, right before the 1.0 release and license changes
## Installing Woodpecker server
### Requirements
```
kubectl create secret generic drone-secret \
--namespace sre \
--from-literal=DRONE_SECRET=$(openssl rand -hex 32)
```
[GitHub](https://woodpecker.laszlo.cloud/administration/github/)
```
kubectl create secret generic drone-github-client \
--namespace <namespace> \
--from-literal=DRONE_GITHUB_CLIENT=xxxxxxxx
```
```
kubectl create secret generic drone-github-secret \
--namespace <namespace> \
--from-literal=DRONE_GITHUB_SECRET=xxxxxxxx
```
```
helm upgrade --install woodpecker-server --namespace <namespace> woodpecker-server/
```
## Installing Woodpecker agent
```
helm upgrade --install woodpecker-agent --namespace <namespace> woodpecker-agent/
```
## Uninstall
```
helm delete woodpecker-agent
helm delete woodpecker-server
```
## Support
For questions, suggestions, and discussion, visit the [Discord](https://discord.gg/fcMQqSMXJy).

View file

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View file

@ -0,0 +1,17 @@
apiVersion: v2
name: woodpecker-agent
description: A Helm chart for Woodpecker a fork of the Drone CI system
type: application
version: 0.1.0
appVersion: "v0.13.0-rc.3"
keywords:
- continuous-delivery
- continuous-deployment
- continuous-integration
- docker
- go
sources:
- https://github.com/woodpecker-ci/woodpecker
maintainers:
- name: Laszlo Fogas
email: laszlo@laszlo.cloud

View file

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "woodpecker-agent.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "woodpecker-agent.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "woodpecker-agent.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "woodpecker-agent.labels" -}}
helm.sh/chart: {{ include "woodpecker-agent.chart" . }}
{{ include "woodpecker-agent.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "woodpecker-agent.selectorLabels" -}}
app.kubernetes.io/name: {{ include "woodpecker-agent.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "woodpecker-agent.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "woodpecker-agent.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "woodpecker-agent.fullname" . }}
labels:
{{- include "woodpecker-agent.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "woodpecker-agent.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "woodpecker-agent.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "woodpecker-agent.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 3000
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: sock-dir
mountPath: /var/run
env:
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
envFrom:
{{- range .Values.extraSecretNamesForEnvFrom }}
- secretRef:
name: {{ . }}
{{- end }}
- name: dind
image: "docker:19.03.5-dind"
env:
- name: DOCKER_DRIVER
value: overlay2
resources:
{{- toYaml .Values.resources | nindent 12 }}
securityContext:
privileged: true
volumeMounts:
- name: sock-dir
mountPath: /var/run
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: sock-dir
emptyDir: {}

View file

@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "woodpecker-agent.serviceAccountName" . }}
labels:
{{- include "woodpecker-agent.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,58 @@
replicaCount: 2
image:
registry: docker.io
repository: laszlocloud/woodpecker-agent
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: ""
env:
DRONE_SERVER: "woodpecker-server.<namespace>.svc.cluster.local:9000"
extraSecretNamesForEnvFrom:
- drone-secret
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}

View file

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View file

@ -0,0 +1,17 @@
apiVersion: v2
name: woodpecker-server
description: A Helm chart for Woodpecker a fork of the Drone CI system
type: application
version: 0.1.0
appVersion: "v0.13.0-rc.3"
keywords:
- continuous-delivery
- continuous-deployment
- continuous-integration
- docker
- go
sources:
- https://github.com/woodpecker-ci/woodpecker
maintainers:
- name: Laszlo Fogas
email: laszlo@laszlo.cloud

View file

@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "woodpecker-server.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "woodpecker-server.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "woodpecker-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "woodpecker-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}

View file

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "woodpecker-server.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "woodpecker-server.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "woodpecker-server.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "woodpecker-server.labels" -}}
helm.sh/chart: {{ include "woodpecker-server.chart" . }}
{{ include "woodpecker-server.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "woodpecker-server.selectorLabels" -}}
app.kubernetes.io/name: {{ include "woodpecker-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "woodpecker-server.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "woodpecker-server.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "woodpecker-server.fullname" . }}
labels:
{{- include "woodpecker-server.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "woodpecker-server.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
prometheus.io/scrape: 'true'
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "woodpecker-server.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "woodpecker-server.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8000
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: 8000
readinessProbe:
httpGet:
path: /healthz
port: 8000
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: storage-volume
mountPath: {{ .Values.persistentVolume.mountPath }}
env:
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
envFrom:
{{- range .Values.extraSecretNamesForEnvFrom }}
- secretRef:
name: {{ . }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: storage-volume
{{- if .Values.persistentVolume.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistentVolume.existingClaim }}{{ .Values.persistentVolume.existingClaim }}{{- else }}{{ template "woodpecker-server.fullname" . }}{{- end }}
{{- end -}}

View file

@ -0,0 +1,40 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "woodpecker-server.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "woodpecker-server.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,17 @@
{{- if .Values.persistentVolume.enabled -}}
{{- if not .Values.persistentVolume.existingClaim -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "woodpecker-server.fullname" . }}
labels:
{{- include "woodpecker-server.labels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteOnce
storageClassName: "{{ .Values.persistentVolume.storageClass }}"
resources:
requests:
storage: "{{ .Values.persistentVolume.size }}"
{{- end -}}
{{- end -}}

View file

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "woodpecker-server.fullname" . }}
labels:
{{- include "woodpecker-server.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- protocol: TCP
name: http
port: {{ .Values.service.port }}
targetPort: 8000
- protocol: TCP
name: grpc
port: 9000
targetPort: 9000
selector:
{{- include "woodpecker-server.selectorLabels" . | nindent 4 }}

View file

@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "woodpecker-server.serviceAccountName" . }}
labels:
{{- include "woodpecker-server.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,89 @@
replicaCount: 1
image:
registry: docker.io
repository: laszlocloud/woodpecker-server
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: ""
env:
DRONE_ADMIN: "xxxx"
DRONE_HOST: https://"xxxxxxx"
DRONE_GITHUB: true
extraSecretNamesForEnvFrom:
- drone-github-client
- drone-github-secret
- drone-secret
persistentVolume:
enabled: true
size: 10Gi
mountPath: "/var/lib/drone"
storageClass: "gp2"
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
ingress:
enabled: false
annotations:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
backend:
serviceName: chart-example.local
servicePort: 80
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"text/template" "text/template"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"os" "os"
"text/template" "text/template"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"os" "os"
"text/template" "text/template"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"text/template" "text/template"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -5,7 +5,7 @@ import (
"os" "os"
"text/template" "text/template"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -6,8 +6,8 @@ import (
"os" "os"
"strconv" "strconv"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/laszlocph/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/drone-go/drone"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -14,16 +14,16 @@ import (
"time" "time"
"github.com/drone/envsubst" "github.com/drone/envsubst"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend/docker" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend/docker"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml/compiler" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml/compiler"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml/linter" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml/linter"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml/matrix" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml/matrix"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/interrupt" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/interrupt"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/multipart" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/multipart"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -6,7 +6,7 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
// Command exports the info command. // Command exports the info command.

View file

@ -11,7 +11,7 @@ import (
"golang.org/x/net/proxy" "golang.org/x/net/proxy"
"golang.org/x/oauth2" "golang.org/x/oauth2"
"github.com/laszlocph/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/drone-go/drone"
) )
// NewClient returns a new client from the CLI context. // NewClient returns a new client from the CLI context.

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,15 +4,15 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/laszlocph/woodpecker/cli/drone/build" "github.com/woodpecker-ci/woodpecker/cli/drone/build"
"github.com/laszlocph/woodpecker/cli/drone/deploy" "github.com/woodpecker-ci/woodpecker/cli/drone/deploy"
"github.com/laszlocph/woodpecker/cli/drone/exec" "github.com/woodpecker-ci/woodpecker/cli/drone/exec"
"github.com/laszlocph/woodpecker/cli/drone/info" "github.com/woodpecker-ci/woodpecker/cli/drone/info"
"github.com/laszlocph/woodpecker/cli/drone/log" "github.com/woodpecker-ci/woodpecker/cli/drone/log"
"github.com/laszlocph/woodpecker/cli/drone/registry" "github.com/woodpecker-ci/woodpecker/cli/drone/registry"
"github.com/laszlocph/woodpecker/cli/drone/repo" "github.com/woodpecker-ci/woodpecker/cli/drone/repo"
"github.com/laszlocph/woodpecker/cli/drone/secret" "github.com/woodpecker-ci/woodpecker/cli/drone/secret"
"github.com/laszlocph/woodpecker/cli/drone/user" "github.com/woodpecker-ci/woodpecker/cli/drone/user"
_ "github.com/joho/godotenv/autoload" _ "github.com/joho/godotenv/autoload"
"github.com/urfave/cli" "github.com/urfave/cli"

View file

@ -4,8 +4,8 @@ import (
"io/ioutil" "io/ioutil"
"strings" "strings"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/laszlocph/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/drone-go/drone"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"html/template" "html/template"
"os" "os"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -6,7 +6,7 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
var registryListCmd = cli.Command{ var registryListCmd = cli.Command{

View file

@ -1,7 +1,7 @@
package registry package registry
import ( import (
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,8 +4,8 @@ import (
"io/ioutil" "io/ioutil"
"strings" "strings"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/laszlocph/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/drone-go/drone"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -3,7 +3,7 @@ package repo
import ( import (
"fmt" "fmt"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -3,7 +3,7 @@ package repo
import ( import (
"fmt" "fmt"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"os" "os"
"text/template" "text/template"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"os" "os"
"text/template" "text/template"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -1,7 +1,7 @@
package repo package repo
import ( import (
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -3,7 +3,7 @@ package repo
import ( import (
"fmt" "fmt"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,7 +4,7 @@ import (
"os" "os"
"text/template" "text/template"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/laszlocph/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/drone-go/drone"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -4,8 +4,8 @@ import (
"io/ioutil" "io/ioutil"
"strings" "strings"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/laszlocph/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/drone-go/drone"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -6,7 +6,7 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
var secretInfoCmd = cli.Command{ var secretInfoCmd = cli.Command{

View file

@ -7,7 +7,7 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
var secretListCmd = cli.Command{ var secretListCmd = cli.Command{

View file

@ -3,7 +3,7 @@ package secret
import ( import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
var secretDeleteCmd = cli.Command{ var secretDeleteCmd = cli.Command{

View file

@ -4,8 +4,8 @@ import (
"io/ioutil" "io/ioutil"
"strings" "strings"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
"github.com/laszlocph/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/drone-go/drone"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -3,10 +3,10 @@ package user
import ( import (
"fmt" "fmt"
"github.com/laszlocph/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/drone-go/drone"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
var userAddCmd = cli.Command{ var userAddCmd = cli.Command{

View file

@ -7,7 +7,7 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
var userInfoCmd = cli.Command{ var userInfoCmd = cli.Command{

View file

@ -6,7 +6,7 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
var userListCmd = cli.Command{ var userListCmd = cli.Command{

View file

@ -5,7 +5,7 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/laszlocph/woodpecker/cli/drone/internal" "github.com/woodpecker-ci/woodpecker/cli/drone/internal"
) )
var userRemoveCmd = cli.Command{ var userRemoveCmd = cli.Command{

View file

@ -31,11 +31,11 @@ import (
"google.golang.org/grpc/keepalive" "google.golang.org/grpc/keepalive"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend/docker" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend/docker"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/multipart" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/multipart"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/rpc" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/rpc"
"github.com/drone/signal" "github.com/drone/signal"
"github.com/rs/zerolog" "github.com/rs/zerolog"

View file

@ -22,7 +22,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/laszlocph/woodpecker/version" "github.com/woodpecker-ci/woodpecker/version"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -48,7 +48,7 @@ func handleVersion(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200) w.WriteHeader(200)
w.Header().Add("Content-Type", "text/json") w.Header().Add("Content-Type", "text/json")
json.NewEncoder(w).Encode(versionResp{ json.NewEncoder(w).Encode(versionResp{
Source: "https://github.com/laszlocph/woodpecker", Source: "https://github.com/woodpecker-ci/woodpecker",
Version: version.String(), Version: version.String(),
}) })
} }

View file

@ -19,7 +19,7 @@ import (
"os" "os"
"time" "time"
"github.com/laszlocph/woodpecker/version" "github.com/woodpecker-ci/woodpecker/version"
_ "github.com/joho/godotenv/autoload" _ "github.com/joho/godotenv/autoload"
"github.com/urfave/cli" "github.com/urfave/cli"

View file

@ -18,7 +18,7 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/laszlocph/woodpecker/version" "github.com/woodpecker-ci/woodpecker/version"
"github.com/joho/godotenv" "github.com/joho/godotenv"
_ "github.com/joho/godotenv/autoload" _ "github.com/joho/godotenv/autoload"

View file

@ -33,15 +33,15 @@ import (
"golang.org/x/crypto/acme/autocert" "golang.org/x/crypto/acme/autocert"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"github.com/laszlocph/woodpecker/cncd/logging" "github.com/woodpecker-ci/woodpecker/cncd/logging"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/rpc/proto" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/rpc/proto"
"github.com/laszlocph/woodpecker/cncd/pubsub" "github.com/woodpecker-ci/woodpecker/cncd/pubsub"
"github.com/laszlocph/woodpecker/plugins/sender" "github.com/woodpecker-ci/woodpecker/plugins/sender"
"github.com/laszlocph/woodpecker/remote" "github.com/woodpecker-ci/woodpecker/remote"
"github.com/laszlocph/woodpecker/router" "github.com/woodpecker-ci/woodpecker/router"
"github.com/laszlocph/woodpecker/router/middleware" "github.com/woodpecker-ci/woodpecker/router/middleware"
droneserver "github.com/laszlocph/woodpecker/server" droneserver "github.com/woodpecker-ci/woodpecker/server"
"github.com/laszlocph/woodpecker/store" "github.com/woodpecker-ci/woodpecker/store"
"github.com/gin-gonic/contrib/ginrus" "github.com/gin-gonic/contrib/ginrus"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View file

@ -19,24 +19,24 @@ import (
"time" "time"
"github.com/dimfeld/httptreemux" "github.com/dimfeld/httptreemux"
"github.com/laszlocph/woodpecker/cncd/queue" "github.com/woodpecker-ci/woodpecker/cncd/queue"
"github.com/laszlocph/woodpecker/model" "github.com/woodpecker-ci/woodpecker/model"
"github.com/laszlocph/woodpecker/plugins/environments" "github.com/woodpecker-ci/woodpecker/plugins/environments"
"github.com/laszlocph/woodpecker/plugins/registry" "github.com/woodpecker-ci/woodpecker/plugins/registry"
"github.com/laszlocph/woodpecker/plugins/secrets" "github.com/woodpecker-ci/woodpecker/plugins/secrets"
"github.com/laszlocph/woodpecker/remote" "github.com/woodpecker-ci/woodpecker/remote"
"github.com/laszlocph/woodpecker/remote/bitbucket" "github.com/woodpecker-ci/woodpecker/remote/bitbucket"
"github.com/laszlocph/woodpecker/remote/bitbucketserver" "github.com/woodpecker-ci/woodpecker/remote/bitbucketserver"
"github.com/laszlocph/woodpecker/remote/coding" "github.com/woodpecker-ci/woodpecker/remote/coding"
"github.com/laszlocph/woodpecker/remote/gitea" "github.com/woodpecker-ci/woodpecker/remote/gitea"
"github.com/laszlocph/woodpecker/remote/github" "github.com/woodpecker-ci/woodpecker/remote/github"
"github.com/laszlocph/woodpecker/remote/gitlab" "github.com/woodpecker-ci/woodpecker/remote/gitlab"
"github.com/laszlocph/woodpecker/remote/gitlab3" "github.com/woodpecker-ci/woodpecker/remote/gitlab3"
"github.com/laszlocph/woodpecker/remote/gogs" "github.com/woodpecker-ci/woodpecker/remote/gogs"
droneserver "github.com/laszlocph/woodpecker/server" droneserver "github.com/woodpecker-ci/woodpecker/server"
"github.com/laszlocph/woodpecker/server/web" "github.com/woodpecker-ci/woodpecker/server/web"
"github.com/laszlocph/woodpecker/store" "github.com/woodpecker-ci/woodpecker/store"
"github.com/laszlocph/woodpecker/store/datastore" "github.com/woodpecker-ci/woodpecker/store/datastore"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promauto"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"

View file

@ -2,5 +2,5 @@ Go package provides a common interface for storing and streaming logs.
Documentation: Documentation:
http://godoc.org/github.com/laszlocph/woodpecker/cncd/logging http://godoc.org/github.com/woodpecker-ci/woodpecker/cncd/logging
http://godoc.org/github.com/laszlocph/woodpecker/cncd/logging/gcp http://godoc.org/github.com/woodpecker-ci/woodpecker/cncd/logging/gcp

View file

@ -1,15 +1,15 @@
workspace: workspace:
base: /go base: /go
path: src/github.com/laszlocph/woodpecker/cncd/pipeline path: src/github.com/woodpecker-ci/woodpecker/cncd/pipeline
pipeline: pipeline:
install: install:
image: golang:1.8 image: golang:1.8
commands: commands:
- go install github.com/laszlocph/woodpecker/cncd/pipeline/pipec - go install github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipec
- go install github.com/laszlocph/woodpecker/cncd/pipeline/piped - go install github.com/woodpecker-ci/woodpecker/cncd/pipeline/piped
test: test:
image: golang:1.8 image: golang:1.8
commands: commands:
- go test -cover -timeout 30s github.com/laszlocph/woodpecker/cncd/pipeline/... - go test -cover -timeout 30s github.com/woodpecker-ci/woodpecker/cncd/pipeline/...

View file

@ -8,9 +8,9 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml/compiler" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml/compiler"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -8,12 +8,12 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend/docker" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend/docker"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend/kubernetes" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend/kubernetes"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/interrupt" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/interrupt"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/multipart" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/multipart"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View file

@ -3,8 +3,8 @@ package main
import ( import (
"fmt" "fmt"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml/linter" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml/linter"
"github.com/kr/pretty" "github.com/kr/pretty"
"github.com/urfave/cli" "github.com/urfave/cli"

View file

@ -13,12 +13,12 @@ import (
"sync" "sync"
"time" "time"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend/docker" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend/docker"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/interrupt" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/interrupt"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/multipart" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/multipart"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/rpc" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/rpc"
_ "github.com/joho/godotenv/autoload" _ "github.com/joho/godotenv/autoload"
"github.com/tevino/abool" "github.com/tevino/abool"

View file

@ -7,8 +7,8 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/interrupt" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/interrupt"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/rpc" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/rpc"
_ "github.com/joho/godotenv/autoload" _ "github.com/joho/godotenv/autoload"
"github.com/urfave/cli" "github.com/urfave/cli"

View file

@ -7,7 +7,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
) )
// returns a container configuration. // returns a container configuration.

View file

@ -8,7 +8,7 @@ import (
"io" "io"
"os" "os"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"docker.io/go-docker" "docker.io/go-docker"
"docker.io/go-docker/api/types" "docker.io/go-docker/api/types"

View file

@ -3,7 +3,7 @@ package docker
// import ( // import (
// "context" // "context"
// //
// "github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" // "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
// ) // )
// //
// // Pool manages a pool of Docker clients. // // Pool manages a pool of Docker clients.

View file

@ -4,7 +4,7 @@ import (
"context" "context"
"io" "io"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
) )
type engine struct { type engine struct {

View file

@ -4,7 +4,7 @@ import (
"path" "path"
"strings" "strings"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml"
libcompose "github.com/docker/libcompose/yaml" libcompose "github.com/docker/libcompose/yaml"
) )

View file

@ -3,9 +3,9 @@ package compiler
import ( import (
"fmt" "fmt"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml"
) )
// TODO(bradrydzewski) compiler should handle user-defined volumes from YAML // TODO(bradrydzewski) compiler should handle user-defined volumes from YAML

View file

@ -5,8 +5,8 @@ import (
"path" "path"
"strings" "strings"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml"
) )
func (c *Compiler) createProcess(name string, container *yaml.Container, section string) *backend.Step { func (c *Compiler) createProcess(name string, container *yaml.Container, section string) *backend.Step {

View file

@ -6,7 +6,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend"
) )
// Option configures a compiler option. // Option configures a compiler option.

View file

@ -5,7 +5,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend"
) )
func TestWithWorkspace(t *testing.T) { func TestWithWorkspace(t *testing.T) {

View file

@ -5,8 +5,8 @@ import (
"path/filepath" "path/filepath"
libcompose "github.com/docker/libcompose/yaml" libcompose "github.com/docker/libcompose/yaml"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml/types" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml/types"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )

View file

@ -3,7 +3,7 @@ package yaml
import ( import (
"testing" "testing"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )

View file

@ -3,7 +3,7 @@ package linter
import ( import (
"fmt" "fmt"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml"
) )
const ( const (

View file

@ -3,7 +3,7 @@ package linter
import ( import (
"testing" "testing"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/frontend/yaml" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/frontend/yaml"
) )
func TestLint(t *testing.T) { func TestLint(t *testing.T) {

View file

@ -1,8 +1,8 @@
package pipeline package pipeline
import ( import (
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/multipart" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/multipart"
) )
// Logger handles the process logging. // Logger handles the process logging.

View file

@ -3,7 +3,7 @@ package pipeline
import ( import (
"context" "context"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
) )
// Option configures a runtime option. // Option configures a runtime option.

View file

@ -6,7 +6,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
) )
// Parse parses the pipeline config from an io.Reader. // Parse parses the pipeline config from an io.Reader.

View file

@ -6,8 +6,8 @@ import (
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/multipart" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/multipart"
) )
type ( type (

View file

@ -6,8 +6,8 @@ import (
"log" "log"
"time" "time"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/rpc/proto" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/rpc/proto"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"

View file

@ -5,8 +5,8 @@ import (
// "encoding/json" // "encoding/json"
"time" "time"
// "github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" // "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/rpc/proto" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/rpc/proto"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"

View file

@ -3,7 +3,7 @@ package rpc
import ( import (
"context" "context"
"github.com/laszlocph/woodpecker/cncd/pipeline/pipeline/backend" "github.com/woodpecker-ci/woodpecker/cncd/pipeline/pipeline/backend"
) )
// ErrCancelled signals the pipeine is cancelled. // ErrCancelled signals the pipeine is cancelled.

View file

@ -23,7 +23,7 @@
"DRONE_WORKSPACE": "/go/src/github.com/drone/envsubst" "DRONE_WORKSPACE": "/go/src/github.com/drone/envsubst"
}, },
"volumes": [ "volumes": [
"/Users/bradrydzewski/code/src/github.com/laszlocph/woodpecker/cncd/pipeline/samples/sample_7_redis:/go/src/github.com/drone/envsubst" "/Users/bradrydzewski/code/src/github.com/woodpecker-ci/woodpecker/cncd/pipeline/samples/sample_7_redis:/go/src/github.com/drone/envsubst"
], ],
"networks": [ "networks": [
{ {
@ -55,7 +55,7 @@
"DRONE_WORKSPACE": "/go/src/github.com/drone/envsubst" "DRONE_WORKSPACE": "/go/src/github.com/drone/envsubst"
}, },
"volumes": [ "volumes": [
"/Users/bradrydzewski/code/src/github.com/laszlocph/woodpecker/cncd/pipeline/samples/sample_7_redis:/go/src/github.com/drone/envsubst" "/Users/bradrydzewski/code/src/github.com/woodpecker-ci/woodpecker/cncd/pipeline/samples/sample_7_redis:/go/src/github.com/drone/envsubst"
], ],
"networks": [ "networks": [
{ {
@ -103,7 +103,7 @@
"echo $CI_SCRIPT | base64 -d | /bin/sh -e" "echo $CI_SCRIPT | base64 -d | /bin/sh -e"
], ],
"volumes": [ "volumes": [
"/Users/bradrydzewski/code/src/github.com/laszlocph/woodpecker/cncd/pipeline/samples/sample_7_redis:/go/src/github.com/drone/envsubst" "/Users/bradrydzewski/code/src/github.com/woodpecker-ci/woodpecker/cncd/pipeline/samples/sample_7_redis:/go/src/github.com/drone/envsubst"
], ],
"networks": [ "networks": [
{ {

View file

@ -2,5 +2,5 @@ Go package provides a common interface for publish-subscriber messaging.
Documentation: Documentation:
http://godoc.org/github.com/laszlocph/woodpecker/cncd/pubsub http://godoc.org/github.com/woodpecker-ci/woodpecker/cncd/pubsub
http://godoc.org/github.com/laszlocph/woodpecker/cncd/pubsub/gcp http://godoc.org/github.com/woodpecker-ci/woodpecker/cncd/pubsub/gcp

View file

@ -2,5 +2,5 @@ Go package provides a common interface for working with task queues.
Documentation: Documentation:
http://godoc.org/github.com/laszlocph/woodpecker/cncd/queue http://godoc.org/github.com/woodpecker-ci/woodpecker/cncd/queue
http://godoc.org/github.com/laszlocph/woodpecker/cncd/queue/gcp http://godoc.org/github.com/woodpecker-ci/woodpecker/cncd/queue/gcp

View file

@ -356,8 +356,8 @@ func (q *fifo) updateDepStatusInQueue(taskID string, status string) {
} }
} }
var n *list.Element next = nil
for e := q.waitingOnDeps.Front(); e != nil; e = n { for e := q.waitingOnDeps.Front(); e != nil; e = next {
next = e.Next() next = e.Next()
waiting, ok := e.Value.(*Task) waiting, ok := e.Value.(*Task)
for _, dep := range waiting.Dependencies { for _, dep := range waiting.Dependencies {

View file

@ -200,6 +200,145 @@ func TestFifoErrors(t *testing.T) {
} }
} }
func TestFifoErrors2(t *testing.T) {
task1 := &Task{
ID: "1",
}
task2 := &Task{
ID: "2",
}
task3 := &Task{
ID: "3",
Dependencies: []string{"1", "2"},
DepStatus: make(map[string]string),
}
q := New().(*fifo)
q.PushAtOnce(noContext, []*Task{task2, task3, task1})
for i := 0; i < 2; i++ {
got, _ := q.Poll(noContext, func(*Task) bool { return true })
if got != task1 && got != task2{
t.Errorf("expect task1 or task2 returned from queue as task3 depends on them")
return
}
if got != task1 {
q.Done(noContext, got.ID, StatusSuccess)
}
if got != task2 {
q.Error(noContext, got.ID, fmt.Errorf("exitcode 1, there was an error"))
}
}
got, _ := q.Poll(noContext, func(*Task) bool { return true })
if got != task3 {
t.Errorf("expect task3 returned from queue")
return
}
if got.ShouldRun() {
t.Errorf("expect task3 should not run, task1 succeeded but task2 failed")
return
}
}
func TestFifoErrorsMultiThread(t *testing.T) {
//logrus.SetLevel(logrus.DebugLevel)
task1 := &Task{
ID: "1",
}
task2 := &Task{
ID: "2",
Dependencies: []string{"1"},
DepStatus: make(map[string]string),
}
task3 := &Task{
ID: "3",
Dependencies: []string{"1", "2"},
DepStatus: make(map[string]string),
}
q := New().(*fifo)
q.PushAtOnce(noContext, []*Task{task2, task3, task1})
obtainedWorkCh := make(chan *Task)
for i := 0; i < 10; i++ {
go func(i int) {
for {
fmt.Printf("Worker %d started\n", i)
got, _ := q.Poll(noContext, func(*Task) bool { return true })
obtainedWorkCh <- got
}
}(i)
}
task1Processed := false
task2Processed := false
for {
select {
case got := <-obtainedWorkCh:
fmt.Println(got.ID)
if !task1Processed {
if got != task1 {
t.Errorf("expect task1 returned from queue as task2 and task3 depends on it")
return
} else {
task1Processed = true
q.Error(noContext, got.ID, fmt.Errorf("exitcode 1, there was an error"))
go func() {
for {
fmt.Printf("Worker spawned\n")
got, _ := q.Poll(noContext, func(*Task) bool { return true })
obtainedWorkCh <- got
}
}()
}
} else if !task2Processed {
if got != task2 {
t.Errorf("expect task2 returned from queue")
return
} else {
task2Processed = true
q.Done(noContext, got.ID, StatusSuccess)
go func() {
for {
fmt.Printf("Worker spawned\n")
got, _ := q.Poll(noContext, func(*Task) bool { return true })
obtainedWorkCh <- got
}
}()
}
} else {
if got != task3 {
t.Errorf("expect task3 returned from queue")
return
}
if got.ShouldRun() {
t.Errorf("expect task3 should not run, task1 succeeded but task2 failed")
return
} else {
return
}
}
case <-time.After(5 * time.Second):
info := q.Info(noContext)
fmt.Println(info.String())
t.Errorf("test timed out")
return
}
}
}
func TestFifoTransitiveErrors(t *testing.T) { func TestFifoTransitiveErrors(t *testing.T) {
task1 := &Task{ task1 := &Task{
ID: "1", ID: "1",

View file

@ -3,6 +3,8 @@ package queue
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"strings"
) )
var ( var (
@ -61,6 +63,12 @@ func (t *Task) ShouldRun() bool {
return false return false
} }
func (t *Task) String() string {
var sb strings.Builder
sb.WriteString(fmt.Sprintf("%s (%s) - %s", t.ID, t.Dependencies, t.DepStatus))
return sb.String()
}
func runsOnFailure(runsOn []string) bool { func runsOnFailure(runsOn []string) bool {
for _, status := range runsOn { for _, status := range runsOn {
if status == "failure" { if status == "failure" {
@ -98,6 +106,24 @@ type InfoT struct {
Paused bool Paused bool
} }
func (t *InfoT) String() string {
var sb strings.Builder
for _, task := range t.Pending {
sb.WriteString("\t" + task.String())
}
for _, task := range t.Running {
sb.WriteString("\t" + task.String())
}
for _, task := range t.WaitingOnDeps {
sb.WriteString("\t" + task.String())
}
return sb.String()
}
// Filter filters tasks in the queue. If the Filter returns false, // Filter filters tasks in the queue. If the Filter returns false,
// the Task is skipped and not returned to the subscriber. // the Task is skipped and not returned to the subscriber.
type Filter func(*Task) bool type Filter func(*Task) bool

Some files were not shown because too many files have changed in this diff Show more