mirror of
https://gitea.com/gitea/runner.git
synced 2026-08-26 13:57:46 +00:00
bc8161c673
Jobs occasionally go silent ([example](https://gitea.com/gitea/runner/actions/runs/805045/jobs/1055123)) mid-run and Gitea reaped them after `ZOMBIE_TASK_TIMEOUT`, with no error in the log. This contains a number of related fixes, all with full test coverage: 1. Bound every RPC to Gitea with a timeout, a stalled report otherwise parked logs and heartbeats for the whole job. 2. Cap `runner.fetch_timeout` at that ceiling. 3. Let only the daemon loop close its own channel, the race panicked the process. 4. Stop the job on any terminal server result, not just `RESULT_CANCELLED`. 5. Report that result instead of relabelling it as cancelled. 6. Log reporting failures once at each end of an outage instead of discarding them. 7. Clamp the acknowledged log index, a too-large ack panicked on a slice bound. 8. Stop reading server health from a `FetchTask` deadline, it marked the runner healthy and reset the error backoff on a timeout. 9. Return an error from the Docker version probe instead of a `logrus` panic. 10. Pass the context to go-git's fetch and pull. 11. Fail the clone when a refresh dies on a cancelled context. 12. Set `terminationGracePeriodSeconds` in the Kubernetes examples. Also contains a deprecation fix for goreleaser. Reviewed-on: https://gitea.com/gitea/runner/pulls/1174 Reviewed-by: bircni <bircni@icloud.com> Co-authored-by: silverwind <me@silverwind.io>
142 lines
3.5 KiB
YAML
142 lines
3.5 KiB
YAML
version: 2
|
|
|
|
project_name: gitea-runner
|
|
|
|
before:
|
|
hooks:
|
|
- go mod tidy
|
|
|
|
builds:
|
|
- env:
|
|
- CGO_ENABLED=0
|
|
goos:
|
|
- darwin
|
|
- linux
|
|
- windows
|
|
- freebsd
|
|
goarch:
|
|
- amd64
|
|
- arm
|
|
- arm64
|
|
- loong64
|
|
- s390x
|
|
- riscv64
|
|
goarm:
|
|
- "5"
|
|
- "6"
|
|
- "7"
|
|
ignore:
|
|
- goos: darwin
|
|
goarch: arm
|
|
- goos: darwin
|
|
goarch: ppc64le
|
|
- goos: darwin
|
|
goarch: s390x
|
|
- goos: windows
|
|
goarch: ppc64le
|
|
- goos: windows
|
|
goarch: s390x
|
|
- goos: windows
|
|
goarch: arm
|
|
goarm: "5"
|
|
- goos: windows
|
|
goarch: arm
|
|
goarm: "6"
|
|
- goos: windows
|
|
goarch: arm
|
|
goarm: "7"
|
|
- goos: windows
|
|
goarch: arm64
|
|
- goos: freebsd
|
|
goarch: ppc64le
|
|
- goos: freebsd
|
|
goarch: s390x
|
|
- goos: freebsd
|
|
goarch: arm
|
|
goarm: "5"
|
|
- goos: freebsd
|
|
goarch: arm
|
|
goarm: "6"
|
|
- goos: freebsd
|
|
goarch: arm
|
|
goarm: "7"
|
|
- goos: freebsd
|
|
goarch: arm64
|
|
flags:
|
|
- -trimpath
|
|
ldflags:
|
|
- -s -w -X gitea.com/gitea/runner/internal/pkg/ver.version={{ .Summary }}
|
|
binary: >-
|
|
{{ .ProjectName }}-
|
|
{{- .Version }}-
|
|
{{- .Os }}-
|
|
{{- if eq .Arch "amd64" }}amd64
|
|
{{- else if eq .Arch "amd64_v1" }}amd64
|
|
{{- else if eq .Arch "386" }}386
|
|
{{- else }}{{ .Arch }}{{ end }}
|
|
{{- if .Arm }}-{{ .Arm }}{{ end }}
|
|
no_unique_dist_dir: true
|
|
hooks:
|
|
post:
|
|
- cmd: xz -k -9 {{ .Path }}
|
|
dir: ./dist/
|
|
- cmd: sh .goreleaser.checksum.sh {{ .Path }}
|
|
- cmd: sh .goreleaser.checksum.sh {{ .Path }}.xz
|
|
|
|
# Uploads every release artifact to Cloudflare R2. The `blobs:` pipe
|
|
# isn't usable here since it authenticates from the global AWS_* env
|
|
# with no per-entry credentials; `publishers:` supports per-entry
|
|
# `env:` instead, so it's used to invoke scripts/upload-r2.sh once per
|
|
# artifact. Custom publishers inherit almost nothing from the
|
|
# environment, hence the explicit R2_* forwarding below.
|
|
#
|
|
# This publisher fires 109 times for 73 distinct keys because
|
|
# goreleaser's release pipe already registers `release.extra_files`
|
|
# as UploadableFile artifacts, and `internal/exec`'s filterArtifacts
|
|
# appends this block's own extra_files with no de-duplication. It
|
|
# can't be globbed away, since gobwas/glob (via goreleaser/fileglob)
|
|
# has no substring-exclusion matcher. It's harmless: PUT is
|
|
# idempotent, and the `./**.xz` glob below is kept deliberately so
|
|
# this publisher declares its own complete file set rather than
|
|
# implicitly depending on the `release:` block's globs.
|
|
publishers:
|
|
- name: cloudflare-r2
|
|
checksum: true
|
|
extra_files:
|
|
- glob: ./**.xz
|
|
- glob: ./**.sha256
|
|
cmd: sh scripts/upload-r2.sh {{ abs .ArtifactPath }} gitea-runner/{{ .Version }}/{{ .ArtifactName }}
|
|
env:
|
|
- R2_ENDPOINT={{ index .Env "R2_ENDPOINT" }}
|
|
- R2_BUCKET={{ index .Env "R2_BUCKET" }}
|
|
- R2_ACCESS_KEY_ID={{ index .Env "R2_ACCESS_KEY_ID" }}
|
|
- R2_SECRET_ACCESS_KEY={{ index .Env "R2_SECRET_ACCESS_KEY" }}
|
|
|
|
archives:
|
|
- formats: [binary]
|
|
name_template: "{{ .Binary }}"
|
|
allow_different_binary_count: true
|
|
|
|
checksum:
|
|
name_template: 'checksums.txt'
|
|
extra_files:
|
|
- glob: ./**.xz
|
|
|
|
snapshot:
|
|
version_template: "{{ .Branch }}-devel"
|
|
|
|
nightly:
|
|
version_template: "nightly"
|
|
|
|
gitea_urls:
|
|
api: https://gitea.com/api/v1
|
|
download: https://gitea.com
|
|
|
|
release:
|
|
extra_files:
|
|
- glob: ./**.xz
|
|
- glob: ./**.xz.sha256
|
|
|
|
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
|
|
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|