-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
container: do not fail hard, if single containers can't be scraped (#…
- Loading branch information
Showing
7 changed files
with
251 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Push Check | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
env: | ||
VERSION_PROMU: '0.14.0' | ||
VERSION_CONTAINERD: '1.7.21' | ||
VERSION_BUILDKIT: '0.15.2' | ||
VERSION_BUILDX: '0.16.2' | ||
|
||
jobs: | ||
stale: | ||
if: github.repository_owner == 'jkroepke' | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
# https://github.com/pl4nty/Windows-Containers/blob/Main/helpful_tools/Install-BuildKit-GitHubActions/workflow.yaml | ||
- name: Setup containerd | ||
run: | | ||
curl.exe -L https://github.com/containerd/containerd/releases/download/v${{ env.VERSION_CONTAINERD }}/containerd-${{ env.VERSION_CONTAINERD }}-windows-amd64.tar.gz -o containerd.tar.gz | ||
tar.exe xvf containerd.tar.gz | ||
.\bin\containerd.exe --register-service | ||
Start-Service containerd | ||
- name: Setup BuildKit | ||
run: | | ||
curl.exe -L https://github.com/moby/buildkit/releases/download/v${{ env.VERSION_BUILDKIT }}/buildkit-v${{ env.VERSION_BUILDKIT }}.windows-amd64.tar.gz -o buildkit.tar.gz | ||
tar.exe xvf buildkit.tar.gz | ||
.\bin\buildkitd.exe --register-service | ||
Start-Service buildkitd | ||
- name: Setup Docker Buildx | ||
run: | | ||
curl.exe -L https://github.com/docker/buildx/releases/download/v${{ env.VERSION_BUILDX }}/buildx-v${{ env.VERSION_BUILDX }}.windows-amd64.exe -o $env:ProgramData\Docker\cli-plugins\docker-buildx.exe | ||
- uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver: remote | ||
endpoint: npipe:////./pipe/buildkitd | ||
|
||
- name: Install WiX | ||
run: dotnet tool install --global wix | ||
|
||
- name: Install WiX extensions | ||
run: | | ||
wix extension add -g WixToolset.Util.wixext | ||
wix extension add -g WixToolset.Firewall.wixext | ||
- name: Install Build deps | ||
run: | | ||
Invoke-WebRequest -Uri https://github.com/prometheus/promu/releases/download/v$($Env:VERSION_PROMU)/promu-$($Env:VERSION_PROMU).windows-amd64.zip -OutFile promu-$($Env:VERSION_PROMU).windows-amd64.zip | ||
Expand-Archive -Path promu-$($Env:VERSION_PROMU).windows-amd64.zip -DestinationPath . | ||
Copy-Item -Path promu-$($Env:VERSION_PROMU).windows-amd64\promu.exe -Destination "$(go env GOPATH)\bin" | ||
# GOPATH\bin dir must be added to PATH else the `promu` commands won't be found | ||
echo "$(go env GOPATH)\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
- name: Build | ||
run: | | ||
$ErrorActionPreference = "Stop" | ||
$Version = git describe --tags --always | ||
$Version = $Version -replace 'v', '' | ||
# '+' symbols are invalid characters in image tags | ||
$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 | ||
} | ||
Get-ChildItem -Path output | ||
- name: Login to GitHub container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push Latest image | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: ${{ startsWith(github.ref, 'refs/tags/') && 'latest' || github.ref_name }} | ||
run: | | ||
make push-all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ on: | |
- master | ||
|
||
env: | ||
PROMU_VER: 'v0.14.0' | ||
VERSION_PROMU: 'v0.14.0' | ||
|
||
jobs: | ||
codespell: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.