Skip to content

Commit 90170ca

Browse files
authored
Merge pull request #16 from xoxys/master
rewrite plugin to work with drone 0.8+
2 parents 4ee936a + 9c6d57b commit 90170ca

29 files changed

+972
-558
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!release/

.drone.jsonnet

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
local PipelineTesting = {
2+
kind: "pipeline",
3+
name: "testing",
4+
platform: {
5+
os: "linux",
6+
arch: "amd64",
7+
},
8+
services: [
9+
{
10+
name: "pypiserver",
11+
image: "pypiserver/pypiserver",
12+
pull: "always",
13+
entrypoint: [
14+
"pypi-server",
15+
"-P",
16+
".",
17+
"-a",
18+
".",
19+
"-p",
20+
"8080",
21+
"/data/packages"
22+
],
23+
},
24+
],
25+
steps: [
26+
{
27+
name: "vet",
28+
image: "golang:1.11",
29+
pull: "always",
30+
environment: {
31+
GO111MODULE: "on",
32+
},
33+
commands: [
34+
"go vet ./...",
35+
],
36+
},
37+
{
38+
name: "test",
39+
image: "golang:1.11-alpine",
40+
pull: "always",
41+
environment: {
42+
GO111MODULE: "on",
43+
PLUGIN_REPOSITORY: "http://pypiserver:8080/",
44+
PLUGIN_DISTRIBUTIONS: "sdist",
45+
PLUGIN_USERNAME: "demo",
46+
PLUGIN_PASSWORD: "demo",
47+
},
48+
commands: [
49+
"apk --no-cache add -U python3 git",
50+
"pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine",
51+
"go test -cover ./...",
52+
],
53+
},
54+
],
55+
trigger: {
56+
branch: [ "master" ],
57+
},
58+
};
59+
60+
local PipelineBuild(os="linux", arch="amd64") = {
61+
kind: "pipeline",
62+
name: os + "-" + arch,
63+
platform: {
64+
os: os,
65+
arch: arch,
66+
},
67+
steps: [
68+
{
69+
name: "build-push",
70+
image: "golang:1.11",
71+
pull: "always",
72+
environment: {
73+
CGO_ENABLED: "0",
74+
GO111MODULE: "on",
75+
},
76+
commands: [
77+
"go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-pypi",
78+
],
79+
when: {
80+
event: [ "push", "pull_request" ],
81+
},
82+
},
83+
{
84+
name: "build-tag",
85+
image: "golang:1.11",
86+
pull: "always",
87+
environment: {
88+
CGO_ENABLED: "0",
89+
GO111MODULE: "on",
90+
},
91+
commands: [
92+
"go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-pypi",
93+
],
94+
when: {
95+
event: [ "tag" ],
96+
},
97+
},
98+
{
99+
name: "executable",
100+
image: "golang:1.11",
101+
pull: "always",
102+
commands: [
103+
"./release/" + os + "/" + arch + "/drone-pypi --help",
104+
],
105+
},
106+
{
107+
name: "dryrun",
108+
image: "plugins/docker:" + os + "-" + arch,
109+
pull: "always",
110+
settings: {
111+
dry_run: true,
112+
tags: os + "-" + arch,
113+
dockerfile: "docker/Dockerfile." + os + "." + arch,
114+
repo: "plugins/pypi",
115+
username: { "from_secret": "docker_username" },
116+
password: { "from_secret": "docker_password" },
117+
},
118+
when: {
119+
event: [ "pull_request" ],
120+
},
121+
},
122+
{
123+
name: "publish",
124+
image: "plugins/docker:" + os + "-" + arch,
125+
pull: "always",
126+
settings: {
127+
auto_tag: true,
128+
auto_tag_suffix: os + "-" + arch,
129+
dockerfile: "docker/Dockerfile." + os + "." + arch,
130+
repo: "plugins/pypi",
131+
username: { "from_secret": "docker_username" },
132+
password: { "from_secret": "docker_password" },
133+
},
134+
when: {
135+
event: [ "push", "tag" ],
136+
},
137+
},
138+
],
139+
depends_on: [
140+
"testing",
141+
],
142+
trigger: {
143+
branch: [ "master" ],
144+
},
145+
};
146+
147+
local PipelineNotifications = {
148+
kind: "pipeline",
149+
name: "notifications",
150+
platform: {
151+
os: "linux",
152+
arch: "amd64",
153+
},
154+
steps: [
155+
{
156+
name: "manifest",
157+
image: "plugins/manifest:1",
158+
pull: "always",
159+
settings: {
160+
username: { "from_secret": "docker_username" },
161+
password: { "from_secret": "docker_password" },
162+
spec: "docker/manifest.tmpl",
163+
ignore_missing: true,
164+
},
165+
},
166+
{
167+
name: "microbadger",
168+
image: "plugins/webhook:1",
169+
pull: "always",
170+
settings: {
171+
url: { "from_secret": "microbadger_url" },
172+
},
173+
},
174+
],
175+
depends_on: [
176+
"linux-amd64",
177+
"linux-arm64",
178+
"linux-arm",
179+
],
180+
trigger: {
181+
branch: [ "master" ],
182+
event: [ "push", "tag" ],
183+
},
184+
};
185+
186+
[
187+
PipelineTesting,
188+
PipelineBuild("linux", "amd64"),
189+
PipelineBuild("linux", "arm64"),
190+
PipelineBuild("linux", "arm"),
191+
PipelineNotifications,
192+
]

.drone.sec

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)