Skip to content

Commit d1be1d5

Browse files
authored
Cleans up Windows completely (#464)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
1 parent ed74ee9 commit d1be1d5

32 files changed

Lines changed: 40 additions & 694 deletions

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# prevents windows runners from failing on lint
21
* text eol=lf
32

43
*.ico binary

.github/workflows/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# this allows passwordless `sudo` for RPM and Debian testing.
66
#
77
# `make e2e` requires make and go, but `CGO=0` means gcc isn't needed. Ubuntu
8-
# installs more packages, notably windows, for the `check` and `dist` targets.
8+
# installs more packages for the `check` and `dist` targets.
99
# To run RPM tests on CentOS, you must build them first on Ubuntu.
1010
#
1111
# This build is intended for use in a matrix, testing all major Linux platforms
@@ -57,12 +57,11 @@ ARG arch_lc=arm64
5757

5858
FROM base-${TARGETARCH}
5959

60-
# CentOS runs e2e, but can't run dist as Windows packages are not available.
6160
# While it is possible to build osslsigncode on CentOS, msitools can't due to
6261
# missing libgcab1-devel package. The workaround is to `make dist` with Ubuntu.
6362
ARG centos_packages="make sudo"
6463
# Ubuntu runs check, dist, and e2e, so needs more packages.
65-
ARG ubuntu_packages="make sudo curl git zip wixl msitools osslsigncode"
64+
ARG ubuntu_packages="make sudo curl git zip osslsigncode"
6665
RUN if [ -f /etc/centos-release ]; then \
6766
# Use Dandified YUM on CentOS >=8.
6867
dnf="dnf -qy" && ${dnf} install ${centos_packages} && ${dnf} clean all; \

.github/workflows/commit.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ on:
99
tags: ''
1010
branches: master
1111
# ignore docs as they are built with Netlify. Ignore travis-related changes, too.
12-
# func-e.wxs is used for the Windows Installer, so tested with msi.yaml
1312
paths-ignore:
1413
- '**/*.md'
1514
- 'site/**'
1615
- 'netlify.toml'
1716
- '.travis.yml'
18-
- 'packaging/msi/*'
19-
- 'packaging/icon@48w.ico'
20-
- '.github/workflows/msi.yaml'
2117
pull_request: # We also run tests on pull requests targeted at the master branch.
2218
branches: master
2319
paths-ignore:

.github/workflows/packaging.yaml

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,8 @@ defaults:
3636
jobs:
3737
packaging:
3838
name: "Test packaging build (${{ matrix.os }})"
39-
runs-on: windows-2022
40-
strategy:
41-
fail-fast: false # don't fail fast as sometimes failures are operating system specific
42-
39+
runs-on: ubuntu-latest
4340
steps:
44-
- name: "Setup msitools, wixtoolset, osslsigncode"
45-
run: |
46-
choco install osslsigncode -y
47-
choco install zip -y
48-
echo "$WIX\\bin" >> $GITHUB_PATH
49-
echo "${HOME}\\osslsigncode" >> $GITHUB_PATH
50-
51-
env: # `gh` requires auth even on public releases
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
5441
- name: "Checkout"
5542
uses: actions/checkout@v4
5643

@@ -62,17 +49,9 @@ jobs:
6249
key: test-${{ runner.os }}-go-${{ hashFiles('go.mod', 'go.sum', 'Tools.mk') }}
6350
restore-keys: test-${{ runner.os }}-go-
6451

65-
- name: "Build packages (Windows Installer, Debian, RPM)"
52+
- name: "Build packages (Installer, Debian, RPM)"
6653
run: make dist
6754

68-
# This tests the manifest via yamllint because validation via winget requires too much setup.
69-
# See https://github.com/microsoft/winget-cli/issues/754#issuecomment-896475895
70-
- name: "Test winget manifest generation"
71-
run: |
72-
./packaging/msi/winget_manifest.sh > Tetrate.func-e.yaml
73-
yamllint -sd '{extends: default, rules: {line-length: disable}}' Tetrate.func-e.yaml
74-
75-
7655
# In order to share the built artifacts in the subsequent tests, we use cache instead of actions/upload-artifacts.
7756
# The reason is that upload-artifacts are not globally consistent and sometimes pre_release_test won't be able to
7857
# find the artifacts uploaded here. See https://github.com/actions/upload-artifact/issues/21 for more context.
@@ -97,7 +76,7 @@ jobs:
9776
strategy:
9877
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
9978
matrix:
100-
os: [ubuntu-22.04, macos-12, windows-2022]
79+
os: [ubuntu-latest, macos-latest]
10180

10281
steps:
10382
- uses: actions/checkout@v4
@@ -112,13 +91,6 @@ jobs:
11291
path:
11392
dist/
11493

115-
# This only checks the installer when built on Windows as it is simpler than switching OS.
116-
# refreshenv is from choco, and lets you reload ENV variables (used here for PATH).
117-
- name: "Test Windows Installer (Windows)"
118-
if: runner.os == 'Windows'
119-
run: call packaging\msi\verify_msi.cmd
120-
shell: cmd
121-
12294
- name: "Test Debian package"
12395
if: runner.os == 'Linux'
12496
run: packaging/nfpm/verify_deb.sh

.github/workflows/release.yaml

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,17 @@ defaults:
1515
jobs:
1616
func-e:
1717
name: "Release `func-e` CLI"
18-
runs-on: windows-2022
18+
runs-on: ubuntu-latest
1919

2020
steps:
2121
- name: "Checkout"
2222
uses: actions/checkout@v4
2323
with: # fetch all history for all tags and branches (needed for changelog)
2424
fetch-depth: 0
2525

26-
# windows-2022 is missing osslsigncode (no issue, yet)
27-
- name: "Install osslsigncode, infozip; setup wix"
28-
run: |
29-
choco install osslsigncode -y
30-
choco install zip -y
31-
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH
32-
33-
- name: Download Windows code signing certificate
34-
env:
35-
WINDOWS_CODESIGN_P12_BASE64: ${{ secrets.WINDOWS_CODESIGN_P12_BASE64 }}
36-
run: | # On the fork PRs, our org secret is not visible.
37-
if [ $WINDOWS_CODESIGN_P12_BASE64 ]; then
38-
echo $WINDOWS_CODESIGN_P12_BASE64 | base64 --decode > windows-certificate.p12
39-
echo "WINDOWS_CODESIGN_P12=windows-certificate.p12" >> $GITHUB_ENV
40-
fi
41-
shell: bash
42-
4326
- name: "Make release assets (test)"
4427
if: github.event_name != 'push' || !contains(github.ref, 'refs/tags/')
45-
run: | # On the fork PRs, our org secret is not visible. We unset the required env so that `make dist` uses default self-signed cert.
46-
if [ $WINDOWS_CODESIGN_P12 ]; then
47-
export WINDOWS_CODESIGN_PASSWORD=${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
48-
fi
28+
run: |
4929
VERSION=${GITHUB_REF#refs/tags/v}
5030
make dist VERSION=$VERSION
5131
echo "VERSION=${VERSION}" >> $GITHUB_ENV
@@ -54,10 +34,7 @@ jobs:
5434
- name: "Make release assets"
5535
# Triggers only on tag creation.
5636
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
57-
run: | # On the fork PRs, our org secret is not visible. We unset the required env so that `make dist` uses default self-signed cert.
58-
if [ $WINDOWS_CODESIGN_P12 ]; then
59-
export WINDOWS_CODESIGN_PASSWORD=${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
60-
fi
37+
run: |
6138
VERSION=${GITHUB_REF#refs/tags/v}
6239
make dist VERSION=$VERSION
6340
echo "VERSION=${VERSION}" >> $GITHUB_ENV
@@ -82,15 +59,10 @@ jobs:
8259
strategy:
8360
matrix:
8461
include:
85-
- os: ubuntu-20.04 # Hard-coding an LTS means maintenance, but only once each 2 years!
62+
- os: ubuntu-latest
8663
pattern: '*linux_amd64.tar.gz'
87-
- os: macos-12
64+
- os: macos-latest
8865
pattern: '*darwin_amd64.tar.gz'
89-
- os: windows-2022
90-
pattern: '*windows_amd64.*'
91-
unzip: | # the above downloads both the zip and msi, stash the msi name
92-
printf "::set-output name=msi::%s\n" *.msi
93-
unzip -o *.zip && rm *.zip
9466

9567
steps:
9668
- name: "Checkout"
@@ -107,17 +79,6 @@ jobs:
10779
- name: "Run e2e tests using draft `func-e` binary"
10880
run: E2E_FUNC_E_PATH=. make e2e
10981

110-
# This only checks the installer when built on Windows as it is simpler than switching OS.
111-
# refreshenv is from choco, and lets you reload ENV variables (used here for PATH).
112-
- name: "Test Windows Installer (Windows)"
113-
if: runner.os == 'Windows'
114-
run: | # delete func-e.exe which was just tested, so it doesn't taint the tests
115-
del func-e.exe
116-
call packaging\msi\verify_msi.cmd
117-
shell: cmd
118-
env: # use the stashed msi name instead of parsing it
119-
MSI_FILE: ${{ steps.download.outputs.msi }}
120-
12182
- name: "Test Debian package"
12283
if: runner.os == 'Linux'
12384
run: |

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@
33
/build/
44
/dist/
55

6-
# intermediate files used to create Windows Installer (func-e.msi)
7-
func-e.wixobj
8-
96
# possible when testing
107
/func-e
11-
/func-e.exe
12-
/func-e.msi
138
/Tetrate.func-e.yaml
149
/manifests/
1510

DEVELOPER.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,3 @@ make dist
4949
The contents will be in the 'dist/' folder and include the same files as a
5050
[release](https://github.com/tetratelabs/func-e/releases) would, except
5151
signatures would not be the same as production.
52-
53-
Note: this step requires prerequisites for Windows packaging to work. Look at
54-
[msi.yaml](.github/workflows/msi.yaml) for what's needed per-platform.

Makefile

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ ifndef goroot
2929
$(error could not determine GOROOT)
3030
endif
3131

32-
# Ensure POSIX-style GOROOT even in Windows, to support PATH updates in bash.
33-
ifdef COMSPEC
34-
goroot := $(shell cygpath $(goroot))
35-
endif
36-
3732
# We must ensure `go` executes with GOROOT and PATH variables exported:
3833
# * GOROOT ensures versions don't conflict with /usr/local/go or c:\Go
3934
# * PATH ensures tools like golint can fork and execute the correct go binary.
@@ -94,9 +89,7 @@ e2e: $(E2E_FUNC_E_PATH)/func-e$(goexe) ## Run all end-to-end tests
9489
@printf "$(ansi_format_bright)" e2e "ok"
9590

9691
linux_platforms := linux_amd64 linux_arm64
97-
non_windows_platforms := darwin_amd64 darwin_arm64 $(linux_platforms)
98-
# TODO: arm64 on Windows https://github.com/envoyproxy/envoy/issues/17572
99-
windows_platforms := windows_amd64
92+
all_platforms := darwin_amd64 darwin_arm64 $(linux_platforms)
10093

10194
# Make 3.81 doesn't support '**' globbing: Set explicitly instead of recursion.
10295
all_sources := $(wildcard *.go */*.go */*/*.go */*/*/*.go */*/*/*.go */*/*/*/*.go)
@@ -117,11 +110,6 @@ dist/func-e_$(VERSION)_%.tar.gz: build/func-e_%/func-e
117110
@tar -C $(<D) -cpzf $@ $(<F)
118111
@printf "$(ansi_format_bright)" tar.gz "ok"
119112

120-
build/func-e_%/func-e.exe: $(main_sources)
121-
ifeq ($(OS),Windows_NT)
122-
$(call go-build,$@,$<)
123-
endif
124-
125113
dist/func-e_$(VERSION)_%.zip: build/func-e_%/func-e.exe.signed
126114
@printf "$(ansi_format_dark)" zip "zipping $@"
127115
@mkdir -p $(@D)
@@ -161,34 +149,21 @@ msi-arch = $(if $(findstring amd64,$1),x64,arm64)
161149
# Default to a dummy version, which is always lower than a real release
162150
msi_version := $(VERSION:dev=0.0.1)
163151

164-
# This builds the Windows installer (MSI) using platform-dependent WIX commands.
165-
dist/func-e_$(VERSION)_%.msi: build/func-e_%/func-e.exe.signed
166-
ifeq ($(OS),Windows_NT) # Windows 10 etc use https://wixtoolset.org
167-
@printf "$(ansi_format_dark)" msi "building $@"
168-
@mkdir -p $(@D)
169-
@candle -nologo -arch $(call msi-arch,$@) -dVersion=$(msi_version) -dBin=$(<:.signed=) packaging/msi/func-e.wxs
170-
@light -nologo func-e.wixobj -o $@ -spdb
171-
@rm func-e.wixobj
172-
$(call codesign,$@)
173-
@printf "$(ansi_format_bright)" msi "ok"
174-
endif
175-
176-
# Archives are tar.gz, except in the case of Windows, which uses zip.
177-
non_windows_archives := $(non_windows_platforms:%=dist/func-e_$(VERSION)_%.tar.gz)
178-
windows_archives := $(windows_platforms:%=dist/func-e_$(VERSION)_%.zip) $(windows_platforms:%=dist/func-e_$(VERSION)_%.msi)
179-
archives := $(non_windows_platforms:%=dist/func-e_$(VERSION)_%.tar.gz) $(windows_platforms:%=dist/func-e_$(VERSION)_%.zip)
152+
# Archives are tar.gz,
153+
all_archives := $(all_platforms:%=dist/func-e_$(VERSION)_%.tar.gz)
154+
archives := $(all_platforms:%=dist/func-e_$(VERSION)_%.tar.gz)
180155
checksums := dist/func-e_$(VERSION)_checksums.txt
181156

182157
# Darwin doesn't have sha256sum. See https://github.com/actions/virtual-environments/issues/90
183158
sha256sum := $(if $(findstring darwin,$(goos)),shasum -a 256,sha256sum)
184-
$(checksums): $(non_windows_archives) $(if $(findstring Windows_NT,$(OS)),$(windows_archives),)
159+
$(checksums): $(all_archives)
185160
@printf "$(ansi_format_dark)" sha256sum "generating $@"
186161
@$(sha256sum) $^ > $@
187162
@printf "$(ansi_format_bright)" sha256sum "ok"
188163

189164
# dist generates the assets that attach to a release
190165
# Ex. https://github.com/tetratelabs/func-e/releases/tag/v$(VERSION)
191-
dist: $(non_windows_archives) $(if $(findstring Windows_NT,$(OS)),$(windows_archives),) $(checksums) ## Generate release assets
166+
dist: $(all_archives) $(checksums) ## Generate release assets
192167

193168
clean: ## Ensure a clean build
194169
@printf "$(ansi_format_dark)" clean "deleting temporary files"
@@ -241,14 +216,9 @@ site: ## Serve website content
241216
@git submodule update
242217
@cd site && $(go) run $(hugo) server --minify --disableFastRender --baseURL localhost:1313 --cleanDestinationDir -D
243218

244-
# this makes a marker file ending in .signed to avoid repeatedly calling codesign
245-
%.signed: %
246-
$(call codesign,$<)
247-
@touch $@
248-
249219
# define macros for multi-platform builds. these parse the filename being built
250220
go-arch = $(if $(findstring amd64,$1),amd64,arm64)
251-
go-os = $(if $(findstring .exe,$1),windows,$(if $(findstring linux,$1),linux,darwin))
221+
go-os = $(if $(findstring linux,$1),linux,darwin)
252222
define go-build
253223
@printf "$(ansi_format_dark)" build "building $1"
254224
@# $(go:go=) removes the trailing 'go', so we can insert cross-build variables
@@ -264,23 +234,3 @@ define nfpm-pkg
264234
@$(go) run $(nfpm) pkg -f $1 --packager $2 --target $3
265235
@printf "$(ansi_format_bright)" nfpm "ok"
266236
endef
267-
268-
# This requires osslsigncode package (apt or brew) or latest windows release from mtrojnar/osslsigncode
269-
#
270-
# Default is self-signed while production should be a Digicert signing key
271-
#
272-
# Ex.
273-
# ```bash
274-
# keytool -genkey -alias func-e -storetype PKCS12 -keyalg RSA -keysize 2048 -storepass func-e-bunch \
275-
# -keystore func-e.p12 -dname "O=func-e,CN=func-e.io" -validity 3650
276-
# ```
277-
WINDOWS_CODESIGN_P12 ?= packaging/msi/func-e.p12
278-
WINDOWS_CODESIGN_PASSWORD ?= func-e-bunch
279-
define codesign
280-
@printf "$(ansi_format_dark)" codesign "signing $1"
281-
@osslsigncode sign -h sha256 -pkcs12 ${WINDOWS_CODESIGN_P12} -pass "${WINDOWS_CODESIGN_PASSWORD}" \
282-
-n "func-e makes running Envoy® easy" -i https://func-e.io -t http://timestamp.digicert.com \
283-
$(if $(findstring msi,$(1)),-add-msi-dse) -in $1 -out $1-signed
284-
@mv $1-signed $1
285-
@printf "$(ansi_format_bright)" codesign "ok"
286-
endef

e2e/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This directory holds the end-to-end tests for `func-e`.
55
By default, end-to-end (e2e) tests verify a `func-e` binary built from [main.go](../main.go).
66

77
## Using native go commands:
8-
End-to-end tests default to look for `func-e` (or `func-e.exe` in Windows), in the project root (current directory).
8+
End-to-end tests default to look for `func-e`, in the project root (current directory).
99

1010
```bash
1111
go build --ldflags '-s -w' .

e2e/func-e_run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var (
4242
staticFilesystemConfig []byte
4343
adminAddressPathPattern = regexp.MustCompile(`--admin-address-path ([^ ]+)`)
4444
envoyStartedLine = "starting main dispatch loop"
45-
// minRunArgs is the minimal config needed to run Envoy 1.18+, non-windows <1.18 need access_log_path: '/dev/stdout'
45+
// minRunArgs is the minimal config needed to run Envoy 1.18+.
4646
minRunArgs = []string{"run", "--config-yaml", "admin: {address: {socket_address: {address: '127.0.0.1', port_value: 0}}}"}
4747
)
4848

0 commit comments

Comments
 (0)