Update CI and installer

This commit is contained in:
Calle Pettersson 2020-05-24 20:42:23 +02:00
parent 6efa6bed42
commit 10caabe0b1
4 changed files with 23 additions and 23 deletions

View File

@ -1,8 +1,8 @@
repository: repository:
path: github.com/martinlindhe/wmi_exporter path: github.com/prometheus-community/windows_exporter
build: build:
binaries: binaries:
- name: wmi_exporter - name: windows_exporter
ldflags: | ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}} -X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}} -X github.com/prometheus/common/version.Revision={{.Revision}}

View File

@ -8,7 +8,7 @@ environment:
GOPATH: c:\gopath GOPATH: c:\gopath
GO111MODULE: on GO111MODULE: on
clone_folder: c:\gopath\src\github.com\martinlindhe\wmi_exporter clone_folder: c:\gopath\src\github.com\prometheus-community\windows_exporter
install: install:
- mkdir %GOPATH%\bin - mkdir %GOPATH%\bin
@ -42,7 +42,7 @@ build_script:
make crossbuild make crossbuild
# GH requires all files to have different names, so add version/arch to differentiate # GH requires all files to have different names, so add version/arch to differentiate
foreach($Arch in "amd64","386") { foreach($Arch in "amd64","386") {
Rename-Item output\$Arch\wmi_exporter.exe -NewName wmi_exporter-$Version-$Arch.exe Rename-Item output\$Arch\windows_exporter.exe -NewName windows_exporter-$Version-$Arch.exe
} }
after_build: after_build:
@ -56,9 +56,9 @@ after_build:
# The MSI version is not semver compliant, so just take the numerical parts # The MSI version is not semver compliant, so just take the numerical parts
$MSIVersion = $env:APPVEYOR_REPO_TAG_NAME -replace '^v?([0-9\.]+).*$','$1' $MSIVersion = $env:APPVEYOR_REPO_TAG_NAME -replace '^v?([0-9\.]+).*$','$1'
foreach($Arch in "amd64","386") { foreach($Arch in "amd64","386") {
Write-Verbose "Building wmi_exporter $MSIVersion msi for $Arch" Write-Verbose "Building windows_exporter $MSIVersion msi for $Arch"
.\installer\build.ps1 -PathToExecutable .\output\$Arch\wmi_exporter-$BuildVersion-$Arch.exe -Version $MSIVersion -Arch "$Arch" .\installer\build.ps1 -PathToExecutable .\output\$Arch\windows_exporter-$BuildVersion-$Arch.exe -Version $MSIVersion -Arch "$Arch"
Move-Item installer\Output\wmi_exporter-$MSIVersion-$Arch.msi output\$Arch\ Move-Item installer\Output\windows_exporter-$MSIVersion-$Arch.msi output\$Arch\
} }
- promu checksum output\ - promu checksum output\
@ -68,7 +68,7 @@ artifacts:
deploy: deploy:
- provider: GitHub - provider: GitHub
description: WMI Exporter version $(appveyor_build_version) description: windows_exporter version $(appveyor_build_version)
artifact: Artifacts artifact: Artifacts
auth_token: auth_token:
secure: 'CrXWeTf7qONUOEki5olFfGEUPMLDeHj61koDXV3OVEaLgtACmnVHsKUub9POflda' secure: 'CrXWeTf7qONUOEki5olFfGEUPMLDeHj61koDXV3OVEaLgtACmnVHsKUub9POflda'

View File

@ -48,13 +48,13 @@ Get-FileIfNotExists "https://github.com/wixtoolset/wix3/releases/download/wix311
mkdir -Force WiX | Out-Null mkdir -Force WiX | Out-Null
Expand-Archive -Path "${sourceDir}\wix-binaries.zip" -DestinationPath WiX -Force Expand-Archive -Path "${sourceDir}\wix-binaries.zip" -DestinationPath WiX -Force
Copy-Item -Force $PathToExecutable Work/wmi_exporter.exe Copy-Item -Force $PathToExecutable Work/windows_exporter.exe
Write-Verbose "Creating wmi_exporter-${Version}-${Arch}.msi" Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi"
$wixArch = @{"amd64" = "x64"; "386" = "x86"}[$Arch] $wixArch = @{"amd64" = "x64"; "386" = "x86"}[$Arch]
$wixOpts = "-ext WixFirewallExtension -ext WixUtilExtension" $wixOpts = "-ext WixFirewallExtension -ext WixUtilExtension"
Invoke-Expression "WiX\candle.exe -nologo -arch $wixArch $wixOpts -out Work\wmi_exporter.wixobj -dVersion=`"$Version`" wmi_exporter.wxs" Invoke-Expression "WiX\candle.exe -nologo -arch $wixArch $wixOpts -out Work\windows_exporter.wixobj -dVersion=`"$Version`" windows_exporter.wxs"
Invoke-Expression "WiX\light.exe -nologo -spdb $wixOpts -out `"Output\wmi_exporter-${Version}-${Arch}.msi`" Work\wmi_exporter.wixobj" Invoke-Expression "WiX\light.exe -nologo -spdb $wixOpts -out `"Output\windows_exporter-${Version}-${Arch}.msi`" Work\windows_exporter.wixobj"
Write-Verbose "Done!" Write-Verbose "Done!"
Pop-Location Pop-Location

View File

@ -8,12 +8,12 @@
<?define PlatformProgramFiles = "ProgramFilesFolder" ?> <?define PlatformProgramFiles = "ProgramFilesFolder" ?>
<?endif ?> <?endif ?>
<Product Id="*" UpgradeCode="66a6eb5b-1fc2-4b14-a362-5ceec6413308" <Product Id="*" UpgradeCode="66a6eb5b-1fc2-4b14-a362-5ceec6413308"
Name="WMI Exporter" Version="$(var.Version)" Manufacturer="Martin Lindhe" Name="windows_exporter" Version="$(var.Version)" Manufacturer="prometheus-community"
Language="1033" Codepage="1252"> Language="1033" Codepage="1252">
<Package Id="*" Manufacturer="Martin Lindhe" InstallScope="perMachine" <Package Id="*" Manufacturer="prometheus-community" InstallScope="perMachine"
Description="WMI Exporter $(var.Version) installer" Compressed="yes" /> Description="windows_exporter $(var.Version) installer" Compressed="yes" />
<Media Id="1" Cabinet="wmi_exporter.cab" EmbedCab="yes"/> <Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes"/>
<MajorUpgrade Schedule="afterInstallExecute" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." /> <MajorUpgrade Schedule="afterInstallExecute" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
<Property Id="ENABLED_COLLECTORS" Secure="yes"/> <Property Id="ENABLED_COLLECTORS" Secure="yes"/>
@ -31,7 +31,7 @@
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFiles)"> <Directory Id="$(var.PlatformProgramFiles)">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="wmi_exporter"> <Directory Id="APPLICATIONROOTDIRECTORY" Name="windows_exporter">
<Directory Id="textfile_inputs" Name="textfile_inputs" /> <Directory Id="textfile_inputs" Name="textfile_inputs" />
</Directory> </Directory>
</Directory> </Directory>
@ -42,14 +42,14 @@
<ComponentGroup Id="Files"> <ComponentGroup Id="Files">
<Component Directory="APPLICATIONROOTDIRECTORY"> <Component Directory="APPLICATIONROOTDIRECTORY">
<File Id="wmi_exporter.exe" Name="wmi_exporter.exe" Source="Work\wmi_exporter.exe" KeyPath="yes"> <File Id="windows_exporter.exe" Name="windows_exporter.exe" Source="Work\windows_exporter.exe" KeyPath="yes">
<fw:FirewallException Id="MetricsEndpoint" Name="WMI Exporter (HTTP [LISTEN_PORT])" Description="WMI Exporter HTTP endpoint" Port="[LISTEN_PORT]" Protocol="tcp" Scope="any" IgnoreFailure="yes" /> <fw:FirewallException Id="MetricsEndpoint" Name="windows_exporter (HTTP [LISTEN_PORT])" Description="windows_exporter HTTP endpoint" Port="[LISTEN_PORT]" Protocol="tcp" Scope="any" IgnoreFailure="yes" />
</File> </File>
<ServiceInstall Id="InstallExporterService" Name="wmi_exporter" DisplayName="WMI exporter" Description="Exports Prometheus metrics from WMI queries" ErrorControl="normal" Start="auto" Type="ownProcess" Arguments="--log.format logger:eventlog?name=wmi_exporter [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirFlag] [ExtraFlags]"> <ServiceInstall Id="InstallExporterService" Name="windows_exporter" DisplayName="windows_exporter" Description="Exports Prometheus metrics from WMI queries" ErrorControl="normal" Start="auto" Type="ownProcess" Arguments="--log.format logger:eventlog?name=windows_exporter [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirFlag] [ExtraFlags]">
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="5" /> <util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="5" />
</ServiceInstall> </ServiceInstall>
<ServiceControl Id="ServiceStateControl" Name="wmi_exporter" Remove="uninstall" Start="install" Stop="both" /> <ServiceControl Id="ServiceStateControl" Name="windows_exporter" Remove="uninstall" Start="install" Stop="both" />
<util:EventSource Log="Application" Name="wmi_exporter" EventMessageFile="%SystemRoot%\System32\EventCreate.exe" /> <util:EventSource Log="Application" Name="windows_exporter" EventMessageFile="%SystemRoot%\System32\EventCreate.exe" />
</Component> </Component>
<Component Id="CreateTextfileDirectory" Directory="textfile_inputs" Guid="d03ef58a-9cbf-4165-ad39-d143e9b27e14"> <Component Id="CreateTextfileDirectory" Directory="textfile_inputs" Guid="d03ef58a-9cbf-4165-ad39-d143e9b27e14">
<CreateFolder /> <CreateFolder />