Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dfa41da8e | |||
| e4f6d8cafb | |||
| 1b1413a632 |
88
.drone.yml
88
.drone.yml
@@ -1,88 +0,0 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: kubernetes
|
|
||||||
name: default
|
|
||||||
|
|
||||||
environment:
|
|
||||||
GOCACHE: /cache/pkg/cache
|
|
||||||
GOMODCACHE: /cache/pkg/mod
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: fetch-tags
|
|
||||||
image: alpine/git
|
|
||||||
commands:
|
|
||||||
- git fetch --tags
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 250
|
|
||||||
memory: 50MiB
|
|
||||||
limits:
|
|
||||||
cpu: 250
|
|
||||||
memory: 100MiB
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
image: golang:1.25
|
|
||||||
pull: always
|
|
||||||
volumes:
|
|
||||||
- name: go
|
|
||||||
path: /go
|
|
||||||
- name: gopkg
|
|
||||||
path: /cache
|
|
||||||
commands:
|
|
||||||
- go test -v ./...
|
|
||||||
- go build ./...
|
|
||||||
|
|
||||||
- name: goreleaser
|
|
||||||
image: golang:1.25
|
|
||||||
pull: always
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 6000
|
|
||||||
memory: 1024MiB
|
|
||||||
limits:
|
|
||||||
cpu: 10000
|
|
||||||
memory: 4096MiB
|
|
||||||
volumes:
|
|
||||||
- name: go
|
|
||||||
path: /go
|
|
||||||
- name: gopkg
|
|
||||||
path: /cache
|
|
||||||
environment:
|
|
||||||
# GITHUB_TOKEN:
|
|
||||||
# from_secret: GITHUB_TOKEN
|
|
||||||
commands:
|
|
||||||
- ./scripts/run-goreleaser
|
|
||||||
depends_on: [test]
|
|
||||||
|
|
||||||
- name: docker
|
|
||||||
image: harbor.ntppool.org/ntppool/drone-kaniko:main
|
|
||||||
pull: always
|
|
||||||
volumes:
|
|
||||||
- name: go
|
|
||||||
path: /go
|
|
||||||
- name: gopkg
|
|
||||||
path: /cache
|
|
||||||
settings:
|
|
||||||
repo: ntppool/data-api
|
|
||||||
registry: harbor.ntppool.org
|
|
||||||
auto_tag: true
|
|
||||||
tags: SHA7,${DRONE_SOURCE_BRANCH}
|
|
||||||
cache: true
|
|
||||||
username:
|
|
||||||
from_secret: harbor_username
|
|
||||||
password:
|
|
||||||
from_secret: harbor_password
|
|
||||||
depends_on: [goreleaser]
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: go
|
|
||||||
temp: {}
|
|
||||||
- name: gopkg
|
|
||||||
claim:
|
|
||||||
name: go-pkg
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: signature
|
|
||||||
hmac: 7f4f57140394a1c3a34e4d23188edda3cd95359dacf6d0abfa45bda3afff692f
|
|
||||||
|
|
||||||
...
|
|
||||||
69
.woodpecker.yaml
Normal file
69
.woodpecker.yaml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
when:
|
||||||
|
- event: [push, pull_request, tag, manual]
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git
|
||||||
|
settings:
|
||||||
|
tags: true
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- &go_env
|
||||||
|
GOMODCACHE: /go/pkg/mod
|
||||||
|
GOCACHE: /go/pkg/cache
|
||||||
|
- &go_volumes
|
||||||
|
- go-pkg:/go/pkg
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: golang:1.26
|
||||||
|
pull: true
|
||||||
|
environment: *go_env
|
||||||
|
volumes: *go_volumes
|
||||||
|
commands:
|
||||||
|
- go test -v ./...
|
||||||
|
- go build ./...
|
||||||
|
|
||||||
|
- name: goreleaser
|
||||||
|
image: golang:1.26
|
||||||
|
pull: true
|
||||||
|
environment: *go_env
|
||||||
|
volumes: *go_volumes
|
||||||
|
commands:
|
||||||
|
- ./scripts/run-goreleaser
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 6000
|
||||||
|
memory: 1024Mi
|
||||||
|
limits:
|
||||||
|
cpu: 10000
|
||||||
|
memory: 4096Mi
|
||||||
|
depends_on: [test]
|
||||||
|
|
||||||
|
- name: generate-tags
|
||||||
|
image: ghcr.io/abh/woodpecker-docker-tags-plugin:sha-8a3bd7c
|
||||||
|
settings:
|
||||||
|
tags: |
|
||||||
|
branch
|
||||||
|
sha
|
||||||
|
semver --auto
|
||||||
|
edge -v latest
|
||||||
|
when:
|
||||||
|
- event: [push, tag, manual]
|
||||||
|
depends_on: [goreleaser]
|
||||||
|
|
||||||
|
- name: docker
|
||||||
|
image: woodpeckerci/plugin-kaniko
|
||||||
|
settings:
|
||||||
|
registry: harbor.ntppool.org
|
||||||
|
repo: ntppool/data-api
|
||||||
|
cache: true
|
||||||
|
username:
|
||||||
|
from_secret: harbor_username
|
||||||
|
password:
|
||||||
|
from_secret: harbor_password
|
||||||
|
when:
|
||||||
|
- event: [push, tag, manual]
|
||||||
|
depends_on: [goreleaser, generate-tags]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package chdb
|
package chdb
|
||||||
|
|
||||||
// queries to the GeoDNS database
|
// queries to the DNS database
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -208,7 +208,7 @@ func (d *ClickHouse) DNSQueries(ctx context.Context) ([]DNSQueryCounts, error) {
|
|||||||
sum(q)/300 as avg, max(q) as max
|
sum(q)/300 as avg, max(q) as max
|
||||||
from (
|
from (
|
||||||
select window as t, sumSimpleState(queries) as q
|
select window as t, sumSimpleState(queries) as q
|
||||||
from geodns.by_origin_1s
|
from dns.by_origin_1s
|
||||||
where
|
where
|
||||||
window > FROM_UNIXTIME(?)
|
window > FROM_UNIXTIME(?)
|
||||||
and Origin IN ('pool.ntp.org', 'g.ntpns.org')
|
and Origin IN ('pool.ntp.org', 'g.ntpns.org')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
go install github.com/goreleaser/goreleaser/v2@v2.12.3
|
go install github.com/goreleaser/goreleaser/v2@v2.13.3
|
||||||
|
|
||||||
if [ ! -z "${harbor_username:-}" ]; then
|
if [ ! -z "${harbor_username:-}" ]; then
|
||||||
DOCKER_FILE=~/.docker/config.json
|
DOCKER_FILE=~/.docker/config.json
|
||||||
@@ -13,11 +13,11 @@ if [ ! -z "${harbor_username:-}" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DRONE_TAG=${DRONE_TAG-""}
|
CI_TAG=${CI_COMMIT_TAG:-${DRONE_TAG:-""}}
|
||||||
|
|
||||||
is_snapshot=""
|
is_snapshot=""
|
||||||
|
|
||||||
if [ -z "$DRONE_TAG" ]; then
|
if [ -z "$CI_TAG" ]; then
|
||||||
is_snapshot="--snapshot"
|
is_snapshot="--snapshot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user