fix: makefile variable override (#1482)
This commit is contained in:
parent
6e14d4e53f
commit
c99cf180d0
|
@ -41,7 +41,6 @@ jobs:
|
|||
|
||||
- name: Install Build deps
|
||||
run: |
|
||||
dotnet tool install --global GitVersion.Tool --version 5.*
|
||||
Invoke-WebRequest -Uri https://github.com/prometheus/promu/releases/download/v$($Env:PROMU_VER)/promu-$($Env:PROMU_VER).windows-amd64.zip -OutFile promu-$($Env:PROMU_VER).windows-amd64.zip
|
||||
Expand-Archive -Path promu-$($Env:PROMU_VER).windows-amd64.zip -DestinationPath .
|
||||
Copy-Item -Path promu-$($Env:PROMU_VER).windows-amd64\promu.exe -Destination "$(go env GOPATH)\bin"
|
||||
|
@ -53,16 +52,14 @@ jobs:
|
|||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
dotnet-gitversion /output json /showvariable FullSemVer | Set-Content VERSION -PassThru
|
||||
|
||||
$Version = git describe --tag
|
||||
$Version = $Version -replace 'v', ''
|
||||
# '+' symbols are invalid characters in image tags
|
||||
(Get-Content -Path VERSION) -replace '\+', '_' | Set-Content -Path VERSION
|
||||
|
||||
$Version = Get-Content VERSION
|
||||
|
||||
make crossbuild
|
||||
$Version = $Version -replace '\+', '_'
|
||||
$Version | Set-Content VERSION -PassThru
|
||||
|
||||
make build-all
|
||||
|
||||
# GH requires all files to have different names, so add version/arch to differentiate
|
||||
foreach($Arch in "amd64", "arm64") {
|
||||
Move-Item output\$Arch\windows_exporter.exe output\windows_exporter-$Version-$Arch.exe
|
||||
|
@ -79,11 +76,11 @@ jobs:
|
|||
- name: Build Release Artifacts
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
$BuildVersion = Get-Content VERSION
|
||||
$Version = Get-Content VERSION
|
||||
|
||||
foreach($Arch in "amd64", "arm64") {
|
||||
Write-Host "Building windows_exporter $BuildVersion msi for $Arch"
|
||||
.\installer\build.ps1 -PathToExecutable .\output\windows_exporter-$BuildVersion-$Arch.exe -Version $BuildVersion -Arch "$Arch"
|
||||
Write-Host "Building windows_exporter $Version msi for $Arch"
|
||||
.\installer\build.ps1 -PathToExecutable .\output\windows_exporter-$Version-$Arch.exe -Version $Version -Arch "$Arch"
|
||||
}
|
||||
|
||||
Move-Item installer\*.msi output\
|
||||
|
@ -114,7 +111,7 @@ jobs:
|
|||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: quay.io
|
||||
username: '$token'
|
||||
username: 'robot'
|
||||
password: ${{ secrets.QUAY_IO_API_TOKEN }}
|
||||
|
||||
- name: Login to GitHub container registry
|
||||
|
|
23
Makefile
23
Makefile
|
@ -1,21 +1,19 @@
|
|||
export GOOS=windows
|
||||
export DOCKER_IMAGE_NAME ?= windows-exporter
|
||||
GOOS ?= windows
|
||||
VERSION ?= $(shell cat VERSION)
|
||||
DOCKER ?= docker
|
||||
|
||||
# DOCKER_REPO is the official image repository name at docker.io, quay.io.
|
||||
DOCKER_REPO:= prometheuscommunity
|
||||
DOCKER_REPO ?= prometheuscommunity
|
||||
DOCKER_IMAGE_NAME ?= windows-exporter
|
||||
|
||||
# ALL_DOCKER_REPOS is the list of repositories to push the image to. ghcr.io requires that org name be the same as the image repo name.
|
||||
ALL_DOCKER_REPOS:=docker.io/$(DOCKER_REPO) quay.io/$(DOCKER_REPO) ghcr.io/prometheus-community
|
||||
ALL_DOCKER_REPOS ?= docker.io/$(DOCKER_REPO) quay.io/$(DOCKER_REPO) ghcr.io/prometheus-community
|
||||
|
||||
VERSION?=$(shell cat VERSION)
|
||||
DOCKER?=docker
|
||||
|
||||
# Image Variables for Hostprocess Container
|
||||
# Image Variables for host process Container
|
||||
# Windows image build is heavily influenced by https://github.com/kubernetes/kubernetes/blob/master/cluster/images/etcd/Makefile
|
||||
OS=ltsc2019
|
||||
ALL_OS:= ltsc2019 ltsc2022
|
||||
BASE_IMAGE=mcr.microsoft.com/windows/nanoserver
|
||||
BASE_HOST_PROCESS_IMAGE=mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0
|
||||
OS ?= ltsc2019
|
||||
ALL_OS ?= ltsc2019 ltsc2022
|
||||
BASE_IMAGE ?= mcr.microsoft.com/windows/nanoserver
|
||||
|
||||
.PHONY: build
|
||||
build: generate windows_exporter.exe
|
||||
|
@ -79,6 +77,7 @@ push:
|
|||
sub-push-%:
|
||||
$(MAKE) DOCKER_REPO=$* push
|
||||
|
||||
.PHONY: push-all
|
||||
push-all: build-all $(addprefix sub-push-,$(ALL_DOCKER_REPOS))
|
||||
|
||||
# Mandatory target for container description sync action
|
||||
|
|
|
@ -11,7 +11,7 @@ Param (
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# The MSI version is not semver compliant, so just take the numerical parts
|
||||
$Version = $Version -replace '^v?([0-9\.]+).*$','$1'
|
||||
$MsiVersion = $Version -replace '^v?([0-9\.]+).*$','$1'
|
||||
|
||||
# Get absolute path to executable before switching directories
|
||||
$PathToExecutable = Resolve-Path $PathToExecutable
|
||||
|
@ -28,7 +28,7 @@ Copy-Item -Force $PathToExecutable Work/windows_exporter.exe
|
|||
Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi"
|
||||
$wixArch = @{"amd64" = "x64"; "arm64" = "arm64"}[$Arch]
|
||||
|
||||
Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\windows_exporter.wxs -d Version=$($Version) -ext WixToolset.Firewall.wixext -ext WixToolset.Util.wixext"
|
||||
Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\windows_exporter.wxs -d Version=$($MsiVersion) -ext WixToolset.Firewall.wixext -ext WixToolset.Util.wixext"
|
||||
|
||||
Write-Verbose "Done!"
|
||||
Pop-Location
|
||||
|
|
Loading…
Reference in New Issue