Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-windows-build-msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ on:
- master
- releases/**
paths:
- windows/installer/*.wxs
- build/windows/installer/*.wxs
- .github/workflows/ci-windows-build-msi.yml
pull_request:
branches:
- master
- releases/**
paths:
- windows/installer/*.wxs
- build/windows/installer/*.wxs
- .github/workflows/ci-windows-build-msi.yml

jobs:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ release: check_release build package ## Build a release tarball

.PHONY: windows_installer
windows_installer: build ## Windows - build the installer
@.\make_installer.ps1 -version $(BUILD_VERSION)
@.\build\windows\make_installer.ps1 -version $(BUILD_VERSION)

.PHONY: chocolatey
chocolatey: windows_installer ## Windows - build the chocolatey package
@.\make_chocolatey.ps1 -version $(BUILD_VERSION)
@.\build\windows\make_chocolatey.ps1 -version $(BUILD_VERSION)

# Include test/bats.mk only if it exists
# to allow building without a test/ directory
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ stages:
--azure-key-vault-url "$(KeyVaultUrl)"
displayName: "Sign crowdsec binaries"
- pwsh: |
.\make_installer.ps1 -version '$(BuildVersion)'
.\build\windows\make_installer.ps1 -version '$(BuildVersion)'
displayName: "Build Crowdsec MSI"
name: BuildMSI
- pwsh: |
.\make_chocolatey.ps1 -version '$(BuildVersion)'
.\build\windows\make_chocolatey.ps1 -version '$(BuildVersion)'
displayName: "Build Chocolatey nupkg"
- pwsh: |
sign code azure-key-vault `
Expand Down
6 changes: 3 additions & 3 deletions windows/README.md → build/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Now, run PowerShell as Administrator, go in the crowdsec repository (if you
already cloned it) and run:

```powershell
PS C:\Users\johndoe\src\crowdsec> powershell .\windows\install_dev_windows.ps1
PS C:\Users\johndoe\src\crowdsec> powershell .\build\windows\install_dev_windows.ps1
[...]
```

Expand All @@ -18,7 +18,7 @@ Now you should have the right dependencies (go, gcc, git). You can verify with
to also build the choco or MSI packages, you need more dependencies:

```powershell
PS C:\Users\johndoe\src\crowdsec> powershell .\windows\install_installer_windows.ps1
PS C:\Users\johndoe\src\crowdsec> powershell .\build\windows\install_installer_windows.ps1
[...]
```

Expand All @@ -28,7 +28,7 @@ You can now use
* `make test` to run unit tests. Some tests requiring localstack are disabled. Functional tests are also only available on unix systems.

* `make windows_installer` to build a `crowdsec_x.y.z.msi` installer
* `make chocolatey` to build a package under `.\windows\Chocolatey\crowdsec\crowdsec_x.y.z.nupkg` which you can test using `choco install <filename>`
* `make chocolatey` to build a package under `.\build\windows\Chocolatey\crowdsec\crowdsec_x.y.z.nupkg` which you can test using `choco install <filename>`

After installing CrowdSec, the binaries are in `C:\Program Files\CrowdSec\`:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#install choco
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install -y golang
choco install -y golang
choco install -y git
choco install -y mingw
refreshenv
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
</UI>

<UIRef Id="WixUI_Common" />
<WixVariable Id="WixUIDialogBmp" Value="..\windows\installer\installer_dialog.bmp" />
<WixVariable Id="WixUIBannerBmp" Value="..\windows\installer\crowdsec_msi_top_banner.bmp" />
<Icon Id="icon.ico" SourceFile="..\windows\installer\crowdsec_icon.ico"/>
<WixVariable Id="WixUIDialogBmp" Value="..\build\windows\installer\installer_dialog.bmp" />
<WixVariable Id="WixUIBannerBmp" Value="..\build\windows\installer\crowdsec_msi_top_banner.bmp" />
<Icon Id="icon.ico" SourceFile="..\build\windows\installer\crowdsec_icon.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
</Fragment>
</Wix>
File renamed without changes.
8 changes: 4 additions & 4 deletions make_chocolatey.ps1 → build/windows/make_chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ if ($version.StartsWith("v"))
}

#Pre-releases will be like 1.4.0-rc1, remove everything after the dash as it does not conform to the MSI versioning scheme
if ($version.Contains("-"))
if ($version.Contains("-"))
{
$version = $version.Substring(0, $version.IndexOf("-"))
}

Set-Location .\windows\Chocolatey\crowdsec
Copy-Item ..\..\..\crowdsec_$version.msi tools\crowdsec.msi
Set-Location .\build\windows\Chocolatey\crowdsec
Copy-Item ..\..\..\..\crowdsec_$version.msi tools\crowdsec.msi

choco pack --version $version

Copy-Item crowdsec.$version.nupkg ..\..\..\
Copy-Item crowdsec.$version.nupkg ..\..\..\..\
6 changes: 3 additions & 3 deletions make_installer.ps1 → build/windows/make_installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ if ($version.StartsWith("v"))
}

#Pre-releases will be like 1.4.0-rc1, remove everything after the dash as it does not conform to the MSI versioning scheme
if ($version.Contains("-"))
if ($version.Contains("-"))
{
$version = $version.Substring(0, $version.IndexOf("-"))
}

Remove-Item -Force -Recurse -Path .\msi -ErrorAction SilentlyContinue
#we only harvest the patterns dir, as we want to handle differently some yaml files in the config directory, and I really don't want to write xlst filters to exclude the files :(
heat.exe dir config\patterns -nologo -cg CrowdsecPatterns -dr PatternsDir -g1 -ag -sf -srd -scom -sreg -out "msi\fragment.wxs"
candle.exe -arch x64 -dSourceDir=config\patterns -dVersion="$version" -out msi\ msi\fragment.wxs windows\installer\WixUI_HK.wxs windows\installer\product.wxs
light.exe -b .\config\patterns -ext WixUIExtension -ext WixUtilExtension -sacl -spdb -out crowdsec_$version.msi msi\fragment.wixobj msi\WixUI_HK.wixobj msi\product.wixobj
candle.exe -arch x64 -dSourceDir=config\patterns -dVersion="$version" -out msi\ msi\fragment.wxs build\windows\installer\WixUI_HK.wxs build\windows\installer\product.wxs
light.exe -b .\config\patterns -ext WixUIExtension -ext WixUtilExtension -sacl -spdb -out crowdsec_$version.msi msi\fragment.wixobj msi\WixUI_HK.wixobj msi\product.wixobj