Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Commit 575d68c

Browse files
author
Julien Pivotto
authored
Move to github action (#250)
* Move to github action Signed-off-by: Julien Pivotto <[email protected]>
1 parent 2cc962d commit 575d68c

File tree

7 files changed

+128
-73
lines changed

7 files changed

+128
-73
lines changed

.circleci/config.yml

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,33 @@
1+
---
2+
# Prometheus has switched to GitHub action.
3+
# Circle CI is not disabled repository-wise so that previous pull requests
4+
# continue working.
5+
# This file does not generate any CircleCI workflow.
6+
17
version: 2.1
2-
orbs:
3-
prometheus: prometheus/[email protected]
4-
jobs:
5-
test:
6-
# Whenever the Go version is updated here, .promu.yml
7-
# should also be updated.
8+
9+
executors:
10+
golang:
811
docker:
9-
- image: cimg/go:1.18
12+
- image: busybox
13+
14+
jobs:
15+
noopjob:
16+
executor: golang
17+
1018
steps:
11-
- prometheus/setup_environment
12-
- setup_remote_docker
13-
- run: make
14-
- prometheus/store_artifact:
15-
file: haproxy_exporter
19+
- run:
20+
command: "true"
21+
1622
workflows:
1723
version: 2
18-
haproxy_exporter:
24+
prometheus:
1925
jobs:
20-
- test:
21-
filters:
22-
tags:
23-
only: /.*/
24-
- prometheus/build:
25-
name: build
26-
filters:
27-
tags:
28-
only: /.*/
29-
- prometheus/publish_main:
30-
context: org-context
31-
requires:
32-
- test
33-
- build
34-
filters:
35-
branches:
36-
only: main
37-
- prometheus/publish_release:
38-
context: org-context
39-
requires:
40-
- test
41-
- build
26+
- noopjob
27+
triggers:
28+
- schedule:
29+
cron: "0 0 30 2 *"
4230
filters:
43-
tags:
44-
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
4531
branches:
46-
ignore: /.*/
32+
only:
33+
- main

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: CI
3+
on:
4+
pull_request:
5+
push:
6+
jobs:
7+
test:
8+
name: Test
9+
runs-on: ubuntu-latest
10+
# Whenever the Go version is updated here, .promu.yml
11+
# should also be updated.
12+
container:
13+
image: quay.io/prometheus/golang-builder:1.19-base
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: prometheus/[email protected]
17+
- uses: ./.github/promci/actions/setup_environment
18+
- run: make
19+
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
thread: [ 0, 1, 2 ]
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: prometheus/[email protected]
29+
- uses: ./.github/promci/actions/build
30+
with:
31+
parallelism: 3
32+
thread: ${{ matrix.thread }}
33+
34+
golangci:
35+
name: golangci-lint
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v3
40+
- name: Install Go
41+
uses: actions/setup-go@v3
42+
with:
43+
go-version: '<1.19'
44+
- name: Lint
45+
uses: golangci/[email protected]
46+
with:
47+
version: v1.49.0
48+
49+
publish_main:
50+
name: Publish main branch artifacts
51+
runs-on: ubuntu-latest
52+
needs: [test, build]
53+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
54+
steps:
55+
- uses: actions/checkout@v3
56+
- uses: prometheus/[email protected]
57+
- uses: ./.github/promci/actions/publish_main
58+
with:
59+
docker_hub_login: ${{ secrets.docker_hub_login }}
60+
docker_hub_password: ${{ secrets.docker_hub_password }}
61+
quay_io_login: ${{ secrets.quay_io_login }}
62+
quay_io_password: ${{ secrets.quay_io_password }}
63+
64+
publish_release:
65+
name: Publish release arfefacts
66+
runs-on: ubuntu-latest
67+
needs: [test, build]
68+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
69+
steps:
70+
- uses: actions/checkout@v3
71+
- uses: prometheus/[email protected]
72+
- uses: ./.github/promci/actions/publish_release
73+
with:
74+
docker_hub_login: ${{ secrets.docker_hub_login }}
75+
docker_hub_password: ${{ secrets.docker_hub_password }}
76+
quay_io_login: ${{ secrets.quay_io_login }}
77+
quay_io_password: ${{ secrets.quay_io_password }}

.github/workflows/golangci-lint.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.yamllint

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
braces:
6+
max-spaces-inside: 1
7+
level: error
8+
brackets:
9+
max-spaces-inside: 1
10+
level: error
11+
commas: disable
12+
comments: disable
13+
comments-indentation: disable
14+
document-start: disable
15+
indentation:
16+
spaces: consistent
17+
indent-sequences: consistent
18+
line-length: disable
19+
truthy:
20+
ignore: |
21+
.github/workflows/ci.yml

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ all:: vet checkmetrics common-all
1919

2020
include Makefile.common
2121

22-
PROMTOOL_DOCKER_IMAGE ?= $(shell docker pull -q quay.io/prometheus/prometheus:latest || echo quay.io/prometheus/prometheus:latest)
23-
PROMTOOL ?= docker run -i --rm -w "$(PWD)" -v "$(PWD):$(PWD)" --entrypoint promtool $(PROMTOOL_DOCKER_IMAGE)
22+
PROMETHEUS_VERSION=2.39.1
23+
PROMTOOL ?= /tmp/prometheus-$(PROMETHEUS_VERSION).linux-amd64/promtool
2424

2525
.PHONY: checkmetrics
2626
checkmetrics:
2727
@echo ">> checking metrics for correctness"
28+
if ! test -x $(PROMTOOL); then curl -sL -o - https://github.com/prometheus/prometheus/releases/download/v$(PROMETHEUS_VERSION)/prometheus-$(PROMETHEUS_VERSION).linux-amd64.tar.gz | tar -C /tmp -xzf - prometheus-$(PROMETHEUS_VERSION).linux-amd64/promtool; fi
2829
for file in test/*.metrics; do $(PROMTOOL) check metrics < $$file || exit 1; done

Makefile.common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
8383

8484
GOLANGCI_LINT :=
8585
GOLANGCI_LINT_OPTS ?=
86-
GOLANGCI_LINT_VERSION ?= v1.45.2
86+
GOLANGCI_LINT_VERSION ?= v1.49.0
8787
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
8888
# windows isn't included here because of the path separator being different.
8989
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))

haproxy_exporter_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ func TestServerWithoutChecks(t *testing.T) {
8989

9090
// TestServerBrokenCSV ensures bugs in CSV format are handled gracefully. List of known bugs:
9191
//
92-
// * http://permalink.gmane.org/gmane.comp.web.haproxy/26561
93-
//
92+
// - http://permalink.gmane.org/gmane.comp.web.haproxy/26561
9493
func TestServerBrokenCSV(t *testing.T) {
9594
const data = `foo,FRONTEND,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,0,0,5007,0,,1,8,1,,0,,2,0,,0,L4OK,,0,,,,,,,0,,,,0,0,,,,,,,,,,,
9695
foo,bug-missing-comma,0,0,0,0,,0,0,0,,0,,0,0,0,0,DRAIN (agent)1,1,0,0,0,5007,0,,1,8,1,,0,,2,0,,0,L4OK,,0,,,,,,,0,,,,0,0,,,,,,,,,,,

0 commit comments

Comments
 (0)