Skip to content

Commit 1386180

Browse files
authored
Merge pull request #13 from jianxiaoguo/dev
chore(CICD): use drone
2 parents 0a29b5a + d4d2aab commit 1386180

4 files changed

Lines changed: 194 additions & 12 deletions

File tree

.drone/drone.yml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
kind: pipeline
2+
type: docker
3+
name: linux-amd64
4+
5+
platform:
6+
arch: amd64
7+
os: linux
8+
9+
steps:
10+
- name: test
11+
image: docker.io/drycc/go-dev
12+
pull: if-not-exists
13+
privileged: true
14+
commands:
15+
- cd grafana && make test && cd ..
16+
- cd telegraf && make test && cd ..
17+
environment:
18+
VERSION: ${DRONE_TAG:-latest}-linux-amd64
19+
DEV_REGISTRY: ${DEV_REGISTRY:-docker.io}
20+
DRYCC_REGISTRY: ${DRYCC_REGISTRY:-docker.io}
21+
when:
22+
event:
23+
- push
24+
- tag
25+
- pull_request
26+
27+
- name: publish
28+
image: docker.io/drycc/go-dev
29+
pull: if-not-exists
30+
privileged: true
31+
commands:
32+
- echo $DOCKER_PASSWORD | docker login $DRYCC_REGISTRY --username $DOCKER_USERNAME --password-stdin
33+
- cd grafana && make build-all push-all
34+
environment:
35+
VERSION: ${DRONE_TAG:-latest}-linux-amd64
36+
DEV_REGISTRY:
37+
from_secret: dev_registry
38+
DRYCC_REGISTRY:
39+
from_secret: drycc_registry
40+
DOCKER_USERNAME:
41+
from_secret: docker_username
42+
DOCKER_PASSWORD:
43+
from_secret: docker_password
44+
when:
45+
event:
46+
- push
47+
- tag
48+
49+
trigger:
50+
event:
51+
- push
52+
- tag
53+
- pull_request
54+
55+
---
56+
kind: pipeline
57+
type: docker
58+
name: linux-arm64
59+
60+
platform:
61+
arch: arm64
62+
os: linux
63+
64+
steps:
65+
- name: publish
66+
image: docker.io/drycc/go-dev
67+
pull: if-not-exists
68+
privileged: true
69+
commands:
70+
- echo $DOCKER_PASSWORD | docker login $DRYCC_REGISTRY --username $DOCKER_USERNAME --password-stdin
71+
- cd grafana && make build-all push-all
72+
environment:
73+
VERSION: ${DRONE_TAG:-latest}-linux-arm64
74+
DEV_REGISTRY:
75+
from_secret: dev_registry
76+
DRYCC_REGISTRY:
77+
from_secret: drycc_registry
78+
DOCKER_USERNAME:
79+
from_secret: docker_username
80+
DOCKER_PASSWORD:
81+
from_secret: docker_password
82+
83+
trigger:
84+
event:
85+
- push
86+
- tag
87+
88+
---
89+
kind: pipeline
90+
type: docker
91+
name: manifest
92+
93+
steps:
94+
- name: generate grafana manifest
95+
image: docker.io/library/alpine
96+
pull: if-not-exists
97+
commands:
98+
- sed -i "s/docker.io/$${DRYCC_REGISTRY}/g" .drone/manifest.tmpl
99+
- sed -i "s/monitor/grafana/g" .drone/manifest.tmpl
100+
environment:
101+
DRYCC_REGISTRY:
102+
from_secret: drycc_registry
103+
104+
- name: publish grafana
105+
image: plugins/manifest
106+
settings:
107+
spec: .drone/manifest.tmpl
108+
username:
109+
from_secret: docker_username
110+
password:
111+
from_secret: docker_password
112+
environment:
113+
DEV_REGISTRY:
114+
from_secret: dev_registry
115+
DRYCC_REGISTRY:
116+
from_secret: drycc_registry
117+
118+
- name: generate telegraf manifest
119+
image: docker.io/library/alpine
120+
pull: if-not-exists
121+
commands:
122+
- sed -i "s/docker.io/$${DRYCC_REGISTRY}/g" .drone/manifest.tmpl
123+
- sed -i "s/grafana/telegraf/g" .drone/manifest.tmpl
124+
environment:
125+
DRYCC_REGISTRY:
126+
from_secret: drycc_registry
127+
128+
- name: publish telegraf
129+
image: plugins/manifest
130+
settings:
131+
spec: .drone/manifest.tmpl
132+
username:
133+
from_secret: docker_username
134+
password:
135+
from_secret: docker_password
136+
environment:
137+
DEV_REGISTRY:
138+
from_secret: dev_registry
139+
DRYCC_REGISTRY:
140+
from_secret: drycc_registry
141+
142+
trigger:
143+
event:
144+
- push
145+
- tag
146+
147+
depends_on:
148+
- linux-amd64
149+
- linux-arm64
150+
151+
---
152+
kind: pipeline
153+
type: docker
154+
name: chart
155+
156+
steps:
157+
- name: generate chart
158+
image: docker.io/drycc/python-dev
159+
commands:
160+
- IMAGE_TAG=$([ ! -z $DRONE_TAG ] && echo \"${DRONE_TAG:1}\" || echo \"canary\")
161+
- sed -i "s/image_tag:\ \"canary\"/image_tag:\ $IMAGE_TAG/g" charts/monitor/values.yaml
162+
- helm package charts/monitor --version ${DRONE_TAG:-v1.0.0}
163+
- curl -u $CHARTMUSEUM_USERNAME:$CHARTMUSEUM_PASSWORD -F chart=@monitor-${DRONE_TAG:-v1.0.0}.tgz "$CHARTMUSEUM_API/api/$([ -z $DRONE_TAG ] && echo testing || echo stable)/charts"
164+
environment:
165+
CHARTMUSEUM_USERNAME:
166+
from_secret: chartmuseum_username
167+
CHARTMUSEUM_PASSWORD:
168+
from_secret: chartmuseum_password
169+
CHARTMUSEUM_API:
170+
from_secret: chartmuseum_api
171+
172+
trigger:
173+
event:
174+
- push
175+
- tag

.drone/manifest.tmpl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
image: docker.io/drycc/monitor:{{#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: docker.io/drycc/monitor:{{#if build.tag}}{{build.tag}}-{{else}}latest-{{/if}}linux-amd64
11+
platform:
12+
architecture: amd64
13+
os: linux
14+
-
15+
image: docker.io/drycc/monitor:{{#if build.tag}}{{build.tag}}-{{else}}latest-{{/if}}linux-arm64
16+
platform:
17+
architecture: arm64
18+
os: linux

.travis.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Drycc Monitor v2
33

4-
[![Build Status](https://travis-ci.org/drycc/monitor.svg?branch=main)](https://travis-ci.org/drycc/monitor)
4+
[![Build Status](https://drone.drycc.cc/api/badges/drycc/monitor/status.svg)](https://drone.drycc.cc/drycc/monitor)
55

66
Drycc (pronounced DAY-iss) Workflow is an open source Platform as a Service (PaaS) that adds a developer-friendly layer to any [Kubernetes](http://kubernetes.io) cluster, making it easy to deploy and manage applications on your own servers.
77

0 commit comments

Comments
 (0)