From bc75d7120a56060b15783858df2448913a3636dc Mon Sep 17 00:00:00 2001 From: TP Honey Date: Fri, 9 Dec 2022 13:28:36 +0000 Subject: [PATCH] (maint) move to harness.drone.io --- .drone.jsonnet | 192 --------------- .drone.yml | 444 ++++++++++++++-------------------- docker/Dockerfile.linux.amd64 | 2 +- docker/Dockerfile.linux.arm | 14 -- docker/Dockerfile.linux.arm64 | 2 +- docker/manifest.tmpl | 6 - go.mod | 14 +- go.sum | 20 ++ 8 files changed, 216 insertions(+), 478 deletions(-) delete mode 100644 .drone.jsonnet delete mode 100644 docker/Dockerfile.linux.arm diff --git a/.drone.jsonnet b/.drone.jsonnet deleted file mode 100644 index 0dd1fd2..0000000 --- a/.drone.jsonnet +++ /dev/null @@ -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, -] diff --git a/.drone.yml b/.drone.yml index 4ce4c1c..4bb925e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,291 +1,223 @@ --- kind: pipeline name: testing +type: vm platform: os: linux arch: amd64 -steps: -- name: vet - pull: always - image: golang:1.11 - commands: - - go vet ./... - environment: - GO111MODULE: on +pool: + use: ubuntu -- name: test - pull: always - image: golang:1.11-alpine - commands: - - apk --no-cache add -U python3 python3-dev git gcc libc-dev libffi-dev openssl-dev - - 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 +steps: + - name: vet + pull: always + image: golang:1.19 + commands: + - go vet ./... + environment: + GO111MODULE: on + + - name: test + pull: always + image: golang:1.19-alpine + 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: -- name: pypiserver - pull: always - image: pypiserver/pypiserver - entrypoint: - - pypi-server - - -P - - . - - -a - - . - - -p - - 8080 - - /data/packages + - name: pypiserver + pull: always + image: pypiserver/pypiserver + entrypoint: + - pypi-server + - -P + - . + - -a + - . + - -p + - 8080 + - /data/packages trigger: branch: - - master + - master --- kind: pipeline name: linux-amd64 +type: vm platform: os: linux arch: amd64 +pool: + use: ubuntu + 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/amd64/drone-pypi" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - push - - pull_request + - name: build-push + pull: always + image: golang:1.19 + commands: + - 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/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/amd64/drone-pypi" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag + - name: build-tag + pull: always + image: golang:1.19 + commands: + - 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-pypi' + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag -- name: executable - pull: always - image: golang:1.11 - commands: - - ./release/linux/amd64/drone-pypi --help + - name: executable + pull: always + image: golang:1.19 + commands: + - ./release/linux/amd64/drone-pypi --help -- name: dryrun - pull: always - image: plugins/docker:linux-amd64 - settings: - dockerfile: docker/Dockerfile.linux.amd64 - dry_run: true - password: - from_secret: docker_password - repo: plugins/pypi - tags: linux-amd64 - username: - from_secret: docker_username - when: - event: - - pull_request + - name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: docker/Dockerfile.linux.amd64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/pypi + tags: linux-amd64 + username: + from_secret: docker_username + when: + event: + - pull_request -- name: publish - pull: always - image: plugins/docker:linux-amd64 - settings: - auto_tag: true - auto_tag_suffix: linux-amd64 - dockerfile: docker/Dockerfile.linux.amd64 - password: - from_secret: docker_password - repo: plugins/pypi - username: - from_secret: docker_username - when: - event: - - push - - tag + - name: publish + pull: always + image: plugins/docker:linux-amd64 + settings: + auto_tag: true + auto_tag_suffix: linux-amd64 + dockerfile: docker/Dockerfile.linux.amd64 + password: + from_secret: docker_password + repo: plugins/pypi + username: + from_secret: docker_username + when: + event: + - push + - tag trigger: branch: - - master + - master depends_on: -- testing + - testing --- kind: pipeline name: linux-arm64 +type: vm + +pool: + use: ubuntu_arm64 platform: os: linux arch: arm64 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/arm64/drone-pypi" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - push - - pull_request + - name: build-push + pull: always + image: golang:1.19 + commands: + - 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/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/arm64/drone-pypi" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag + - name: build-tag + pull: always + image: golang:1.19 + commands: + - 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-pypi' + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag -- name: executable - pull: always - image: golang:1.11 - commands: - - ./release/linux/arm64/drone-pypi --help + - name: executable + pull: always + image: golang:1.19 + commands: + - ./release/linux/arm64/drone-pypi --help -- name: dryrun - pull: always - image: plugins/docker:linux-arm64 - settings: - dockerfile: docker/Dockerfile.linux.arm64 - dry_run: true - password: - from_secret: docker_password - repo: plugins/pypi - tags: linux-arm64 - username: - from_secret: docker_username - when: - event: - - pull_request + - name: dryrun + pull: always + image: plugins/docker:linux-arm64 + settings: + dockerfile: docker/Dockerfile.linux.arm64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/pypi + tags: linux-arm64 + username: + from_secret: docker_username + when: + event: + - pull_request -- name: publish - pull: always - image: plugins/docker:linux-arm64 - settings: - auto_tag: true - auto_tag_suffix: linux-arm64 - dockerfile: docker/Dockerfile.linux.arm64 - password: - from_secret: docker_password - repo: plugins/pypi - username: - from_secret: docker_username - when: - event: - - push - - tag + - name: publish + pull: always + image: plugins/docker:linux-arm64 + settings: + auto_tag: true + auto_tag_suffix: linux-arm64 + dockerfile: docker/Dockerfile.linux.arm64 + password: + from_secret: docker_password + repo: plugins/pypi + username: + from_secret: docker_username + when: + event: + - push + - tag trigger: branch: - - master + - master depends_on: -- 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 + - testing --- kind: pipeline @@ -296,34 +228,24 @@ platform: arch: amd64 steps: -- name: manifest - pull: always - image: plugins/manifest:1 - settings: - ignore_missing: true - password: - from_secret: docker_password - spec: docker/manifest.tmpl - username: - from_secret: docker_username - -- name: microbadger - pull: always - image: plugins/webhook:1 - settings: - url: - from_secret: microbadger_url + - name: manifest + pull: always + image: plugins/manifest + settings: + ignore_missing: true + password: + from_secret: docker_password + spec: docker/manifest.tmpl + username: + from_secret: docker_username trigger: branch: - - master + - master event: - - push - - tag + - push + - tag depends_on: -- linux-amd64 -- linux-arm64 -- linux-arm - -... + - linux-amd64 + - linux-arm64 diff --git a/docker/Dockerfile.linux.amd64 b/docker/Dockerfile.linux.amd64 index 1b0c950..f539df6 100644 --- a/docker/Dockerfile.linux.amd64 +++ b/docker/Dockerfile.linux.amd64 @@ -5,7 +5,7 @@ LABEL maintainer="Drone.IO Community " \ org.label-schema.vendor="Drone.IO Community" \ 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 && \ rm -rf /var/cache/apk/* && \ pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine diff --git a/docker/Dockerfile.linux.arm b/docker/Dockerfile.linux.arm deleted file mode 100644 index ff16e87..0000000 --- a/docker/Dockerfile.linux.arm +++ /dev/null @@ -1,14 +0,0 @@ -FROM plugins/base:linux-arm - -LABEL maintainer="Drone.IO Community " \ - 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"] diff --git a/docker/Dockerfile.linux.arm64 b/docker/Dockerfile.linux.arm64 index 78f32e3..ff7a403 100644 --- a/docker/Dockerfile.linux.arm64 +++ b/docker/Dockerfile.linux.arm64 @@ -5,7 +5,7 @@ LABEL maintainer="Drone.IO Community " \ org.label-schema.vendor="Drone.IO Community" \ 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 && \ rm -rf /var/cache/apk/* && \ pip3 install --no-cache-dir --upgrade pip setuptools wheel six twine diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl index d3d77cc..6e15049 100644 --- a/docker/manifest.tmpl +++ b/docker/manifest.tmpl @@ -17,9 +17,3 @@ manifests: architecture: arm64 os: linux variant: v8 - - - image: plugins/pypi:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm - platform: - architecture: arm - os: linux - variant: v7 diff --git a/go.mod b/go.mod index 468aa54..e5eff05 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,15 @@ module github.com/xoxys/plugin-pypi +go 1.19 + require ( - github.com/joho/godotenv v1.3.0 - github.com/pkg/errors v0.8.1 - github.com/urfave/cli v1.20.0 + github.com/joho/godotenv v1.4.0 + github.com/pkg/errors v0.9.1 + 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 ) diff --git a/go.sum b/go.sum index 3a5fef6..6bc2780 100644 --- a/go.sum +++ b/go.sum @@ -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/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/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/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=