Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SECCOMP-27660: Fix vulnerabilities with upstream repo changes #95

Merged
merged 156 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
9003ac8
Dashboard linting improvements for mixin
rgeyer May 25, 2022
73b0b42
Convert pg_stat_database to new collector model
sysadmind Sep 2, 2022
6937685
Capture usename and application_name for pg_stat_activity
cezmunsta Aug 15, 2022
d9ac4be
Fixed formatting
cezmunsta Aug 19, 2022
c8991de
Update common Prometheus files
prombot Dec 13, 2022
76223cd
probe: clean-up database connection after probe to prevent connection…
kjbass Dec 14, 2022
dc1c19e
Set gauge to 1 when collector is successful
Nov 24, 2022
3b45347
Add postgres 15 for CI test
khiemdoan Dec 27, 2022
045f24f
Add postgres 15 for CI test
khiemdoan Dec 27, 2022
8ff0e5a
New unit value 64kB
Jan 4, 2023
e6ac9ca
Merge branch 'master' of github.com:khiemdoan/postgres_exporter into …
khiemdoan Jan 5, 2023
b92161c
Merge branch 'circleci' of github.com:khiemdoan/postgres_exporter int…
khiemdoan Jan 5, 2023
d23b0b2
Merge pull request #647 from grafana/rgeyer/mixin-dashboard-linting
sysadmind Jan 21, 2023
8b8466f
Merge pull request #740 from revverse/master
sysadmind Jan 21, 2023
ab8f272
Merge pull request #736 from khiemdoan/circleci
sysadmind Jan 22, 2023
169bb0c
Merge pull request #733 from prometheus-community/repo_sync
sysadmind Jan 22, 2023
29cf7eb
Update common Prometheus files
prombot Jan 23, 2023
d4af942
Merge pull request #745 from prometheus-community/repo_sync
SuperQ Jan 24, 2023
fc264d0
Update exporter-toolkit
SuperQ Jan 24, 2023
b1e72a9
go fmt
SuperQ Jan 24, 2023
3007500
adding codified functionality for logical replication metrics
Jan 24, 2023
0e4506e
Merge pull request #746 from prometheus-community/bjk/exporter-toolki…
SuperQ Jan 25, 2023
e198f6f
Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0
dependabot[bot] Jan 25, 2023
e578176
Merge pull request #730 from prometheus-community/dependabot/go_modul…
SuperQ Jan 25, 2023
61492f6
Bump github.com/prometheus/common from 0.37.0 to 0.39.0
dependabot[bot] Jan 25, 2023
732e74d
Merge pull request #738 from prometheus-community/dependabot/go_modul…
SuperQ Jan 25, 2023
9b13780
addressing comments
Jan 25, 2023
600ad18
more comments
sheldor14 Jan 28, 2023
1ec69c9
fmt
sheldor14 Jan 28, 2023
f3952f9
typing
sheldor14 Jan 28, 2023
076eb2c
fmt
sheldor14 Jan 28, 2023
7259eec
Merge pull request #747 from sheldor14/replication_slot
sysadmind Feb 7, 2023
e589183
send stdout/stderr to syslog
gavrik Feb 7, 2023
94a89b0
Merge pull request #734 from kjbass/master
sysadmind Feb 12, 2023
36773e0
Merge pull request #673 from cezmunsta/pg_stat_activity-enhancements
sysadmind Feb 12, 2023
44aab36
Merge pull request #755 from gavrik/patch-1
sysadmind Feb 12, 2023
9cd4890
Update common Prometheus files
prombot Feb 21, 2023
2197e73
Merge pull request #760 from prometheus-community/repo_sync
sysadmind Mar 5, 2023
799f3e1
Fix exclude-databases for collector package
sysadmind Oct 4, 2022
8d6ce05
Remove commented code
sysadmind Oct 17, 2022
5526386
Remove more dead code
sysadmind Mar 5, 2023
c86f549
Merge pull request #697 from sysadmind/exclude-database-fix
SuperQ Mar 5, 2023
0e654d8
Update build
SuperQ Mar 5, 2023
d273f97
Merge pull request #764 from prometheus-community/superq/update_build
sysadmind Mar 5, 2023
e7f58a4
Reduce cardinality of pg_stat_statements
SuperQ Mar 6, 2023
7e7366c
Update changelog and version for v0.12.0 release
sysadmind Mar 21, 2023
de1c3cc
Update exporter-toolkit
SuperQ Mar 21, 2023
4976a65
Merge pull request #775 from prometheus-community/superq/toolkit
SuperQ Mar 21, 2023
d8617df
Update common Prometheus files
prombot Mar 21, 2023
f9a1edb
Merge pull request #774 from sysadmind/prep-release-v0.12
sysadmind Mar 21, 2023
3fe5d25
Merge pull request #776 from prometheus-community/repo_sync
sysadmind Mar 23, 2023
1e3b177
Fix column type for pg_replication_slots
sysadmind Mar 23, 2023
dde6e6e
Merge pull request #777 from sysadmind/fix-replication-column-type
SuperQ Mar 23, 2023
6e2f8c3
Update versions listed in the README
SuperQ Mar 28, 2023
5f57b78
Merge pull request #781 from prometheus-community/superq/readme_versions
sysadmind Mar 29, 2023
a32ef40
Update README cli flags
sysadmind Mar 30, 2023
ac05e0b
Adjust log level for collector startup
sysadmind Mar 30, 2023
285462b
Merge pull request #784 from sysadmind/log-startup
sysadmind Mar 30, 2023
2391ad1
Merge pull request #783 from sysadmind/update-readme
sysadmind Mar 30, 2023
994e5cc
Merge pull request #765 from prometheus-community/superq/stat_statements
SuperQ Apr 13, 2023
20b1b75
Fix pg_setting different help values
khkhalifa Apr 16, 2023
8b661c9
Merge pull request #771 from khkhalifa/master
sysadmind Apr 23, 2023
0c04fc1
Supports alternate postgres:// prefix in URLs
mothershipper Apr 12, 2023
fb316ad
Merge pull request #787 from mothership/fix/mothershipper/support-alt…
sysadmind Apr 24, 2023
ef2bf61
Bump github.com/lib/pq from 1.10.7 to 1.10.9
dependabot[bot] May 1, 2023
425c493
Refactor collector descriptors
SuperQ Jun 1, 2023
2297ff8
Merge pull request #802 from prometheus-community/superq/descmap
SuperQ Jun 1, 2023
6e671f2
Merge pull request #792 from prometheus-community/dependabot/go_modul…
SuperQ Jun 1, 2023
4da97f7
Bump github.com/prometheus/common from 0.42.0 to 0.44.0
dependabot[bot] Jun 1, 2023
fab8e62
Update linting
SuperQ Jun 3, 2023
214d76f
Merge pull request #805 from prometheus-community/dependabot/go_modul…
SuperQ Jun 3, 2023
1eb4c99
Bump github.com/prometheus/exporter-toolkit from 0.9.1 to 0.10.0
dependabot[bot] Jun 3, 2023
5d5fae1
Merge pull request #807 from prometheus-community/superq/linting
sysadmind Jun 4, 2023
16430fc
Merge pull request #806 from prometheus-community/dependabot/go_modul…
SuperQ Jun 4, 2023
fe960c6
Move queries from queries.yaml to collectors (#801)
Sticksman Jun 8, 2023
4d41f89
Merge pull request #685 from sysadmind/pg-stat-database
sysadmind Jun 12, 2023
fe48601
Fix pg_stat_database collector
sysadmind Jun 12, 2023
3e585c4
Merge pull request #809 from sysadmind/stat_database_refactor
sysadmind Jun 13, 2023
99828de
Fix up collector registration (#812)
SuperQ Jun 13, 2023
3fc8b3a
Update release info for v0.12.1
sysadmind Jun 12, 2023
7dcf1dc
Deprecate extend queries feature (#811)
SuperQ Jun 13, 2023
1fb04e1
Merge pull request #810 from sysadmind/meta-v0.12.1
sysadmind Jun 13, 2023
3dd0aa6
Update common Prometheus files
prombot Jun 18, 2023
afbdb9b
Merge pull request #814 from prometheus-community/repo_sync
SuperQ Jun 19, 2023
c71d395
Deprecate additional database features
SuperQ Jun 19, 2023
5db7cfb
Merge pull request #815 from prometheus-community/superq/deprecate_da…
sysadmind Jun 21, 2023
db08eee
Release v0.13.0
SuperQ Jun 21, 2023
ab33346
Add the instance struct to handle connections
sysadmind Mar 30, 2023
d983d32
Merge pull request #785 from sysadmind/collector-instance
SuperQ Jun 22, 2023
f550f8f
Merge pull request #816 from prometheus-community/superq/0.13.0
SuperQ Jun 22, 2023
b070e45
chore: fix a few typos
Jun 23, 2023
6290786
Merge pull request #820 from atymchuk/fix-a-few-syntax-errors
SuperQ Jun 23, 2023
8d087f2
Bug fix: Make collector not fail on null values (#823)
Sticksman Jun 27, 2023
bf4e4fb
Release 0.13.1 (#824)
SuperQ Jun 27, 2023
6a1bb59
Fixed replication pgReplicationSlotQuery - now it's working correctly…
wwoytenko Jun 27, 2023
1a4e899
Migrate pg_locks to collector package (#817)
SuperQ Jun 27, 2023
030a2a9
Cleanup collectors (#826)
SuperQ Jun 27, 2023
e6ce2ec
Bug Fix: Fix lingering type issues (#828)
Sticksman Jun 27, 2023
dcf498e
Update common Prometheus files (#829)
prombot Jun 27, 2023
d920553
Fix replication collector
tomhughes Jul 3, 2023
d01184f
Merge pull request #854 from tomhughes/replication
sysadmind Jul 3, 2023
099d3dd
Add some more escapes to the query sanitizer
tomhughes Jul 4, 2023
2ca1798
Add a collector to gather metrics on WAL size
tomhughes Jul 4, 2023
cf67a47
Merge pull request #858 from tomhughes/wal
sysadmind Jul 5, 2023
a6012e0
Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 (#853)
dependabot[bot] Jul 5, 2023
2477aba
Fix untyped integer overflows on 32-bit archs (#857)
dswarbrick Jul 5, 2023
401711b
Bump github.com/smartystreets/goconvey from 1.8.0 to 1.8.1 (#852)
dependabot[bot] Jul 6, 2023
6b56e2f
Unpack postgres arrays for process idle times correctly (#855)
tomhughes Jul 6, 2023
a8b86cf
Include all idle processes in the process idle metrics
tomhughes Jul 4, 2023
5f917cc
Improve linting (#861)
SuperQ Jul 6, 2023
d776680
Update common Prometheus files (#860)
prombot Jul 6, 2023
c514fca
Update common Prometheus files
prombot Jul 6, 2023
9a9a429
Merge pull request #863 from prometheus-community/repo_sync
sysadmind Jul 6, 2023
4ac5481
Merge pull request #862 from tomhughes/idle-state
sysadmind Jul 6, 2023
4aa8cd4
Gitlab collector: Database wraparound collector and test (#834)
Sticksman Jul 14, 2023
12c12cf
Add a logger to stat_database collector to get better handle on error
Sticksman Jul 19, 2023
c3eec62
Merge pull request #871 from Sticksman/bugfix/add-logger-stat-database
sysadmind Jul 20, 2023
24a45f2
Update changelog for release 0.13.2 (#872)
sysadmind Jul 21, 2023
dc3e813
Gitlab Collector: Autovacuum collector and test (#840)
Sticksman Jul 21, 2023
2d7e152
Gitlab Collector: Wal Receiver Collector and Test (#844)
Sticksman Jul 21, 2023
74800f4
Gitlab collector: Xlog location collector and test (#849)
Sticksman Jul 21, 2023
f9277b0
Handle new pg_stat_statements column names (#874)
SuperQ Jul 25, 2023
716ac23
Fixup new pg_stats_statements query (#876)
SuperQ Jul 25, 2023
04bb60c
Add a multi-target example config (#890)
SuperQ Aug 15, 2023
b74852a
Delay database connection until scrape (#882)
sysadmind Aug 23, 2023
2402783
Bugfix: Make statsreset nullable (#877)
Sticksman Aug 24, 2023
ce74dae
Gitlab Collector: User Index io stats collector and test (#845)
Sticksman Aug 24, 2023
ce4ee05
Update README to reflect changes made in #828 (#894)
Sayrus Aug 24, 2023
5890879
Gitlab Collector: Long running transactions collector and test (#836)
Sticksman Aug 25, 2023
a181fba
Update common Prometheus files (#900)
prombot Sep 3, 2023
68ea167
Fix a connection leak (#902)
albix Sep 6, 2023
dbc7b0b
Fix cross-compilation command in README.md (#903)
divergentdave Sep 8, 2023
0b6d986
fix pg_replication_lag_seconds (#895)
IamLuksha Sep 8, 2023
31ef4ed
stat_user_tables: Add total size metric (#904)
divergentdave Sep 12, 2023
4e521d4
Fix bugs mentioned in #908 (#910)
sysadmind Sep 13, 2023
add5b86
Update common Prometheus files (#913)
prombot Sep 17, 2023
c06e57d
Add changelog for v0.14 (#906)
sysadmind Sep 20, 2023
e3eaa91
Adds 1kB and 2kB units (#915)
Eric-Tyrrell22 Sep 20, 2023
30d7d25
Add error log when probe collector creation fails (#918)
sysadmind Sep 21, 2023
51415a0
Fix test build failures on 32-bit arch again (#919)
dswarbrick Sep 21, 2023
5e24d43
Add 32-bit testing to CI (#920)
SuperQ Sep 21, 2023
69fc35b
Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#925)
dependabot[bot] Oct 2, 2023
f0f051c
Update common Prometheus files (#926)
prombot Oct 8, 2023
2a5692c
Adjust collector to use separate connection per scrape (#931)
sysadmind Oct 10, 2023
e2892a7
Bump golang.org/x/net from 0.10.0 to 0.17.0 (#936)
dependabot[bot] Oct 16, 2023
68c176b
Release v0.15.0 (#944)
SuperQ Oct 27, 2023
94b0651
Update common Prometheus files (#951)
prombot Nov 15, 2023
f0ea016
Update common Prometheus files (#963)
prombot Nov 23, 2023
ae1375b
pg_replication_slot: add slot type label (#960)
shamil Nov 23, 2023
34f5443
Bump github.com/prometheus/common from 0.44.0 to 0.45.0 (#948)
dependabot[bot] Nov 23, 2023
5ceae7f
Bump github.com/prometheus/client_model (#949)
dependabot[bot] Nov 24, 2023
f5b613a
pg_stat_database: added support for `active_time` counter (#961)
sitole Nov 28, 2023
825cc8a
Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#988)
dependabot[bot] Dec 21, 2023
9cfa132
Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 (#993)
dependabot[bot] Jan 2, 2024
f98834a
use Info level for excluded databases log message (#1003)
keegancsmith Feb 14, 2024
f6ac7b7
MERGE upstream forked repo
jaimeyh Feb 19, 2024
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
12 changes: 7 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@
version: 2.1

orbs:
prometheus: prometheus/prometheus@0.16.0
prometheus: prometheus/prometheus@0.17.1

executors:
# This must match .promu.yml.
golang:
docker:
- image: cimg/go:1.18
- image: cimg/go:1.21

jobs:
test:
executor: golang

steps:
- prometheus/setup_environment
- run: GOHOSTARCH=386 GOARCH=386 make test
- run: make
- prometheus/store_artifact:
file: postgres_exporter

integration:
docker:
- image: cimg/go:1.18
- image: cimg/go:1.20
- image: << parameters.postgres_image >>
environment:
POSTGRES_DB: circle_test
Expand Down Expand Up @@ -56,11 +57,12 @@ workflows:
matrix:
parameters:
postgres_image:
- circleci/postgres:10
- circleci/postgres:11
- circleci/postgres:12
- circleci/postgres:13
- cimg/postgres:14.1
- cimg/postgres:14.9
- cimg/postgres:15.4
- cimg/postgres:16.0
- prometheus/build:
name: build
parallelism: 3
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# This action is synced from https://github.com/prometheus/prometheus
name: golangci-lint
on:
push:
Expand All @@ -16,15 +18,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: install Go
uses: actions/setup-go@v4
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: 1.18.x
go-version: 1.21.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/golangci-lint-action@v3.4.0
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
version: v1.52.2
version: v1.54.2
15 changes: 14 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
linters:
enable:
- misspell
- revive

issues:
exclude-rules:
- path: _test.go
Expand All @@ -7,4 +12,12 @@ issues:

linters-settings:
errcheck:
exclude: scripts/errcheck_excludes.txt
exclude-functions:
# Never check for logger errors.
- (github.com/go-kit/log.Logger).Log
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: true
3 changes: 1 addition & 2 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
go:
# This must match .circle/config.yml.
version: 1.18
version: 1.21
repository:
path: github.com/prometheus-community/postgres_exporter
build:
binaries:
- name: postgres_exporter
path: ./cmd/postgres_exporter
flags: -a -tags 'netgo static_build'
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
Expand Down
7 changes: 1 addition & 6 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,4 @@ rules:
config/testdata/section_key_dup.bad.yml
line-length: disable
truthy:
ignore: |
.github/workflows/codeql-analysis.yml
.github/workflows/funcbench.yml
.github/workflows/fuzzing.yml
.github/workflows/prombench.yml
.github/workflows/golangci-lint.yml
check-keys: false
68 changes: 66 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,66 @@
## master / unreleased
## 0.15.0 / 2023-10-27

## 0.12.0-rc.0 / 2022-08-26
* [ENHANCEMENT] Add 1kB and 2kB units #915
* [BUGFIX] Add error log when probe collector creation fails #918
* [BUGFIX] Fix test build failures on 32-bit arch #919
* [BUGFIX] Adjust collector to use separate connection per scrape #936

## 0.14.0 / 2023-09-11

* [CHANGE] Add `state` label to pg_process_idle_seconds #862
* [CHANGE] Change database connections to one per scrape #882 #902
* [ENHANCEMENT] Add wal collector #858
* [ENHANCEMENT] Add database_wraparound collector #834
* [ENHANCEMENT] Add stat_activity_autovacuum collector #840
* [ENHANCEMENT] Add stat_wal_receiver collector #844
* [ENHANCEMENT] Add xlog_location collector #849
* [ENHANCEMENT] Add statio_user_indexes collector #845
* [ENHANCEMENT] Add long_running_transactions collector #836
* [ENHANCEMENT] Add pg_stat_user_tables_size_bytes metric #904
* [BUGFIX] Fix tests on 32-bit systems #857
* [BUGFIX] Fix pg_stat_statements metrics on Postgres 13+ #874 #876
* [BUGFIX] Fix pg_stat_database metrics for NULL stats_reset #877
* [BUGFIX] Fix pg_replication_lag_seconds on Postgres 10+ when master is idle #895

## 0.13.2 / 2023-07-21

* [BUGFIX] Fix type issues on pg_postmaster metrics #828
* [BUGFIX] Fix pg_replication collector instantiation #854
* [BUGFIX] Fix pg_process_idle metrics #855

## 0.13.1 / 2023-06-27

* [BUGFIX] Make collectors not fail on null values #823

## 0.13.0 / 2023-06-21

BREAKING CHANGES:

Please note, the following features are deprecated and may be removed in a future release:
- `auto-discover-databases`
- `extend.query-path`
- `constantLabels`
- `exclude-databases`
- `include-databases`

This exporter is meant to monitor PostgresSQL servers, not the user data/databases. If
you need a generic SQL report exporter https://github.com/burningalchemist/sql_exporter
is recommended.

* [CHANGE] Adjust log level for collector startup #784
* [CHANGE] Move queries from queries.yaml to collectors #801
* [CHANGE] Deprecate extend queries feature #811
* [CHANGE] Deprecate additional database features #815
* [CHANGE] Convert pg_stat_database to new collector #685
* [ENHANCEMENT] Supports alternate postgres:// prefix in URLs #787
* [BUGFIX] Fix pg_setting different help values #771
* [BUGFIX] Fix column type for pg_replication_slots #777
* [BUGFIX] Fix pg_stat_database collector #809

## 0.12.1 / 2023-06-12
* [BUGFIX] Fix column type for pg_replication_slots #777

## 0.12.0 / 2023-03-21

BREAKING CHANGES:

Expand All @@ -10,7 +70,11 @@ PostgreSQL servers from a single exporter by passing the target via URL
params. See the Multi-Target Support section of the README.

* [CHANGE] Add multi-target support #618
* [CHANGE] Add usename and application_name to pg_stat_activity metrics #673
* [FEATURE] Add replication metrics from pg_replication_slots #747
* [BUGFIX] Add dsn type for handling datasources #678
* [BUGFIX] Add 64kB unit for postgres 15 #740
* [BUGFIX] Add 4kB unit for postgres compiled with small blocks #699

## 0.11.1 / 2022-08-01

Expand Down
22 changes: 12 additions & 10 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ endif
GOTEST := $(GO) test
GOTEST_DIR :=
ifneq ($(CIRCLE_JOB),)
ifneq ($(shell which gotestsum),)
ifneq ($(shell command -v gotestsum > /dev/null),)
GOTEST_DIR := test-results
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
endif
endif

PROMU_VERSION ?= 0.13.0
PROMU_VERSION ?= 0.15.0
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz

SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.49.0
GOLANGCI_LINT_VERSION ?= v1.54.2
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
Expand Down Expand Up @@ -91,6 +91,8 @@ BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))

SANITIZED_DOCKER_IMAGE_TAG := $(subst +,-,$(DOCKER_IMAGE_TAG))

ifeq ($(GOHOSTARCH),amd64)
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
# Only supported on amd64
Expand Down Expand Up @@ -176,7 +178,7 @@ endif
.PHONY: common-yamllint
common-yamllint:
@echo ">> running yamllint on all YAML files in the repository"
ifeq (, $(shell which yamllint))
ifeq (, $(shell command -v yamllint > /dev/null))
@echo "yamllint not installed so skipping"
else
yamllint .
Expand Down Expand Up @@ -205,7 +207,7 @@ common-tarball: promu
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
common-docker: $(BUILD_DOCKER_ARCHS)
$(BUILD_DOCKER_ARCHS): common-docker-%:
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \
-f $(DOCKERFILE_PATH) \
--build-arg ARCH="$*" \
--build-arg OS="linux" \
Expand All @@ -214,19 +216,19 @@ $(BUILD_DOCKER_ARCHS): common-docker-%:
.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)"
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)"

DOCKER_MAJOR_VERSION_TAG = $(firstword $(subst ., ,$(shell cat VERSION)))
.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
$(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"

.PHONY: common-docker-manifest
common-docker-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(DOCKER_IMAGE_TAG))
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(SANITIZED_DOCKER_IMAGE_TAG))
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)"

.PHONY: promu
promu: $(PROMU)
Expand Down
Loading