-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathTaskfile.yml
More file actions
127 lines (111 loc) · 4.19 KB
/
Taskfile.yml
File metadata and controls
127 lines (111 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
version: '3'
output: prefixed
set:
- errexit
- pipefail
dotenv:
- versions.env
vars:
GIT_COMMIT:
sh: git rev-parse --short=8 HEAD || echo "unknown"
VERSION:
sh: cat VERSION 2>/dev/null | tr -d '\n' || echo "dev"
TIMESTAMP:
sh: date -u +%Y%m%d%H%M%S
GOPATH_BIN:
sh: echo "${GOBIN:-$(go env GOPATH)/bin}"
GOBUILD_FLAGS: "-buildvcs=false"
DISTRIBUTION_SRC: "https://github.com/distribution/distribution.git"
NPM_REGISTRY: "https://registry.npmjs.org/"
# Multi-arch image build configuration
# Registry: 8gears.container-registry.com/8gcr/<image>:<version>
REGISTRY_ADDRESS: '{{.REGISTRY_ADDRESS | default "8gears.container-registry.com"}}'
REGISTRY_PROJECT: '{{.REGISTRY_PROJECT | default "8gcr"}}'
IMAGE_PLATFORMS: '{{.IMAGE_PLATFORMS | default "linux/amd64,linux/arm64"}}'
IMAGE_BUILDER: "harbor-multiarch"
# Container engine detection: prefer Docker buildx, fallback to Podman
CONTAINER_ENGINE:
sh: 'docker buildx version 2>&1 | grep -q "github.com/docker/buildx" && echo "docker" || (podman --version >/dev/null 2>&1 && echo "podman" || echo "unknown")'
# CI detection (shared by build.yml and image.yml)
IS_CI:
sh: '[ -n "${CI:-}${GITHUB_ACTIONS:-}${GITLAB_CI:-}${JENKINS_URL:-}" ] && echo "true" || echo "false"'
CI_PLATFORMS: '{{ternary .IMAGE_PLATFORMS (printf "linux/%s" ARCH) (eq .IS_CI "true")}}'
includes:
build:
taskfile: ./taskfile/build.yml
aliases: [b]
image:
taskfile: ./taskfile/image.yml
aliases: [i]
test:
taskfile: ./taskfile/test.yml
aliases: [t]
dev:
taskfile: ./taskfile/dev.yml
aliases: [d]
helm:
taskfile: ./taskfile/helm.yml
aliases: [h]
tasks:
default:
desc: "Start all services with hot reload (foreground, stops on exit)"
cmds:
- task: dev:up
build:
desc: "Build all binaries"
cmds:
- task: build:all-binaries
test:
desc: "Run all tests"
cmds:
- task: test:all
images:
desc: "Build all container images (PUSH=false for local, PLATFORMS=linux/arm64 for single arch)"
cmds:
- task: image:all-images
clean:
desc: "Remove all build artifacts, images, test output, and dev environment"
deps: [build:clean, image:clean, test:clean, dev:clean]
info:
desc: "Print version, tool versions, and build configuration"
silent: true
cmds:
- |
echo ""
echo "═══════════════════════════════════════════════════════════"
echo " Harbor Build Information"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "Build Metadata:"
echo " Version: {{.VERSION}}"
echo " Git Commit: {{.GIT_COMMIT}}"
echo " Build Time: {{.TIMESTAMP}}"
echo ""
echo "Tool Versions:"
echo " Go: {{.GO_VERSION}}"
echo " Swagger: {{.SWAGGER_VERSION}}"
echo " GolangCI-Lint: {{.GOLANGCILINT_VERSION}}"
echo " Delve: {{.DELVE_VERSION}}"
echo " Air: {{.AIR_VERSION}}"
echo " Bun: {{.BUN_VERSION}}"
echo " Spectral: {{.SPECTRAL_VERSION}}"
echo " Trivy: {{.TRIVY_VERSION}}"
echo ""
echo "Base Images:"
echo " Alpine: {{.ALPINE_VERSION}}"
echo " Nginx: {{.NGINX_VERSION}}"
echo ""
echo "Build Configuration:"
echo " Go Build Flags: {{.GOBUILD_FLAGS}}"
echo ""
echo "External Dependencies:"
echo " Distribution: {{.DISTRIBUTION_SRC}}"
echo " Distribution: {{.DISTRIBUTION_VERSION}}"
echo " NPM Registry: {{.NPM_REGISTRY}}"
echo ""
echo "═══════════════════════════════════════════════════════════"
echo ""
setup:
desc: "Install Go development tools (air, dlv, govulncheck)"
cmds:
- task: dev:setup