Codebase list prometheus-haproxy-exporter / 575d68c
Move to github action (#250) * Move to github action Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu> Julien Pivotto authored 1 year, 6 months ago GitHub committed 1 year, 6 months ago
7 changed file(s) with 128 addition(s) and 73 deletion(s). Raw diff Collapse all Expand all
0 ---
1 # Prometheus has switched to GitHub action.
2 # Circle CI is not disabled repository-wise so that previous pull requests
3 # continue working.
4 # This file does not generate any CircleCI workflow.
5
06 version: 2.1
1 orbs:
2 prometheus: prometheus/prometheus@0.16.0
7
8 executors:
9 golang:
10 docker:
11 - image: busybox
12
313 jobs:
4 test:
5 # Whenever the Go version is updated here, .promu.yml
6 # should also be updated.
7 docker:
8 - image: cimg/go:1.18
14 noopjob:
15 executor: golang
16
917 steps:
10 - prometheus/setup_environment
11 - setup_remote_docker
12 - run: make
13 - prometheus/store_artifact:
14 file: haproxy_exporter
18 - run:
19 command: "true"
20
1521 workflows:
1622 version: 2
17 haproxy_exporter:
23 prometheus:
1824 jobs:
19 - test:
20 filters:
21 tags:
22 only: /.*/
23 - prometheus/build:
24 name: build
25 filters:
26 tags:
27 only: /.*/
28 - prometheus/publish_main:
29 context: org-context
30 requires:
31 - test
32 - build
25 - noopjob
26 triggers:
27 - schedule:
28 cron: "0 0 30 2 *"
3329 filters:
3430 branches:
35 only: main
36 - prometheus/publish_release:
37 context: org-context
38 requires:
39 - test
40 - build
41 filters:
42 tags:
43 only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
44 branches:
45 ignore: /.*/
31 only:
32 - main
0 ---
1 name: CI
2 on:
3 pull_request:
4 push:
5 jobs:
6 test:
7 name: Test
8 runs-on: ubuntu-latest
9 # Whenever the Go version is updated here, .promu.yml
10 # should also be updated.
11 container:
12 image: quay.io/prometheus/golang-builder:1.19-base
13 steps:
14 - uses: actions/checkout@v3
15 - uses: prometheus/promci@v0.0.2
16 - uses: ./.github/promci/actions/setup_environment
17 - run: make
18
19 build:
20 name: Build
21 runs-on: ubuntu-latest
22 strategy:
23 matrix:
24 thread: [ 0, 1, 2 ]
25 steps:
26 - uses: actions/checkout@v3
27 - uses: prometheus/promci@v0.0.2
28 - uses: ./.github/promci/actions/build
29 with:
30 parallelism: 3
31 thread: ${{ matrix.thread }}
32
33 golangci:
34 name: golangci-lint
35 runs-on: ubuntu-latest
36 steps:
37 - name: Checkout repository
38 uses: actions/checkout@v3
39 - name: Install Go
40 uses: actions/setup-go@v3
41 with:
42 go-version: '<1.19'
43 - name: Lint
44 uses: golangci/golangci-lint-action@v3.2.0
45 with:
46 version: v1.49.0
47
48 publish_main:
49 name: Publish main branch artifacts
50 runs-on: ubuntu-latest
51 needs: [test, build]
52 if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
53 steps:
54 - uses: actions/checkout@v3
55 - uses: prometheus/promci@v0.0.2
56 - uses: ./.github/promci/actions/publish_main
57 with:
58 docker_hub_login: ${{ secrets.docker_hub_login }}
59 docker_hub_password: ${{ secrets.docker_hub_password }}
60 quay_io_login: ${{ secrets.quay_io_login }}
61 quay_io_password: ${{ secrets.quay_io_password }}
62
63 publish_release:
64 name: Publish release arfefacts
65 runs-on: ubuntu-latest
66 needs: [test, build]
67 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
68 steps:
69 - uses: actions/checkout@v3
70 - uses: prometheus/promci@v0.0.2
71 - uses: ./.github/promci/actions/publish_release
72 with:
73 docker_hub_login: ${{ secrets.docker_hub_login }}
74 docker_hub_password: ${{ secrets.docker_hub_password }}
75 quay_io_login: ${{ secrets.quay_io_login }}
76 quay_io_password: ${{ secrets.quay_io_password }}
+0
-30
.github/workflows/golangci-lint.yml less more
0 name: golangci-lint
1 on:
2 push:
3 paths:
4 - "go.sum"
5 - "go.mod"
6 - "**.go"
7 - "scripts/errcheck_excludes.txt"
8 - ".github/workflows/golangci-lint.yml"
9 - ".golangci.yml"
10 pull_request:
11
12 jobs:
13 golangci:
14 name: lint
15 runs-on: ubuntu-latest
16 steps:
17 - name: Checkout repository
18 uses: actions/checkout@v3
19 - name: install Go
20 uses: actions/setup-go@v2
21 with:
22 go-version: 1.18.x
23 - name: Install snmp_exporter/generator dependencies
24 run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
25 if: github.repository == 'prometheus/snmp_exporter'
26 - name: Lint
27 uses: golangci/golangci-lint-action@v3.2.0
28 with:
29 version: v1.45.2
0 ---
1 extends: default
2
3 rules:
4 braces:
5 max-spaces-inside: 1
6 level: error
7 brackets:
8 max-spaces-inside: 1
9 level: error
10 commas: disable
11 comments: disable
12 comments-indentation: disable
13 document-start: disable
14 indentation:
15 spaces: consistent
16 indent-sequences: consistent
17 line-length: disable
18 truthy:
19 ignore: |
20 .github/workflows/ci.yml
1818
1919 include Makefile.common
2020
21 PROMTOOL_DOCKER_IMAGE ?= $(shell docker pull -q quay.io/prometheus/prometheus:latest || echo quay.io/prometheus/prometheus:latest)
22 PROMTOOL ?= docker run -i --rm -w "$(PWD)" -v "$(PWD):$(PWD)" --entrypoint promtool $(PROMTOOL_DOCKER_IMAGE)
21 PROMETHEUS_VERSION=2.39.1
22 PROMTOOL ?= /tmp/prometheus-$(PROMETHEUS_VERSION).linux-amd64/promtool
2323
2424 .PHONY: checkmetrics
2525 checkmetrics:
2626 @echo ">> checking metrics for correctness"
27 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
2728 for file in test/*.metrics; do $(PROMTOOL) check metrics < $$file || exit 1; done
8282
8383 GOLANGCI_LINT :=
8484 GOLANGCI_LINT_OPTS ?=
85 GOLANGCI_LINT_VERSION ?= v1.45.2
85 GOLANGCI_LINT_VERSION ?= v1.49.0
8686 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
8787 # windows isn't included here because of the path separator being different.
8888 ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
8888
8989 // TestServerBrokenCSV ensures bugs in CSV format are handled gracefully. List of known bugs:
9090 //
91 // * http://permalink.gmane.org/gmane.comp.web.haproxy/26561
92 //
91 // - http://permalink.gmane.org/gmane.comp.web.haproxy/26561
9392 func TestServerBrokenCSV(t *testing.T) {
9493 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,,,,,,,,,,,
9594 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,,,,,,,,,,,