-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathTaskfile.yml
More file actions
161 lines (139 loc) · 4.88 KB
/
Copy pathTaskfile.yml
File metadata and controls
161 lines (139 loc) · 4.88 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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 -trimpath"
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]
docs:
taskfile: ./taskfile/docs.yml
release-ready:
taskfile: ./taskfile/release-ready.yml
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
lint:
desc: "Run API lint, Go lint, and dependency vulnerability checks"
cmds:
- task: test:lint:api
- task: test:lint
- task: test:vuln-check
lint:go:
desc: "Run Go lint"
cmds:
- task: test:lint:local
lint:ui:
desc: "Run UI lint"
cmds:
- task: test:frontend:lint
- task: test:frontend:lint:style
lint:api:
desc: "Run API lint"
cmds:
- task: test:lint:api
vuln-check:
desc: "Run Go dependency vulnerability checks"
cmds:
- task: test:vuln-check
images:
desc: "Build all container images (PUSH=false for local, PLATFORMS=linux/arm64 for single arch)"
cmds:
- task: image:all-images
release-ready:
desc: "Verify release patches apply cleanly"
cmds:
- task: release-ready:check
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