Skip to content

Commit 357d44c

Browse files
committed
chore(monitor): use woodpecker replace drone
1 parent 10a8524 commit 357d44c

8 files changed

Lines changed: 197 additions & 183 deletions

File tree

.drone/drone.yml

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

.drone/manifest.tmpl

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

.woodpecker/build-linux.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
matrix:
2+
platform:
3+
- linux/amd64
4+
- linux/arm64
5+
6+
platform: ${platform}
7+
8+
labels:
9+
type: exec
10+
11+
pipeline:
12+
- name: publish-linux
13+
image: bash
14+
commands:
15+
- echo $CONTAINER_PASSWORD | docker login $DRYCC_REGISTRY --username $CONTAINER_USERNAME --password-stdin > /dev/null 2>&1
16+
- cd grafana && make build-all push-all && cd ..
17+
- cd telegraf && make build-all push-all && cd ..
18+
secrets:
19+
- dev_registry
20+
- drycc_registry
21+
- container_username
22+
- container_password
23+
when:
24+
event:
25+
- push
26+
- tag
27+
28+
depends_on:
29+
- test-linux

.woodpecker/chart.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
platform: linux/amd64
2+
3+
labels:
4+
type: exec
5+
6+
- name: generate chart
7+
commands:
8+
- IMAGE_TAG=$([ ! -z $DRONE_TAG ] && echo \"${DRONE_TAG:1}\" || echo \"canary\")
9+
- sed -i "s/imageTag:\ \"canary\"/imageTag:\ $IMAGE_TAG/g" charts/monitor/values.yaml
10+
- helm package -u charts/monitor --version $([ -z $DRONE_TAG ] && echo 1.0.0 || echo ${DRONE_TAG#v})
11+
- echo $CONTAINER_PASSWORD | helm registry login $DRYCC_REGISTRY -u $CONTAINER_USERNAME --password-stdin
12+
- helm push monitor-$([ -z $DRONE_TAG ] && echo 1.0.0 || echo ${DRONE_TAG#v}).tgz oci://$DRYCC_REGISTRY/$([ -z $DRONE_TAG ] && echo charts-testing || echo charts)
13+
environment:
14+
DRYCC_REGISTRY:
15+
from_secret: drycc_registry
16+
CONTAINER_USERNAME:
17+
from_secret: container_username
18+
CONTAINER_PASSWORD:
19+
from_secret: container_password
20+
when:
21+
event:
22+
- push
23+
- tag
24+
25+
pipeline:
26+
- name: generate-chart
27+
type: local
28+
image: bash
29+
commands:
30+
- export VERSION=$(sed 's#v##' <<< $CI_COMMIT_TAG)
31+
- export IMAGE_TAG=$([ ! -z $CI_COMMIT_TAG ] && echo \"$VERSION\" || echo \"canary\")
32+
- sed -i "s/imageTag:\ \"canary\"/imageTag:\ $IMAGE_TAG/g" charts/$${CI_REPO_NAME}/values.yaml
33+
- helm package -u charts/$${CI_REPO_NAME} --version $([ -z $CI_COMMIT_TAG ] && echo 1.0.0 || echo $VERSION)
34+
- echo $CONTAINER_PASSWORD | helm registry login $DRYCC_REGISTRY -u $CONTAINER_USERNAME --password-stdin
35+
- helm push $${CI_REPO_NAME}-$([ -z $CI_COMMIT_TAG ] && echo 1.0.0 || echo $VERSION).tgz oci://$DRYCC_REGISTRY/$([ -z $CI_COMMIT_TAG ] && echo charts-testing || echo charts)
36+
secrets:
37+
- dev_registry
38+
- drycc_registry
39+
- container_username
40+
- container_password
41+
when:
42+
event:
43+
- push
44+
- tag
45+
46+
depends_on:
47+
- manifest-grafana
48+
- manifest-telegraf

.woodpecker/manifest-grafana.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
platform: linux/amd64
2+
3+
labels:
4+
type: exec
5+
6+
pipeline:
7+
- name: generate-manifest
8+
image: bash
9+
commands:
10+
- sed -i "s/{{project}}/grafana/g" .woodpecker/manifest.tmpl
11+
- sed -i "s/registry.drycc.cc/$${DRYCC_REGISTRY}/g" .woodpecker/manifest.tmpl
12+
secrets:
13+
- drycc_registry
14+
when:
15+
event:
16+
- tag
17+
- push
18+
19+
- name: publish-manifest
20+
image: bash
21+
commands:
22+
- docker run --rm
23+
-e PLUGIN_SPEC=.woodpecker/manifest.tmpl
24+
-e PLUGIN_USERNAME=$CONTAINER_USERNAME
25+
-e PLUGIN_PASSWORD=$CONTAINER_PASSWORD
26+
-v $(pwd):$(pwd)
27+
-w $(pwd)
28+
plugins/manifest
29+
secrets:
30+
- container_username
31+
- container_password
32+
when:
33+
event:
34+
- tag
35+
- push
36+
37+
depends_on:
38+
- build-linux

.woodpecker/manifest-telegraf.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
platform: linux/amd64
2+
3+
labels:
4+
type: exec
5+
6+
pipeline:
7+
- name: generate-manifest
8+
image: bash
9+
commands:
10+
- sed -i "s/{{project}}/telegraf/g" .woodpecker/manifest.tmpl
11+
- sed -i "s/registry.drycc.cc/$${DRYCC_REGISTRY}/g" .woodpecker/manifest.tmpl
12+
secrets:
13+
- drycc_registry
14+
when:
15+
event:
16+
- tag
17+
- push
18+
19+
- name: publish-manifest
20+
image: bash
21+
commands:
22+
- docker run --rm
23+
-e PLUGIN_SPEC=.woodpecker/manifest.tmpl
24+
-e PLUGIN_USERNAME=$CONTAINER_USERNAME
25+
-e PLUGIN_PASSWORD=$CONTAINER_PASSWORD
26+
-v $(pwd):$(pwd)
27+
-w $(pwd)
28+
plugins/manifest
29+
secrets:
30+
- container_username
31+
- container_password
32+
when:
33+
event:
34+
- tag
35+
- push
36+
37+
depends_on:
38+
- build-linux

.woodpecker/manifest.tmpl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
image: registry.drycc.cc/drycc/{{project}}:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}canary{{/if}}
2+
{{#if build.tags}}
3+
tags:
4+
{{#each build.tags}}
5+
- {{this}}
6+
{{/each}}
7+
{{/if}}
8+
manifests:
9+
-
10+
image: registry.drycc.cc/drycc/{{project}}:{{#if build.tag}}{{build.tag}}-{{else}}latest-{{/if}}linux-amd64
11+
platform:
12+
architecture: amd64
13+
os: linux
14+
-
15+
image: registry.drycc.cc/drycc/{{project}}:{{#if build.tag}}{{build.tag}}-{{else}}latest-{{/if}}linux-arm64
16+
platform:
17+
architecture: arm64
18+
os: linux

.woodpecker/test-linux.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
matrix:
2+
platform:
3+
- linux/amd64
4+
- linux/arm64
5+
6+
platform: ${platform}
7+
8+
labels:
9+
type: exec
10+
11+
pipeline:
12+
- name: test-linux
13+
image: bash
14+
commands:
15+
- mkdir -p $HOMEPATH/.docker; echo $IMAGE_PULL_SECRETS > $HOMEPATH/.docker/config.json
16+
- cd grafana && make test && cd ..
17+
- cd telegraf && make test && cd ..
18+
secrets:
19+
- dev_registry
20+
- drycc_registry
21+
- container_pull_secrets
22+
when:
23+
event:
24+
- push
25+
- tag
26+
- pull_request

0 commit comments

Comments
 (0)