Skip to content

Commit fafbd96

Browse files
authored
Update for Prometheus Community (#312)
* Update for Prometheus Community Update various files for Prometheus Community * Use Prometheus common Makefile setup. * Add license headers in Go files. * Update Go module path. * Enable dependabot. * Update GitHub Actions. * Fixup golangci-lint errors. --------- Signed-off-by: SuperQ <[email protected]>
1 parent 3ce77d6 commit fafbd96

File tree

95 files changed

+1505
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1505
-348
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"

.github/semantic.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
targetUrl: "https://github.com/bluecmd/fortigate_exporter/blob/master/CONTRIBUTING.md#pull-request-checklist"
1+
targetUrl: "https://github.com/prometheus-community/fortigate_exporter/blob/master/CONTRIBUTING.md#pull-request-checklist"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Push README to Docker Hub
3+
on:
4+
push:
5+
paths:
6+
- "README.md"
7+
- "README-containers.md"
8+
- ".github/workflows/container_description.yml"
9+
branches: [ main, master ]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
PushDockerHubReadme:
16+
runs-on: ubuntu-latest
17+
name: Push README to Docker Hub
18+
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
19+
steps:
20+
- name: git checkout
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
- name: Set docker hub repo name
23+
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
24+
- name: Push README to Dockerhub
25+
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
26+
env:
27+
DOCKER_USER: ${{ secrets.DOCKER_HUB_LOGIN }}
28+
DOCKER_PASS: ${{ secrets.DOCKER_HUB_PASSWORD }}
29+
with:
30+
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
31+
provider: dockerhub
32+
short_description: ${{ env.DOCKER_REPO_NAME }}
33+
# Empty string results in README-containers.md being pushed if it
34+
# exists. Otherwise, README.md is pushed.
35+
readme_file: ''
36+
37+
PushQuayIoReadme:
38+
runs-on: ubuntu-latest
39+
name: Push README to quay.io
40+
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
41+
steps:
42+
- name: git checkout
43+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44+
- name: Set quay.io org name
45+
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
46+
- name: Set quay.io repo name
47+
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
48+
- name: Push README to quay.io
49+
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
50+
env:
51+
DOCKER_APIKEY: ${{ secrets.QUAY_IO_API_TOKEN }}
52+
with:
53+
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
54+
provider: quay
55+
# Empty string results in README-containers.md being pushed if it
56+
# exists. Otherwise, README.md is pushed.
57+
readme_file: ''

.github/workflows/docker.yml

-19
This file was deleted.

.github/workflows/go.yml

-41
This file was deleted.

.github/workflows/golangci-lint.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
# This action is synced from https://github.com/prometheus/prometheus
3+
name: golangci-lint
4+
on:
5+
push:
6+
paths:
7+
- "go.sum"
8+
- "go.mod"
9+
- "**.go"
10+
- "scripts/errcheck_excludes.txt"
11+
- ".github/workflows/golangci-lint.yml"
12+
- ".golangci.yml"
13+
pull_request:
14+
15+
permissions: # added using https://github.com/step-security/secure-repo
16+
contents: read
17+
18+
jobs:
19+
golangci:
20+
permissions:
21+
contents: read # for actions/checkout to fetch code
22+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
23+
name: lint
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
- name: Install Go
29+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
30+
with:
31+
go-version: 1.23.x
32+
- name: Install snmp_exporter/generator dependencies
33+
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
34+
if: github.repository == 'prometheus/snmp_exporter'
35+
- name: Lint
36+
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0
37+
with:
38+
args: --verbose
39+
version: v1.63.4

.github/workflows/release.yml

-52
This file was deleted.

.gitignore

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
.*.sw?
1+
# Build
2+
/.build
3+
/.release
4+
/.tarballs
25

3-
# IDEs
4-
.idea
5-
6-
# artifacts
7-
target
6+
# Artifacts
87
fortigate_exporter
8+
*.exe
99

1010
# coverage
1111
cover.out

.golangci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
linters:
3+
enable:
4+
- misspell
5+
- sloglint
6+
7+
issues:
8+
exclude-rules:
9+
- path: _test.go
10+
linters:
11+
- errcheck

.promu.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
go:
2+
# This must match .circle/config.yml.
3+
version: 1.23
4+
repository:
5+
path: github.com/prometheus-community/fortigate_exporter
6+
build:
7+
binaries:
8+
- name: fortigate_exporter
9+
ldflags: |
10+
-X github.com/prometheus/common/version.Version={{.Version}}
11+
-X github.com/prometheus/common/version.Revision={{.Revision}}
12+
-X github.com/prometheus/common/version.Branch={{.Branch}}
13+
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
14+
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
15+
tarball:
16+
files:
17+
- LICENSE
18+
- NOTICE

.releaserc.yml

-20
This file was deleted.

.yamllint

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
extends: default
3+
ignore: |
4+
**/node_modules
5+
6+
rules:
7+
braces:
8+
max-spaces-inside: 1
9+
level: error
10+
brackets:
11+
max-spaces-inside: 1
12+
level: error
13+
commas: disable
14+
comments: disable
15+
comments-indentation: disable
16+
document-start: disable
17+
indentation:
18+
spaces: consistent
19+
indent-sequences: consistent
20+
key-duplicates:
21+
ignore: |
22+
config/testdata/section_key_dup.bad.yml
23+
line-length: disable
24+
truthy:
25+
check-keys: false

CONTRIBUTING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ Fortigate exporter uses GitHub to manage reviews of pull requests.
44

55
* If you are a new contributor see: [Steps to Contribute](#steps-to-contribute)
66

7-
* If you have a trivial fix or improvement, go ahead and create a pull request,
8-
addressing it to @bluecmd or @secustor.
7+
* If you have a trivial fix or improvement, go ahead and create a pull request.
98

109
* If you plan to do something more impacting, first discuss your ideas
11-
in our [chat room](https://matrix.to/#/#fortigate_exporter:matrix.org) or the [discussions](https://github.com/bluecmd/fortigate_exporter/discussions/landing) page.
10+
in our [chat room](https://matrix.to/#/#fortigate_exporter:matrix.org) or the [discussions](https://github.com/prometheus-community/fortigate_exporter/discussions/landing) page.
1211
This will avoid unnecessary work and surely give you and us a good deal
1312
of inspiration.
1413

Dockerfile

+12-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
# Build using the minimum supported Golang version (match go.mod)
2-
FROM golang:1.18 as builder
3-
4-
WORKDIR /build
5-
6-
COPY . .
7-
RUN go get -v -t -d ./...
8-
RUN make build
9-
10-
FROM scratch
11-
WORKDIR /opt/fortigate_exporter
12-
13-
COPY --from=builder /build/target/fortigate-exporter .
14-
COPY --from=builder /etc/ssl/certs/ca-certificates.crt .
15-
ENV SSL_CERT_DIR=/opt/fortigate_exporter
16-
17-
EXPOSE 9710
18-
ENTRYPOINT ["./fortigate-exporter"]
19-
CMD ["-auth-file", "/config/fortigate-key.yaml"]
1+
ARG ARCH="amd64"
2+
ARG OS="linux"
3+
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:glibc
4+
LABEL maintainer="The Prometheus Authors <[email protected]>"
5+
6+
ARG ARCH="amd64"
7+
ARG OS="linux"
8+
COPY .build/${OS}-${ARCH}/fortigate_exporter /bin/fortigate_exporter
9+
10+
EXPOSE 9710
11+
USER nobody
12+
ENTRYPOINT [ "/bin/fortigate_exporter" ]

MAINTAINERS.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Ben Kochie <[email protected]> @SuperQ

0 commit comments

Comments
 (0)