(maint) move to harness.drone.io

This commit is contained in:
TP Honey
2022-12-09 13:28:36 +00:00
parent fa25cef5f8
commit bc75d7120a
8 changed files with 216 additions and 478 deletions
-192
View File
@@ -1,192 +0,0 @@
local PipelineTesting = {
kind: "pipeline",
name: "testing",
platform: {
os: "linux",
arch: "amd64",
},
services: [
{
name: "pypiserver",
image: "pypiserver/pypiserver",
pull: "always",
entrypoint: [
"pypi-server",
"-P",
".",
"-a",
".",
"-p",
"8080",
"/data/packages"
],
},
],
steps: [
{
name: "vet",
image: "golang:1.11",
pull: "always",
environment: {
GO111MODULE: "on",
},
commands: [
"go vet ./...",
],
},
{
name: "test",
image: "golang:1.11-alpine",
pull: "always",
environment: {
GO111MODULE: "on",
PLUGIN_REPOSITORY: "http://pypiserver:8080/",
PLUGIN_DISTRIBUTIONS: "sdist",
PLUGIN_USERNAME: "demo",
PLUGIN_PASSWORD: "demo",
},
commands: [
"apk --no-cache add -U python3 git",
"pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine",
"go test -cover ./...",
],
},
],
trigger: {
branch: [ "master" ],
},
};
local PipelineBuild(os="linux", arch="amd64") = {
kind: "pipeline",
name: os + "-" + arch,
platform: {
os: os,
arch: arch,
},
steps: [
{
name: "build-push",
image: "golang:1.11",
pull: "always",
environment: {
CGO_ENABLED: "0",
GO111MODULE: "on",
},
commands: [
"go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-pypi",
],
when: {
event: [ "push", "pull_request" ],
},
},
{
name: "build-tag",
image: "golang:1.11",
pull: "always",
environment: {
CGO_ENABLED: "0",
GO111MODULE: "on",
},
commands: [
"go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-pypi",
],
when: {
event: [ "tag" ],
},
},
{
name: "executable",
image: "golang:1.11",
pull: "always",
commands: [
"./release/" + os + "/" + arch + "/drone-pypi --help",
],
},
{
name: "dryrun",
image: "plugins/docker:" + os + "-" + arch,
pull: "always",
settings: {
dry_run: true,
tags: os + "-" + arch,
dockerfile: "docker/Dockerfile." + os + "." + arch,
repo: "plugins/pypi",
username: { "from_secret": "docker_username" },
password: { "from_secret": "docker_password" },
},
when: {
event: [ "pull_request" ],
},
},
{
name: "publish",
image: "plugins/docker:" + os + "-" + arch,
pull: "always",
settings: {
auto_tag: true,
auto_tag_suffix: os + "-" + arch,
dockerfile: "docker/Dockerfile." + os + "." + arch,
repo: "plugins/pypi",
username: { "from_secret": "docker_username" },
password: { "from_secret": "docker_password" },
},
when: {
event: [ "push", "tag" ],
},
},
],
depends_on: [
"testing",
],
trigger: {
branch: [ "master" ],
},
};
local PipelineNotifications = {
kind: "pipeline",
name: "notifications",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
{
name: "manifest",
image: "plugins/manifest:1",
pull: "always",
settings: {
username: { "from_secret": "docker_username" },
password: { "from_secret": "docker_password" },
spec: "docker/manifest.tmpl",
ignore_missing: true,
},
},
{
name: "microbadger",
image: "plugins/webhook:1",
pull: "always",
settings: {
url: { "from_secret": "microbadger_url" },
},
},
],
depends_on: [
"linux-amd64",
"linux-arm64",
"linux-arm",
],
trigger: {
branch: [ "master" ],
event: [ "push", "tag" ],
},
};
[
PipelineTesting,
PipelineBuild("linux", "amd64"),
PipelineBuild("linux", "arm64"),
PipelineBuild("linux", "arm"),
PipelineNotifications,
]
+183 -261
View File
@@ -1,291 +1,223 @@
--- ---
kind: pipeline kind: pipeline
name: testing name: testing
type: vm
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
steps: pool:
- name: vet use: ubuntu
pull: always
image: golang:1.11
commands:
- go vet ./...
environment:
GO111MODULE: on
- name: test steps:
pull: always - name: vet
image: golang:1.11-alpine pull: always
commands: image: golang:1.19
- apk --no-cache add -U python3 python3-dev git gcc libc-dev libffi-dev openssl-dev commands:
- pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine - go vet ./...
- go test -cover ./... environment:
environment: GO111MODULE: on
GO111MODULE: on
PLUGIN_DISTRIBUTIONS: sdist - name: test
PLUGIN_PASSWORD: demo pull: always
PLUGIN_REPOSITORY: http://pypiserver:8080/ image: golang:1.19-alpine
PLUGIN_USERNAME: demo commands:
- apk --no-cache add -U python3 python3-dev git gcc libc-dev libffi-dev openssl-dev py3-pip
- pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine
- go test -cover ./...
environment:
GO111MODULE: on
PLUGIN_DISTRIBUTIONS: sdist
PLUGIN_PASSWORD: demo
PLUGIN_REPOSITORY: http://pypiserver:8080/
PLUGIN_USERNAME: demo
services: services:
- name: pypiserver - name: pypiserver
pull: always pull: always
image: pypiserver/pypiserver image: pypiserver/pypiserver
entrypoint: entrypoint:
- pypi-server - pypi-server
- -P - -P
- . - .
- -a - -a
- . - .
- -p - -p
- 8080 - 8080
- /data/packages - /data/packages
trigger: trigger:
branch: branch:
- master - master
--- ---
kind: pipeline kind: pipeline
name: linux-amd64 name: linux-amd64
type: vm
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
pool:
use: ubuntu
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.11 image: golang:1.19
commands: commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/amd64/drone-pypi" - 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-pypi'
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push - push
- pull_request - pull_request
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.11 image: golang:1.19
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/amd64/drone-pypi" - 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-pypi'
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- tag - tag
- name: executable - name: executable
pull: always pull: always
image: golang:1.11 image: golang:1.19
commands: commands:
- ./release/linux/amd64/drone-pypi --help - ./release/linux/amd64/drone-pypi --help
- name: dryrun - name: dryrun
pull: always pull: always
image: plugins/docker:linux-amd64 image: plugins/docker:linux-amd64
settings: settings:
dockerfile: docker/Dockerfile.linux.amd64 dockerfile: docker/Dockerfile.linux.amd64
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: plugins/pypi repo: plugins/pypi
tags: linux-amd64 tags: linux-amd64
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- pull_request - pull_request
- name: publish - name: publish
pull: always pull: always
image: plugins/docker:linux-amd64 image: plugins/docker:linux-amd64
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: linux-amd64
dockerfile: docker/Dockerfile.linux.amd64 dockerfile: docker/Dockerfile.linux.amd64
password: password:
from_secret: docker_password from_secret: docker_password
repo: plugins/pypi repo: plugins/pypi
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push - push
- tag - tag
trigger: trigger:
branch: branch:
- master - master
depends_on: depends_on:
- testing - testing
--- ---
kind: pipeline kind: pipeline
name: linux-arm64 name: linux-arm64
type: vm
pool:
use: ubuntu_arm64
platform: platform:
os: linux os: linux
arch: arm64 arch: arm64
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.11 image: golang:1.19
commands: commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm64/drone-pypi" - 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-pypi'
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push - push
- pull_request - pull_request
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.11 image: golang:1.19
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm64/drone-pypi" - 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-pypi'
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- tag - tag
- name: executable - name: executable
pull: always pull: always
image: golang:1.11 image: golang:1.19
commands: commands:
- ./release/linux/arm64/drone-pypi --help - ./release/linux/arm64/drone-pypi --help
- name: dryrun - name: dryrun
pull: always pull: always
image: plugins/docker:linux-arm64 image: plugins/docker:linux-arm64
settings: settings:
dockerfile: docker/Dockerfile.linux.arm64 dockerfile: docker/Dockerfile.linux.arm64
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: plugins/pypi repo: plugins/pypi
tags: linux-arm64 tags: linux-arm64
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- pull_request - pull_request
- name: publish - name: publish
pull: always pull: always
image: plugins/docker:linux-arm64 image: plugins/docker:linux-arm64
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm64 auto_tag_suffix: linux-arm64
dockerfile: docker/Dockerfile.linux.arm64 dockerfile: docker/Dockerfile.linux.arm64
password: password:
from_secret: docker_password from_secret: docker_password
repo: plugins/pypi repo: plugins/pypi
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push - push
- tag - tag
trigger: trigger:
branch: branch:
- master - master
depends_on: depends_on:
- testing - testing
---
kind: pipeline
name: linux-arm
platform:
os: linux
arch: arm
steps:
- name: build-push
pull: always
image: golang:1.11
commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm/drone-pypi"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- push
- pull_request
- name: build-tag
pull: always
image: golang:1.11
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm/drone-pypi"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.11
commands:
- ./release/linux/arm/drone-pypi --help
- name: dryrun
pull: always
image: plugins/docker:linux-arm
settings:
dockerfile: docker/Dockerfile.linux.arm
dry_run: true
password:
from_secret: docker_password
repo: plugins/pypi
tags: linux-arm
username:
from_secret: docker_username
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-arm
settings:
auto_tag: true
auto_tag_suffix: linux-arm
dockerfile: docker/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: plugins/pypi
username:
from_secret: docker_username
when:
event:
- push
- tag
trigger:
branch:
- master
depends_on:
- testing
--- ---
kind: pipeline kind: pipeline
@@ -296,34 +228,24 @@ platform:
arch: amd64 arch: amd64
steps: steps:
- name: manifest - name: manifest
pull: always pull: always
image: plugins/manifest:1 image: plugins/manifest
settings: settings:
ignore_missing: true ignore_missing: true
password: password:
from_secret: docker_password from_secret: docker_password
spec: docker/manifest.tmpl spec: docker/manifest.tmpl
username: username:
from_secret: docker_username from_secret: docker_username
- name: microbadger
pull: always
image: plugins/webhook:1
settings:
url:
from_secret: microbadger_url
trigger: trigger:
branch: branch:
- master - master
event: event:
- push - push
- tag - tag
depends_on: depends_on:
- linux-amd64 - linux-amd64
- linux-arm64 - linux-arm64
- linux-arm
...
+1 -1
View File
@@ -5,7 +5,7 @@ LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" \
org.label-schema.vendor="Drone.IO Community" \ org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0" org.label-schema.schema-version="1.0"
RUN apk add -U ca-certificates python3 \ RUN apk add -U ca-certificates python3 py3-pip \
python3-dev gcc libc-dev libffi-dev openssl-dev git && \ python3-dev gcc libc-dev libffi-dev openssl-dev git && \
rm -rf /var/cache/apk/* && \ rm -rf /var/cache/apk/* && \
pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine
-14
View File
@@ -1,14 +0,0 @@
FROM plugins/base:linux-arm
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" \
org.label-schema.name="Drone PyPi" \
org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0"
RUN apk add -U ca-certificates python3 \
python3-dev gcc libc-dev libffi-dev openssl-dev git && \
rm -rf /var/cache/apk/* && \
pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine
ADD release/linux/arm/drone-pypi /bin/
ENTRYPOINT ["/bin/drone-pypi"]
+1 -1
View File
@@ -5,7 +5,7 @@ LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" \
org.label-schema.vendor="Drone.IO Community" \ org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0" org.label-schema.schema-version="1.0"
RUN apk add -U ca-certificates python3 \ RUN apk add -U ca-certificates python3 py3-pip \
python3-dev gcc libc-dev libffi-dev openssl-dev git && \ python3-dev gcc libc-dev libffi-dev openssl-dev git && \
rm -rf /var/cache/apk/* && \ rm -rf /var/cache/apk/* && \
pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine
-6
View File
@@ -17,9 +17,3 @@ manifests:
architecture: arm64 architecture: arm64
os: linux os: linux
variant: v8 variant: v8
-
image: plugins/pypi:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7
+11 -3
View File
@@ -1,7 +1,15 @@
module github.com/xoxys/plugin-pypi module github.com/xoxys/plugin-pypi
go 1.19
require ( require (
github.com/joho/godotenv v1.3.0 github.com/joho/godotenv v1.4.0
github.com/pkg/errors v0.8.1 github.com/pkg/errors v0.9.1
github.com/urfave/cli v1.20.0 github.com/urfave/cli v1.22.10
)
require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
) )
+20
View File
@@ -1,6 +1,26 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.10 h1:p8Fspmz3iTctJstry1PYS3HVdllxnEzTEsgIgtxTrCk=
github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=