Skip to content

Commit 47733ba

Browse files
committed
TUN-8523: refactor makefile and cfsetup
- remove unused targets in Makefile - order deps in cfsetup.yaml - only build cloudflared not all linux targets - rename stages to be more explicit - adjust build deps of build-linux-release - adjust build deps of build-linux-fips-release - rename github_release_pkgs_pre_cache to build_release_pre_cache - only build release release artifacts within build-linux-release - only build release release artifacts within build-linux-fips-release - remove github-release-macos - remove github-release-windows - adjust builddeps of test and test-fips - create builddeps anchor for component-test and use it in component-test-fips - remove wixl from build-linux-* - rename release-pkgs-linux to r2-linux-release - add github-release: artifacts uplooad and set release message - clean build directory before build - add step to package windows binaries - refactor windows script One of TeamCity changes is moving the artifacts to the built artifacts, hence, there is no need to cp files from artifacts to built_artifacts - create anchor for release builds - create anchor for tests stages - remove reprepro and createrepo as they are only called by release_pkgs.py
1 parent c95959e commit 47733ba

File tree

4 files changed

+65
-105
lines changed

4 files changed

+65
-105
lines changed

.teamcity/mac/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,6 @@ for arch in ${archs[@]}; do
188188
fi
189189
done
190190

191-
# cleanup build the build directory because this script is not ran within containers,
191+
# cleanup build directory because this script is not ran within containers,
192192
# which might lead to future issues in subsequent runs.
193193
rm -rf "${TARGET_DIRECTORY}"

.teamcity/package-windows.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ windowsArchs=("amd64" "386")
99
for arch in ${windowsArchs[@]}; do
1010
export TARGET_ARCH=$arch
1111
# Copy exe into final directory
12-
cp ./artifacts/cloudflared-windows-$arch.exe $ARTIFACT_DIR/cloudflared-windows-$arch.exe
13-
cp ./artifacts/cloudflared-windows-$arch.exe ./cloudflared.exe
12+
cp $ARTIFACT_DIR/cloudflared-windows-$arch.exe ./cloudflared.exe
1413
make cloudflared-msi
1514
# Copy msi into final directory
1615
mv cloudflared-$VERSION-$arch.msi $ARTIFACT_DIR/cloudflared-windows-$arch.msi
17-
done
16+
done

Makefile

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -218,37 +218,14 @@ cloudflared-pkg: cloudflared cloudflared.1
218218
cloudflared-msi:
219219
wixl --define Version=$(VERSION) --define Path=$(EXECUTABLE_PATH) --output cloudflared-$(VERSION)-$(TARGET_ARCH).msi cloudflared.wxs
220220

221-
.PHONY: cloudflared-darwin-amd64.tgz
222-
cloudflared-darwin-amd64.tgz: cloudflared
223-
tar czf cloudflared-darwin-amd64.tgz cloudflared
224-
rm cloudflared
225-
226221
.PHONY: github-release
227-
github-release: cloudflared
228-
python3 github_release.py --path $(EXECUTABLE_PATH) --release-version $(VERSION)
229-
230-
.PHONY: github-release-built-pkgs
231-
github-release-built-pkgs:
222+
github-release:
232223
python3 github_release.py --path $(PWD)/built_artifacts --release-version $(VERSION)
233-
234-
.PHONY: release-pkgs-linux
235-
release-pkgs-linux:
236-
python3 ./release_pkgs.py
237-
238-
.PHONY: github-message
239-
github-message:
240224
python3 github_message.py --release-version $(VERSION)
241225

242-
.PHONY: github-mac-upload
243-
github-mac-upload:
244-
python3 github_release.py --path artifacts --release-version $(VERSION)
245-
246-
.PHONY: github-windows-upload
247-
github-windows-upload:
248-
python3 github_release.py --path built_artifacts/cloudflared-windows-amd64.exe --release-version $(VERSION) --name cloudflared-windows-amd64.exe
249-
python3 github_release.py --path built_artifacts/cloudflared-windows-amd64.msi --release-version $(VERSION) --name cloudflared-windows-amd64.msi
250-
python3 github_release.py --path built_artifacts/cloudflared-windows-386.exe --release-version $(VERSION) --name cloudflared-windows-386.exe
251-
python3 github_release.py --path built_artifacts/cloudflared-windows-386.msi --release-version $(VERSION) --name cloudflared-windows-386.msi
226+
.PHONY: r2-linux-release
227+
r2-linux-release:
228+
python3 ./release_pkgs.py
252229

253230
.PHONY: capnp
254231
capnp:

cfsetup.yaml

Lines changed: 58 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,27 @@ pinned_go: &pinned_go go-boring=1.22.2-1
33
build_dir: &build_dir /cfsetup_build
44
default-flavor: bullseye
55
buster: &buster
6-
build:
6+
build-linux:
77
build_dir: *build_dir
88
builddeps: &build_deps
99
- *pinned_go
1010
- build-essential
11-
- gotest-to-teamcity
1211
- fakeroot
1312
- rubygem-fpm
1413
- rpm
1514
- libffi-dev
16-
- reprepro
17-
- createrepo
1815
pre-cache: &build_pre_cache
1916
- export GOCACHE=/cfsetup_build/.cache/go-build
2017
- go install golang.org/x/tools/cmd/goimports@latest
2118
post-cache:
22-
# TODO: TUN-8126 this is temporary to make sure packages can be built before release
23-
- ./build-packages.sh
2419
# Build binary for component test
2520
- GOOS=linux GOARCH=amd64 make cloudflared
26-
build-fips:
21+
build-linux-fips:
2722
build_dir: *build_dir
2823
builddeps: *build_deps
2924
pre-cache: *build_pre_cache
3025
post-cache:
3126
- export FIPS=true
32-
# TODO: TUN-8126 this is temporary to make sure packages can be built before release
33-
- ./build-packages-fips.sh
3427
# Build binary for component test
3528
- GOOS=linux GOARCH=amd64 make cloudflared
3629
cover:
@@ -39,61 +32,36 @@ buster: &buster
3932
pre-cache: *build_pre_cache
4033
post-cache:
4134
- make cover
42-
# except FIPS (handled in github-fips-release-pkgs) and macos (handled in github-release-macos-amd64)
43-
github-release-pkgs:
35+
# except FIPS and macos
36+
build-linux-release:
4437
build_dir: *build_dir
45-
builddeps:
38+
builddeps: &build_deps_release
4639
- *pinned_go
4740
- build-essential
4841
- fakeroot
4942
- rubygem-fpm
5043
- rpm
51-
- wget
52-
# libmsi and libgcab are libraries the wixl binary depends on.
53-
- libmsi-dev
54-
- libgcab-dev
55-
- python3-dev
5644
- libffi-dev
57-
- python3-setuptools
45+
- python3-dev
5846
- python3-pip
59-
- reprepro
60-
- createrepo
61-
pre-cache: &github_release_pkgs_pre_cache
62-
- wget https://github.com/sudarshan-reddy/msitools/releases/download/v0.101b/wixl -P /usr/local/bin
63-
- chmod a+x /usr/local/bin/wixl
47+
- python3-setuptools
48+
- wget
49+
pre-cache: &build_release_pre_cache
6450
- pip3 install pynacl==1.4.0
6551
- pip3 install pygithub==1.55
6652
- pip3 install boto3==1.22.9
6753
- pip3 install python-gnupg==0.4.9
6854
post-cache:
6955
# build all packages (except macos and FIPS) and move them to /cfsetup/built_artifacts
7056
- ./build-packages.sh
71-
# release the packages built and moved to /cfsetup/built_artifacts
72-
- make github-release-built-pkgs
73-
# publish packages to linux repos
74-
- make release-pkgs-linux
7557
# handle FIPS separately so that we built with gofips compiler
76-
github-fips-release-pkgs:
58+
build-linux-fips-release:
7759
build_dir: *build_dir
78-
builddeps:
79-
- *pinned_go
80-
- build-essential
81-
- fakeroot
82-
- rubygem-fpm
83-
- rpm
84-
- wget
85-
# libmsi and libgcab are libraries the wixl binary depends on.
86-
- libmsi-dev
87-
- libgcab-dev
88-
- python3-dev
89-
- libffi-dev
90-
- python3-setuptools
91-
- python3-pip
92-
pre-cache: *github_release_pkgs_pre_cache
60+
builddeps: *build_deps_release
61+
pre-cache: *build_release_pre_cache
9362
post-cache:
9463
# same logic as above, but for FIPS packages only
9564
- ./build-packages-fips.sh
96-
- make github-release-built-pkgs
9765
generate-versions-file:
9866
build_dir: *build_dir
9967
builddeps:
@@ -152,21 +120,7 @@ buster: &buster
152120
- export GOOS=linux
153121
- export GOARCH=arm64
154122
- make cloudflared-deb
155-
github-release-macos-amd64:
156-
build_dir: *build_dir
157-
builddeps: &build_pygithub
158-
- *pinned_go
159-
- build-essential
160-
- python3-dev
161-
- libffi-dev
162-
- python3-setuptools
163-
- python3-pip
164-
pre-cache: &install_pygithub
165-
- pip3 install pynacl==1.4.0
166-
- pip3 install pygithub==1.55
167-
post-cache:
168-
- make github-mac-upload
169-
github-release-windows:
123+
package-windows:
170124
build_dir: *build_dir
171125
builddeps:
172126
- *pinned_go
@@ -186,10 +140,16 @@ buster: &buster
186140
- pip3 install pygithub==1.55
187141
post-cache:
188142
- .teamcity/package-windows.sh
189-
- make github-windows-upload
190143
test:
191144
build_dir: *build_dir
192-
builddeps: *build_deps
145+
builddeps: &build_deps_tests
146+
- *pinned_go
147+
- build-essential
148+
- fakeroot
149+
- rubygem-fpm
150+
- rpm
151+
- libffi-dev
152+
- gotest-to-teamcity
193153
pre-cache: *build_pre_cache
194154
post-cache:
195155
- export GOOS=linux
@@ -199,7 +159,7 @@ buster: &buster
199159
- make test | gotest-to-teamcity
200160
test-fips:
201161
build_dir: *build_dir
202-
builddeps: *build_deps
162+
builddeps: *build_deps_tests
203163
pre-cache: *build_pre_cache
204164
post-cache:
205165
- export GOOS=linux
@@ -210,7 +170,7 @@ buster: &buster
210170
- make test | gotest-to-teamcity
211171
component-test:
212172
build_dir: *build_dir
213-
builddeps:
173+
builddeps: &build_deps_component_test
214174
- *pinned_go
215175
- python3.7
216176
- python3-pip
@@ -230,24 +190,48 @@ buster: &buster
230190
- python3 component-tests/setup.py --type cleanup
231191
component-test-fips:
232192
build_dir: *build_dir
233-
builddeps:
234-
- *pinned_go
235-
- python3.7
236-
- python3-pip
237-
- python3-setuptools
238-
# procps installs the ps command which is needed in test_sysv_service because the init script
239-
# uses ps pid to determine if the agent is running
240-
- procps
193+
builddeps: *build_deps_component_test
241194
pre-cache-copy-paths:
242195
- component-tests/requirements.txt
243196
pre-cache: *component_test_pre_cache
244197
post-cache: *component_test_post_cache
245-
github-message-release:
198+
github-release:
246199
build_dir: *build_dir
247-
builddeps: *build_pygithub
248-
pre-cache: *install_pygithub
200+
builddeps:
201+
- *pinned_go
202+
- build-essential
203+
- python3-dev
204+
- libffi-dev
205+
- python3-setuptools
206+
- python3-pip
207+
pre-cache:
208+
- pip3 install pynacl==1.4.0
209+
- pip3 install pygithub==1.55
249210
post-cache:
211+
- make github-release
250212
- make github-message
213+
r2-linux-release:
214+
build_dir: *build_dir
215+
builddeps:
216+
- *pinned_go
217+
- build-essential
218+
- fakeroot
219+
- rubygem-fpm
220+
- rpm
221+
- wget
222+
- python3-dev
223+
- libffi-dev
224+
- python3-setuptools
225+
- python3-pip
226+
- reprepro
227+
- createrepo
228+
pre-cache:
229+
- pip3 install pynacl==1.4.0
230+
- pip3 install pygithub==1.55
231+
- pip3 install boto3==1.22.9
232+
- pip3 install python-gnupg==0.4.9
233+
post-cache:
234+
- make r2-linux-release
251235

252236
bullseye: *buster
253237
bookworm: *buster

0 commit comments

Comments
 (0)