Skip to content

Commit 9b293f7

Browse files
author
lijianguo
committed
chore(CICD): use drone
1 parent 9fd892a commit 9b293f7

3 files changed

Lines changed: 174 additions & 1 deletion

File tree

.drone/.drone.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Drycc Registry v2
22

3-
[![Build Status](https://travis-ci.org/drycc/registry.svg?branch=main)](https://travis-ci.org/drycc/registry)
3+
[![Build Status](https://drone.drycc.cc/api/badges/drycc/registry/status.svg)](https://drone.drycc.cc/drycc/registry)
44
[![Go Report Card](https://goreportcard.com/badge/github.com/drycc/registry)](https://goreportcard.com/report/github.com/drycc/registry)
55

66

0 commit comments

Comments
 (0)