-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwelder.yaml
126 lines (126 loc) · 3.76 KB
/
welder.yaml
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
schemaVersion: "1.8.1"
projectName: welder
projectRoot: .
version: ${env:VERSION:0.0.0}
default:
build:
volumes:
- ".gitconfig:${container:home}/.gitconfig:ro"
- "~/.ssh:${container:home}/.ssh:ro"
- "${task:gomodcache.trim}:${container:home}/go/pkg/mod"
args:
namespace: dev
build-goals: build:build
build-via-welder: "false"
build-image: golang:1.22
env:
VERSION: ${project:version}
BUILD_GOALS: ${arg:build-goals}
BUILD_VIA_WELDER: ${arg:build-via-welder}
INSIDE_WELDER: "true"
deploy:
env:
PROFILE: simple-container
environments:
dev:
autoDeploy: true
sox: { }
profiles:
single-test:
build:
args:
build-goals: build:build
env:
PLATFORMS: "linux-amd64"
TEST_TARGET: "./pkg/welder/... -run TestTaskOutputCapture -run TestBuildWithCustomImage"
skip-tests:
activation:
skip-tests: true
build:
env:
SKIP_TESTS: "true"
alpha: # profile for publishing to alpha channel from CI
build: &alpha-build
args:
release-suffix: "-alpha"
build-goals: build:all
env: &alpha-env
RELEASE_CHANNEL: alpha
local: # profile to activate locally and for publishing to alpha channel
activation:
if: "!${mode:ci}"
build:
<<: *alpha-build
env:
<<: *alpha-env
macosx:
activation:
if: ${os:type.darwin} && ${mode:on-host}
build:
env:
GOMODCACHE: ${user:home}/go/pkg/mod
modules:
- name: welder
build:
steps:
- task: tools
- task: build
- task: build-docs
deploy:
steps:
- task: publish
- task: tag-release
tasks:
tools:
customImage: &build-image
# the following is because build image requires docker CLI to be present
# this is used in some tests (e.g. the ones that use mutagen)
inlineDockerFile: |-
FROM ${arg:build-image}
ENV DOCKERVERSION=24.0.7
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz
description: Installs required tools
script:
- export GOMODCACHE=${container:home}/go/pkg/mod
- cat tools.go | grep _ | awk -F'"' '{print $2}' | xargs -tI % go get %
- go mod download
- go mod tidy
build:
customImage: *build-image
description: Compiles code and builds bundles
script:
- export GOMODCACHE=${container:home}/go/pkg/mod
- go run build.go ${BUILD_GOALS}
gomodcache:
runOn: host
description: Returns directory of go mod cache
script:
- |-
GOCACHEDIR="$( go env 2>/dev/null | grep GOMODCACHE | awk -F '=' '{print $2}' | sed "s/['\"]//g" )"
if [ -z "$GOCACHEDIR" ]; then echo "/tmp/welder-modcache"; else echo "$GOCACHEDIR" ; fi
build-docs:
image: python:3.9.18
workDir: ${project:root}/docs
script:
- pip install -r requirements.txt
- PATH=${PATH}:~/.local/bin mkdocs build
deploy-release:
image: dtzar/helm-kubectl:3.13
script:
- |-
export VALUES="--set image.image=${docker:tags[0].image} --set image.tag=${docker:tags[0].tag}"
export PROFILE=simple-container
${project:root}/charts/welder/deploy.sh welder welder
publish:
runOn: host
script:
- ${project:root}/bin/sc secrets reveal
- ${project:root}/bin/sc deploy -s welder -e prod
tag-release:
runOn: host
script:
- git tag ${project:version} || echo "Already set tag ${project:version}"
- git push -f origin ${project:version} || echo "Tag ${project:version} already exists in origin"