fork: initial release

This commit is contained in:
Robert Kaussow 2021-01-10 23:47:55 +01:00
parent 9c86f98ea5
commit 89b0b6823a
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
53 changed files with 803 additions and 2903 deletions

View File

@ -1,50 +1,324 @@
local pipeline = import 'pipeline.libsonnet'; local PipelineTest = {
kind: 'pipeline',
image_pull_secrets: ['docker_config'],
name: 'test',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'staticcheck',
image: 'golang:1.15',
commands: [
'go run honnef.co/go/tools/cmd/staticcheck ./...',
],
volumes: [
{
name: 'gopath',
path: '/go',
},
],
},
{
name: 'lint',
image: 'golang:1.15',
commands: [
'go run golang.org/x/lint/golint -set_exit_status ./...',
],
volumes: [
{
name: 'gopath',
path: '/go',
},
],
},
{
name: 'vet',
image: 'golang:1.15',
commands: [
'go vet ./...',
],
volumes: [
{
name: 'gopath',
path: '/go',
},
],
},
{
name: 'test',
image: 'golang:1.15',
commands: [
'go test -cover ./...',
],
volumes: [
{
name: 'gopath',
path: '/go',
},
],
},
],
volumes: [
{
name: 'gopath',
temp: {},
},
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuildBinaries = {
kind: 'pipeline',
image_pull_secrets: ['docker_config'],
name: 'build-binaries',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'build',
image: 'techknowlogick/xgo:go-1.15.x',
commands: [
'[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
'mkdir -p release/',
"cd cmd/drone-docker-buildx && xgo -ldflags \"-s -w -X main.version=$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out drone-docker-buildx .",
'mv /build/* /drone/src/release/',
],
},
{
name: 'executable',
image: 'alpine',
commands: [
'$(find release/ -executable -type f | grep drone-docker-buildx-linux-amd64) --help',
],
},
{
name: 'compress',
image: 'alpine',
commands: [
'apk add upx',
'find release/ -maxdepth 1 -executable -type f -exec upx {} \\;',
'ls -lh release/',
],
},
{
name: 'checksum',
image: 'alpine',
commands: [
'cd release/ && sha256sum * > sha256sum.txt',
],
},
{
name: 'publish',
image: 'plugins/github-release',
settings: {
overwrite: true,
api_key: {
from_secret: 'github_token',
},
files: ['release/*'],
title: '${DRONE_TAG}',
note: 'CHANGELOG.md',
},
when: {
ref: [
'refs/tags/**',
],
},
},
],
depends_on: [
'test',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuildContainer(arch='amd64') = {
kind: 'pipeline',
image_pull_secrets: ['docker_config'],
name: 'build-container-' + arch,
platform: {
os: 'linux',
arch: arch,
},
steps: [
{
name: 'build',
image: 'golang:1.15',
commands: [
'[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
'go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/' + arch + '/drone-docker-buildx ./cmd/drone-docker-buildx',
],
},
{
name: 'dryrun',
image: 'plugins/docker:19',
settings: {
config: { from_secret: 'docker_config' },
dry_run: true,
dockerfile: 'docker/Dockerfile.' + arch,
repo: 'thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
depends_on: ['build'],
when: {
ref: ['refs/pull/**'],
},
},
{
name: 'publish-dockerhub',
image: 'plugins/docker:19',
settings: {
config: { from_secret: 'docker_config' },
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'docker/Dockerfile.' + arch,
repo: 'thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: ['refs/heads/master', 'refs/tags/**'],
},
depends_on: ['dryrun'],
},
{
name: 'publish-quay',
image: 'plugins/docker:19',
settings: {
config: { from_secret: 'docker_config' },
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'docker/Dockerfile.' + arch,
registry: 'quay.io',
repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
},
when: {
ref: ['refs/heads/master', 'refs/tags/**'],
},
depends_on: ['dryrun'],
},
],
depends_on: [
'test',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineNotifications = {
kind: 'pipeline',
image_pull_secrets: ['docker_config'],
name: 'notifications',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
image: 'plugins/manifest',
name: 'manifest-dockerhub',
settings: {
ignore_missing: true,
auto_tag: true,
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'docker/manifest.tmpl',
},
when: {
status: ['success'],
},
},
{
image: 'plugins/manifest',
name: 'manifest-quay',
settings: {
ignore_missing: true,
auto_tag: true,
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
spec: 'docker/manifest-quay.tmpl',
},
when: {
status: ['success'],
},
},
{
name: 'pushrm-dockerhub',
image: 'chko/docker-pushrm:1',
environment: {
DOCKER_PASS: {
from_secret: 'docker_password',
},
DOCKER_USER: {
from_secret: 'docker_username',
},
PUSHRM_FILE: 'README.md',
PUSHRM_SHORT: 'Drone plugin to build multiarch Docker images with buildx',
PUSHRM_TARGET: 'thegeeklab/${DRONE_REPO_NAME}',
},
when: {
status: ['success'],
},
},
{
name: 'pushrm-quay',
image: 'chko/docker-pushrm:1',
environment: {
APIKEY__QUAY_IO: {
from_secret: 'quay_token',
},
PUSHRM_FILE: 'README.md',
PUSHRM_TARGET: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
},
when: {
status: ['success'],
},
},
{
name: 'matrix',
image: 'plugins/matrix',
settings: {
homeserver: { from_secret: 'matrix_homeserver' },
roomid: { from_secret: 'matrix_roomid' },
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
when: {
status: ['success', 'failure'],
},
},
],
depends_on: [
'build-binaries',
'build-container-amd64',
'build-container-arm',
'build-container-arm64',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**'],
status: ['success', 'failure'],
},
};
[ [
pipeline.test('linux', 'amd64'), PipelineTest,
PipelineBuildBinaries,
pipeline.build('docker', 'linux', 'amd64'), PipelineBuildContainer(arch='amd64'),
pipeline.build('docker', 'linux', 'arm64'), PipelineBuildContainer(arch='arm64'),
pipeline.build('docker', 'linux', 'arm'), PipelineBuildContainer(arch='arm'),
pipeline.notifications('docker', depends_on=[ PipelineNotifications,
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
pipeline.build('gcr', 'linux', 'amd64'),
pipeline.build('gcr', 'linux', 'arm64'),
pipeline.build('gcr', 'linux', 'arm'),
pipeline.notifications('gcr', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
pipeline.build('acr', 'linux', 'amd64'),
pipeline.build('acr', 'linux', 'arm64'),
pipeline.build('acr', 'linux', 'arm'),
pipeline.notifications('acr', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
pipeline.build('ecr', 'linux', 'amd64'),
pipeline.build('ecr', 'linux', 'arm64'),
pipeline.build('ecr', 'linux', 'arm'),
pipeline.notifications('ecr', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
pipeline.build('heroku', 'linux', 'amd64'),
pipeline.build('heroku', 'linux', 'arm64'),
pipeline.build('heroku', 'linux', 'arm'),
pipeline.notifications('heroku', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
] ]

1661
.drone.yml

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
<!-- PLEASE READ BEFORE DELETING
Bugs or Issues? Due to the high number of false positive issues we receive,
please do not create a GitHub issue until you have discussed and verified
with community support at:
https://discourse.drone.io/
-->

View File

@ -1 +0,0 @@

32
.github/settings.yml vendored
View File

@ -1,13 +1,12 @@
repository: repository:
name: drone-docker name: drone-docker-buildx
description: Drone plugin for publishing Docker images description: Drone plugin to build multiarch Docker images with buildx
homepage: http://plugins.drone.io/drone-plugins/drone-docker
topics: drone, drone-plugin topics: drone, drone-plugin
private: false private: false
has_issues: true has_issues: true
has_wiki: false has_wiki: false
has_downloads: false has_downloads: true
default_branch: master default_branch: master
@ -19,6 +18,9 @@ labels:
- name: bug - name: bug
color: d73a4a color: d73a4a
description: Something isn't working description: Something isn't working
- name: documentation
color: 0075ca
description: Improvements or additions to documentation
- name: duplicate - name: duplicate
color: cfd3d7 color: cfd3d7
description: This issue or pull request already exists description: This issue or pull request already exists
@ -37,33 +39,17 @@ labels:
- name: question - name: question
color: d876e3 color: d876e3
description: Further information is requested description: Further information is requested
- name: renovate
color: e99695
description: Automated action from Renovate
- name: wontfix - name: wontfix
color: ffffff color: ffffff
description: This will not be worked on description: This will not be worked on
teams:
- name: Admins
permission: admin
branches: branches:
- name: master - name: master
protection: protection:
required_pull_request_reviews: required_pull_request_reviews: null
required_approving_review_count: 1
dismiss_stale_reviews: false
require_code_owner_reviews: false
dismissal_restrictions:
teams:
- Admins
required_status_checks: required_status_checks:
strict: true strict: true
contexts: contexts:
- continuous-integration/drone/pr - continuous-integration/drone/pr
enforce_admins: false enforce_admins: null
restrictions: restrictions: null
users: []
teams:
- Admins

5
.gitignore vendored
View File

@ -1,3 +1,4 @@
release /release/
drone-docker-buildx*
coverage.out coverage.out
vendor

View File

@ -1,3 +1,4 @@
Apache License Apache License
Version 2.0, January 2004 Version 2.0, January 2004
http://www.apache.org/licenses/ http://www.apache.org/licenses/
@ -178,7 +179,7 @@
APPENDIX: How to apply the Apache License to your work. APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}" boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a comment syntax for the file format. We also recommend that a
@ -186,7 +187,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright {yyyy} {name of copyright owner} Copyright 2021 Robert Kaussow <mail@thegeeklab.de>
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -199,4 +200,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.

View File

@ -1,74 +1,56 @@
# drone-docker # drone-docker-buildx
[![Build Status](http://cloud.drone.io/api/badges/drone-plugins/drone-docker/status.svg)](http://cloud.drone.io/drone-plugins/drone-docker) Drone plugin to build multiarch Docker images with buildx
[![Gitter chat](https://badges.gitter.im/drone/drone.png)](https://gitter.im/drone/drone)
[![Join the discussion at https://discourse.drone.io](https://img.shields.io/badge/discourse-forum-orange.svg)](https://discourse.drone.io)
[![Drone questions at https://stackoverflow.com](https://img.shields.io/badge/drone-stackoverflow-orange.svg)](https://stackoverflow.com/questions/tagged/drone.io)
[![](https://images.microbadger.com/badges/image/plugins/docker.svg)](https://microbadger.com/images/plugins/docker "Get your own image badge on microbadger.com")
[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-docker?status.svg)](http://godoc.org/github.com/drone-plugins/drone-docker)
[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-docker)](https://goreportcard.com/report/github.com/drone-plugins/drone-docker)
Drone plugin uses Docker-in-Docker to build and publish Docker images to a container registry. For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/drone-docker/). [![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker-buildx?logo=drone)](https://cloud.drone.io/thegeeklab/drone-docker-buildx)
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-docker-buildx)
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-docker-buildx)
[![Go Report Card](https://goreportcard.com/badge/github.com/thegeeklab/drone-docker-buildx)](https://goreportcard.com/report/github.com/thegeeklab/drone-docker-buildx)
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/graphs/contributors)
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-docker-buildx)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/blob/main/LICENSE)
Drone plugin to build multiarch Docker images with buildx.
## Build ## Build
Build the binaries with the following commands: Build the binary with the following command:
```console ```Shell
export GOOS=linux export GOOS=linux
export GOARCH=amd64 export GOARCH=amd64
export CGO_ENABLED=0 export CGO_ENABLED=0
export GO111MODULE=on export GO111MODULE=on
go build -v -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker go build -v -a -tags netgo -o release/drone-docker-buildx
go build -v -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr
go build -v -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr
go build -v -a -tags netgo -o release/linux/amd64/drone-acr ./cmd/drone-acr
go build -v -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku
``` ```
## Docker Build the Docker image with the following command:
Build the Docker images with the following commands: ```Shell
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx .
```console
docker build \
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
--file docker/docker/Dockerfile.linux.amd64 --tag plugins/docker .
docker build \
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
--file docker/gcr/Dockerfile.linux.amd64 --tag plugins/gcr .
docker build \
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
--file docker/ecr/Dockerfile.linux.amd64 --tag plugins/ecr .
docker build \
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
--file docker/acr/Dockerfile.linux.amd64 --tag plugins/acr .
docker build \
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
--file docker/heroku/Dockerfile.linux.amd64 --tag plugins/heroku .
``` ```
## Usage ## Usage
> Notice: Be aware that the Docker plugin currently requires privileged capabilities, otherwise the integrated Docker daemon is not able to start. > Notice: Be aware that the tis plugin requires privileged capabilities, otherwise the integrated Docker daemon is not able to start.
```console ```console
docker run --rm \ docker run --rm \
-e PLUGIN_TAG=latest \ -e PLUGIN_TAG=latest \
-e PLUGIN_REPO=octocat/hello-world \ -e PLUGIN_REPO=octocat/hello-world \
-e DRONE_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \ -e DRONE_COMMIT_SHA=00000000 \
-v $(pwd):$(pwd) \ -v $(pwd):$(pwd) \
-w $(pwd) \ -w $(pwd) \
--privileged \ --privileged \
plugins/docker --dry-run thegeeklab/drone-docker-buildx --dry-run
``` ```
## Contributors
Special thanks goes to all [contributors](https://github.com/thegeeklab/drone-docker-buildx/graphs/contributors). If you would like to contribute,
please see the [instructions](https://github.com/thegeeklab/drone-docker-buildx/blob/main/CONTRIBUTING.md).
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/thegeeklab/drone-docker-buildx/blob/main/LICENSE) file for details.

View File

@ -1,60 +0,0 @@
package main
import (
"fmt"
"os"
"os/exec"
"strings"
"github.com/joho/godotenv"
)
func main() {
// Load env-file if it exists first
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
godotenv.Load(env)
}
var (
repo = getenv("PLUGIN_REPO")
registry = getenv("PLUGIN_REGISTRY")
username = getenv("SERVICE_PRINCIPAL_CLIENT_ID")
password = getenv("SERVICE_PRINCIPAL_CLIENT_SECRET")
)
// default registry value
if registry == "" {
registry = "azurecr.io"
}
// must use the fully qualified repo name. If the
// repo name does not have the registry prefix we
// should prepend.
if !strings.HasPrefix(repo, registry) {
repo = fmt.Sprintf("%s/%s", registry, repo)
}
os.Setenv("PLUGIN_REPO", repo)
os.Setenv("PLUGIN_REGISTRY", registry)
os.Setenv("DOCKER_USERNAME", username)
os.Setenv("DOCKER_PASSWORD", password)
// invoke the base docker plugin binary
cmd := exec.Command("drone-docker")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
os.Exit(1)
}
}
func getenv(key ...string) (s string) {
for _, k := range key {
s = os.Getenv(k)
if s != "" {
return
}
}
return
}

View File

@ -1,317 +0,0 @@
package main
import (
"os"
"github.com/joho/godotenv"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
docker "github.com/drone-plugins/drone-docker"
)
var (
version = "unknown"
)
func main() {
// Load env-file if it exists first
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
godotenv.Load(env)
}
app := cli.NewApp()
app.Name = "docker plugin"
app.Usage = "docker plugin"
app.Action = run
app.Version = version
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "dry-run",
Usage: "dry run disables docker push",
EnvVar: "PLUGIN_DRY_RUN",
},
cli.StringFlag{
Name: "remote.url",
Usage: "git remote url",
EnvVar: "DRONE_REMOTE_URL",
},
cli.StringFlag{
Name: "commit.sha",
Usage: "git commit sha",
EnvVar: "DRONE_COMMIT_SHA",
Value: "00000000",
},
cli.StringFlag{
Name: "commit.ref",
Usage: "git commit ref",
EnvVar: "DRONE_COMMIT_REF",
},
cli.StringFlag{
Name: "daemon.mirror",
Usage: "docker daemon registry mirror",
EnvVar: "PLUGIN_MIRROR,DOCKER_PLUGIN_MIRROR",
},
cli.StringFlag{
Name: "daemon.storage-driver",
Usage: "docker daemon storage driver",
EnvVar: "PLUGIN_STORAGE_DRIVER",
},
cli.StringFlag{
Name: "daemon.storage-path",
Usage: "docker daemon storage path",
Value: "/var/lib/docker",
EnvVar: "PLUGIN_STORAGE_PATH",
},
cli.StringFlag{
Name: "daemon.bip",
Usage: "docker daemon bride ip address",
EnvVar: "PLUGIN_BIP",
},
cli.StringFlag{
Name: "daemon.mtu",
Usage: "docker daemon custom mtu setting",
EnvVar: "PLUGIN_MTU",
},
cli.StringSliceFlag{
Name: "daemon.dns",
Usage: "docker daemon dns server",
EnvVar: "PLUGIN_CUSTOM_DNS",
},
cli.StringSliceFlag{
Name: "daemon.dns-search",
Usage: "docker daemon dns search domains",
EnvVar: "PLUGIN_CUSTOM_DNS_SEARCH",
},
cli.BoolFlag{
Name: "daemon.insecure",
Usage: "docker daemon allows insecure registries",
EnvVar: "PLUGIN_INSECURE",
},
cli.BoolFlag{
Name: "daemon.ipv6",
Usage: "docker daemon IPv6 networking",
EnvVar: "PLUGIN_IPV6",
},
cli.BoolFlag{
Name: "daemon.experimental",
Usage: "docker daemon Experimental mode",
EnvVar: "PLUGIN_EXPERIMENTAL",
},
cli.BoolFlag{
Name: "daemon.debug",
Usage: "docker daemon executes in debug mode",
EnvVar: "PLUGIN_DEBUG,DOCKER_LAUNCH_DEBUG",
},
cli.BoolFlag{
Name: "daemon.off",
Usage: "don't start the docker daemon",
EnvVar: "PLUGIN_DAEMON_OFF",
},
cli.StringFlag{
Name: "dockerfile",
Usage: "build dockerfile",
Value: "Dockerfile",
EnvVar: "PLUGIN_DOCKERFILE",
},
cli.StringFlag{
Name: "context",
Usage: "build context",
Value: ".",
EnvVar: "PLUGIN_CONTEXT",
},
cli.StringSliceFlag{
Name: "tags",
Usage: "build tags",
Value: &cli.StringSlice{"latest"},
EnvVar: "PLUGIN_TAG,PLUGIN_TAGS",
FilePath: ".tags",
},
cli.BoolFlag{
Name: "tags.auto",
Usage: "default build tags",
EnvVar: "PLUGIN_DEFAULT_TAGS,PLUGIN_AUTO_TAG",
},
cli.StringFlag{
Name: "tags.suffix",
Usage: "default build tags with suffix",
EnvVar: "PLUGIN_DEFAULT_SUFFIX,PLUGIN_AUTO_TAG_SUFFIX",
},
cli.StringSliceFlag{
Name: "args",
Usage: "build args",
EnvVar: "PLUGIN_BUILD_ARGS",
},
cli.StringSliceFlag{
Name: "args-from-env",
Usage: "build args",
EnvVar: "PLUGIN_BUILD_ARGS_FROM_ENV",
},
cli.BoolFlag{
Name: "quiet",
Usage: "quiet docker build",
EnvVar: "PLUGIN_QUIET",
},
cli.StringFlag{
Name: "target",
Usage: "build target",
EnvVar: "PLUGIN_TARGET",
},
cli.StringSliceFlag{
Name: "cache-from",
Usage: "images to consider as cache sources",
EnvVar: "PLUGIN_CACHE_FROM",
},
cli.BoolFlag{
Name: "squash",
Usage: "squash the layers at build time",
EnvVar: "PLUGIN_SQUASH",
},
cli.BoolTFlag{
Name: "pull-image",
Usage: "force pull base image at build time",
EnvVar: "PLUGIN_PULL_IMAGE",
},
cli.BoolFlag{
Name: "compress",
Usage: "compress the build context using gzip",
EnvVar: "PLUGIN_COMPRESS",
},
cli.StringFlag{
Name: "repo",
Usage: "docker repository",
EnvVar: "PLUGIN_REPO",
},
cli.StringSliceFlag{
Name: "custom-labels",
Usage: "additional k=v labels",
EnvVar: "PLUGIN_CUSTOM_LABELS",
},
cli.StringSliceFlag{
Name: "label-schema",
Usage: "label-schema labels",
EnvVar: "PLUGIN_LABEL_SCHEMA",
},
cli.StringFlag{
Name: "docker.registry",
Usage: "docker registry",
Value: "https://index.docker.io/v1/",
EnvVar: "PLUGIN_REGISTRY,DOCKER_REGISTRY",
},
cli.StringFlag{
Name: "docker.username",
Usage: "docker username",
EnvVar: "PLUGIN_USERNAME,DOCKER_USERNAME",
},
cli.StringFlag{
Name: "docker.password",
Usage: "docker password",
EnvVar: "PLUGIN_PASSWORD,DOCKER_PASSWORD",
},
cli.StringFlag{
Name: "docker.email",
Usage: "docker email",
EnvVar: "PLUGIN_EMAIL,DOCKER_EMAIL",
},
cli.StringFlag{
Name: "docker.config",
Usage: "docker json dockerconfig content",
EnvVar: "PLUGIN_CONFIG,DOCKER_PLUGIN_CONFIG",
},
cli.BoolTFlag{
Name: "docker.purge",
Usage: "docker should cleanup images",
EnvVar: "PLUGIN_PURGE",
},
cli.StringFlag{
Name: "repo.branch",
Usage: "repository default branch",
EnvVar: "DRONE_REPO_BRANCH",
},
cli.BoolFlag{
Name: "no-cache",
Usage: "do not use cached intermediate containers",
EnvVar: "PLUGIN_NO_CACHE",
},
cli.StringSliceFlag{
Name: "add-host",
Usage: "additional host:IP mapping",
EnvVar: "PLUGIN_ADD_HOST",
},
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}
func run(c *cli.Context) error {
plugin := docker.Plugin{
Dryrun: c.Bool("dry-run"),
Cleanup: c.BoolT("docker.purge"),
Login: docker.Login{
Registry: c.String("docker.registry"),
Username: c.String("docker.username"),
Password: c.String("docker.password"),
Email: c.String("docker.email"),
Config: c.String("docker.config"),
},
Build: docker.Build{
Remote: c.String("remote.url"),
Name: c.String("commit.sha"),
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
ArgsEnv: c.StringSlice("args-from-env"),
Target: c.String("target"),
Squash: c.Bool("squash"),
Pull: c.BoolT("pull-image"),
CacheFrom: c.StringSlice("cache-from"),
Compress: c.Bool("compress"),
Repo: c.String("repo"),
Labels: c.StringSlice("custom-labels"),
LabelSchema: c.StringSlice("label-schema"),
NoCache: c.Bool("no-cache"),
AddHost: c.StringSlice("add-host"),
Quiet: c.Bool("quiet"),
},
Daemon: docker.Daemon{
Registry: c.String("docker.registry"),
Mirror: c.String("daemon.mirror"),
StorageDriver: c.String("daemon.storage-driver"),
StoragePath: c.String("daemon.storage-path"),
Insecure: c.Bool("daemon.insecure"),
Disabled: c.Bool("daemon.off"),
IPv6: c.Bool("daemon.ipv6"),
Debug: c.Bool("daemon.debug"),
Bip: c.String("daemon.bip"),
DNS: c.StringSlice("daemon.dns"),
DNSSearch: c.StringSlice("daemon.dns-search"),
MTU: c.String("daemon.mtu"),
Experimental: c.Bool("daemon.experimental"),
},
}
if c.Bool("tags.auto") {
if docker.UseDefaultTag( // return true if tag event or default branch
c.String("commit.ref"),
c.String("repo.branch"),
) {
tag, err := docker.DefaultTagSuffix(
c.String("commit.ref"),
c.String("tags.suffix"),
)
if err != nil {
logrus.Printf("cannot build docker image for %s, invalid semantic version", c.String("commit.ref"))
return err
}
plugin.Build.Tags = tag
} else {
logrus.Printf("skipping automated docker build for %s", c.String("commit.ref"))
return nil
}
}
return plugin.Exec()
}

View File

@ -1,203 +0,0 @@
package main
import (
"encoding/base64"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"strconv"
"strings"
"github.com/joho/godotenv"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecr"
)
const defaultRegion = "us-east-1"
func main() {
// Load env-file if it exists first
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
godotenv.Load(env)
}
var (
repo = getenv("PLUGIN_REPO")
registry = getenv("PLUGIN_REGISTRY")
region = getenv("PLUGIN_REGION", "ECR_REGION", "AWS_REGION")
key = getenv("PLUGIN_ACCESS_KEY", "ECR_ACCESS_KEY", "AWS_ACCESS_KEY_ID")
secret = getenv("PLUGIN_SECRET_KEY", "ECR_SECRET_KEY", "AWS_SECRET_ACCESS_KEY")
create = parseBoolOrDefault(false, getenv("PLUGIN_CREATE_REPOSITORY", "ECR_CREATE_REPOSITORY"))
lifecyclePolicy = getenv("PLUGIN_LIFECYCLE_POLICY")
repositoryPolicy = getenv("PLUGIN_REPOSITORY_POLICY")
assumeRole = getenv("PLUGIN_ASSUME_ROLE")
)
// set the region
if region == "" {
region = defaultRegion
}
os.Setenv("AWS_REGION", region)
if key != "" && secret != "" {
os.Setenv("AWS_ACCESS_KEY_ID", key)
os.Setenv("AWS_SECRET_ACCESS_KEY", secret)
}
sess, err := session.NewSession(&aws.Config{Region: &region})
if err != nil {
log.Fatal(fmt.Sprintf("error creating aws session: %v", err))
}
svc := getECRClient(sess, assumeRole)
username, password, defaultRegistry, err := getAuthInfo(svc)
if registry == "" {
registry = defaultRegistry
}
if err != nil {
log.Fatal(fmt.Sprintf("error getting ECR auth: %v", err))
}
if !strings.HasPrefix(repo, registry) {
repo = fmt.Sprintf("%s/%s", registry, repo)
}
if create {
err = ensureRepoExists(svc, trimHostname(repo, registry))
if err != nil {
log.Fatal(fmt.Sprintf("error creating ECR repo: %v", err))
}
}
if lifecyclePolicy != "" {
p, err := ioutil.ReadFile(lifecyclePolicy)
if err != nil {
log.Fatal(err)
}
if err := uploadLifeCyclePolicy(svc, string(p), trimHostname(repo, registry)); err != nil {
log.Fatal(fmt.Sprintf("error uploading ECR lifecycle policy: %v", err))
}
}
if repositoryPolicy != "" {
p, err := ioutil.ReadFile(repositoryPolicy)
if err != nil {
log.Fatal(err)
}
if err := uploadRepositoryPolicy(svc, string(p), trimHostname(repo, registry)); err != nil {
log.Fatal(fmt.Sprintf("error uploading ECR repository policy. %v", err))
}
}
os.Setenv("PLUGIN_REPO", repo)
os.Setenv("PLUGIN_REGISTRY", registry)
os.Setenv("DOCKER_USERNAME", username)
os.Setenv("DOCKER_PASSWORD", password)
// invoke the base docker plugin binary
cmd := exec.Command("drone-docker")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err = cmd.Run(); err != nil {
os.Exit(1)
}
}
func trimHostname(repo, registry string) string {
repo = strings.TrimPrefix(repo, registry)
repo = strings.TrimLeft(repo, "/")
return repo
}
func ensureRepoExists(svc *ecr.ECR, name string) (err error) {
input := &ecr.CreateRepositoryInput{}
input.SetRepositoryName(name)
_, err = svc.CreateRepository(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == ecr.ErrCodeRepositoryAlreadyExistsException {
// eat it, we skip checking for existing to save two requests
err = nil
}
}
return
}
func uploadLifeCyclePolicy(svc *ecr.ECR, lifecyclePolicy string, name string) (err error) {
input := &ecr.PutLifecyclePolicyInput{}
input.SetLifecyclePolicyText(lifecyclePolicy)
input.SetRepositoryName(name)
_, err = svc.PutLifecyclePolicy(input)
return err
}
func uploadRepositoryPolicy(svc *ecr.ECR, repositoryPolicy string, name string) (err error) {
input := &ecr.SetRepositoryPolicyInput{}
input.SetPolicyText(repositoryPolicy)
input.SetRepositoryName(name)
_, err = svc.SetRepositoryPolicy(input)
return err
}
func getAuthInfo(svc *ecr.ECR) (username, password, registry string, err error) {
var result *ecr.GetAuthorizationTokenOutput
var decoded []byte
result, err = svc.GetAuthorizationToken(&ecr.GetAuthorizationTokenInput{})
if err != nil {
return
}
auth := result.AuthorizationData[0]
token := *auth.AuthorizationToken
decoded, err = base64.StdEncoding.DecodeString(token)
if err != nil {
return
}
registry = strings.TrimPrefix(*auth.ProxyEndpoint, "https://")
creds := strings.Split(string(decoded), ":")
username = creds[0]
password = creds[1]
return
}
func parseBoolOrDefault(defaultValue bool, s string) (result bool) {
var err error
result, err = strconv.ParseBool(s)
if err != nil {
result = false
}
return
}
func getenv(key ...string) (s string) {
for _, k := range key {
s = os.Getenv(k)
if s != "" {
return
}
}
return
}
func getECRClient(sess *session.Session, role string) *ecr.ECR {
if role == "" {
return ecr.New(sess)
}
return ecr.New(sess, &aws.Config{
Credentials: stscreds.NewCredentials(sess, role),
})
}

View File

@ -1,20 +0,0 @@
package main
import "testing"
func TestTrimHostname(t *testing.T) {
registry := "000000000000.dkr.ecr.us-east-1.amazonaws.com"
// map full repo path to expected repo name
repos := map[string]string{
registry + "/repo": "repo",
registry + "/namespace/repo": "namespace/repo",
registry + "/namespace/namespace/repo": "namespace/namespace/repo",
}
for repo, name := range repos {
splitName := trimHostname(repo, registry)
if splitName != name {
t.Errorf("%s is not equal to %s.", splitName, name)
}
}
}

View File

@ -1,74 +0,0 @@
package main
import (
"encoding/base64"
"os"
"os/exec"
"path"
"strings"
"github.com/joho/godotenv"
)
// gcr default username
const username = "_json_key"
func main() {
// Load env-file if it exists first
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
godotenv.Load(env)
}
var (
repo = getenv("PLUGIN_REPO")
registry = getenv("PLUGIN_REGISTRY")
password = getenv(
"PLUGIN_JSON_KEY",
"GCR_JSON_KEY",
"GOOGLE_CREDENTIALS",
"TOKEN",
)
)
// decode the token if base64 encoded
decoded, err := base64.StdEncoding.DecodeString(password)
if err == nil {
password = string(decoded)
}
// default registry value
if registry == "" {
registry = "gcr.io"
}
// must use the fully qualified repo name. If the
// repo name does not have the registry prefix we
// should prepend.
if !strings.HasPrefix(repo, registry) {
repo = path.Join(registry, repo)
}
os.Setenv("PLUGIN_REPO", repo)
os.Setenv("PLUGIN_REGISTRY", registry)
os.Setenv("DOCKER_USERNAME", username)
os.Setenv("DOCKER_PASSWORD", password)
// invoke the base docker plugin binary
cmd := exec.Command("drone-docker")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
os.Exit(1)
}
}
func getenv(key ...string) (s string) {
for _, k := range key {
s = os.Getenv(k)
if s != "" {
return
}
}
return
}

View File

@ -1,53 +0,0 @@
package main
import (
"os"
"os/exec"
"path"
"github.com/joho/godotenv"
)
func main() {
// Load env-file if it exists first
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
godotenv.Load(env)
}
var (
registry = "registry.heroku.com"
process = getenv("PLUGIN_PROCESS_TYPE")
app = getenv("PLUGIN_APP")
email = getenv("PLUGIN_EMAIL", "HEROKU_EMAIL")
key = getenv("PLUGIN_API_KEY", "HEROKU_API_KEY")
)
if process == "" {
process = "web"
}
os.Setenv("PLUGIN_REGISTRY", registry)
os.Setenv("PLUGIN_REPO", path.Join(registry, app, process))
os.Setenv("DOCKER_PASSWORD", key)
os.Setenv("DOCKER_USERNAME", email)
os.Setenv("DOCKER_EMAIL", email)
cmd := exec.Command("drone-docker")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
os.Exit(1)
}
}
func getenv(key ...string) (s string) {
for _, k := range key {
s = os.Getenv(k)
if s != "" {
return
}
}
return
}

View File

@ -1,11 +0,0 @@
// +build windows
package docker
const dockerExe = "C:\\bin\\docker.exe"
const dockerdExe = ""
const dockerHome = "C:\\ProgramData\\docker\\"
func (p Plugin) startDaemon() {
// this is a no-op on windows
}

View File

@ -39,24 +39,23 @@ type (
// Build defines Docker build parameters. // Build defines Docker build parameters.
Build struct { Build struct {
Remote string // Git remote URL Remote string // Git remote URL
Name string // Docker build using default named tag Name string // Docker build using default named tag
Dockerfile string // Docker build Dockerfile Dockerfile string // Docker build Dockerfile
Context string // Docker build context Context string // Docker build context
Tags []string // Docker build tags Tags []string // Docker build tags
Args []string // Docker build args Platforms []string // Docker build target platforms
ArgsEnv []string // Docker build args from env Args []string // Docker build args
Target string // Docker build target ArgsEnv []string // Docker build args from env
Squash bool // Docker build squash Target string // Docker build target
Pull bool // Docker build pull Squash bool // Docker build squash
CacheFrom []string // Docker build cache-from Pull bool // Docker build pull
Compress bool // Docker build compress CacheFrom []string // Docker build cache-from
Repo string // Docker build repository Compress bool // Docker build compress
LabelSchema []string // label-schema Label map Repo string // Docker build repository
Labels []string // Label map NoCache bool // Docker build no-cache
NoCache bool // Docker build no-cache AddHost []string // Docker build add-host
AddHost []string // Docker build add-host Quiet bool // Docker build quiet
Quiet bool // Docker build quiet
} }
// Plugin defines the Docker plugin parameters. // Plugin defines the Docker plugin parameters.
@ -127,6 +126,8 @@ func (p Plugin) Exec() error {
var cmds []*exec.Cmd var cmds []*exec.Cmd
cmds = append(cmds, commandVersion()) // docker version cmds = append(cmds, commandVersion()) // docker version
cmds = append(cmds, commandInfo()) // docker info cmds = append(cmds, commandInfo()) // docker info
cmds = append(cmds, commandBuilder())
cmds = append(cmds, commandBuildx())
// pre-pull cache images // pre-pull cache images
for _, img := range p.Build.CacheFrom { for _, img := range p.Build.CacheFrom {
@ -211,10 +212,20 @@ func commandInfo() *exec.Cmd {
return exec.Command(dockerExe, "info") return exec.Command(dockerExe, "info")
} }
func commandBuilder() *exec.Cmd {
return exec.Command(dockerExe, "buildx", "create", "--use")
}
func commandBuildx() *exec.Cmd {
return exec.Command(dockerExe, "buildx", "ls")
}
// helper function to create the docker build command. // helper function to create the docker build command.
func commandBuild(build Build) *exec.Cmd { func commandBuild(build Build) *exec.Cmd {
args := []string{ args := []string{
"buildx",
"build", "build",
"--load",
"--rm=true", "--rm=true",
"-f", build.Dockerfile, "-f", build.Dockerfile,
"-t", build.Name, "-t", build.Name,
@ -252,25 +263,8 @@ func commandBuild(build Build) *exec.Cmd {
args = append(args, "--quiet") args = append(args, "--quiet")
} }
labelSchema := []string{ if len(build.Platforms) > 0 {
"schema-version=1.0", args = append(args, "--platform", strings.Join(build.Platforms[:], ","))
fmt.Sprintf("build-date=%s", time.Now().Format(time.RFC3339)),
fmt.Sprintf("vcs-ref=%s", build.Name),
fmt.Sprintf("vcs-url=%s", build.Remote),
}
if len(build.LabelSchema) > 0 {
labelSchema = append(labelSchema, build.LabelSchema...)
}
for _, label := range labelSchema {
args = append(args, "--label", fmt.Sprintf("org.label-schema.%s", label))
}
if len(build.Labels) > 0 {
for _, label := range build.Labels {
args = append(args, "--label", label)
}
} }
return exec.Command(dockerExe, args...) return exec.Command(dockerExe, args...)

26
docker/Dockerfile.amd64 Normal file
View File

@ -0,0 +1,26 @@
FROM amd64/docker:20.10-dind
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.title="drone-docker-buildx"
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-docker-buildx"
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-docker-buildx"
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-docker-buildx"
ARG BUILDX_VERSION
# renovate: datasource=github-releases depName=docker/buildx
ENV BUILDX_VERSION="${BUILDX_VERSION:-0.5.0}"
ENV DOCKER_HOST=unix:///var/run/docker.sock
RUN apk --update add --virtual .build-deps curl && \
mkdir -p /usr/lib/docker/cli-plugins/ && \
curl -SsL -o /usr/lib/docker/cli-plugins/docker-buildx "https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64" && \
chmod 755 /usr/lib/docker/cli-plugins/docker-buildx && \
apk del .build-deps && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/*
ADD release/linux/amd64/drone-docker-buildx /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "drone-docker-buildx"]

26
docker/Dockerfile.arm Normal file
View File

@ -0,0 +1,26 @@
FROM amd64/docker:20.10-dind
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.title="drone-docker-buildx"
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-docker-buildx"
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-docker-buildx"
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-docker-buildx"
ARG BUILDX_VERSION
# renovate: datasource=github-releases depName=docker/buildx
ENV BUILDX_VERSION="${BUILDX_VERSION:-0.5.0}"
ENV DOCKER_HOST=unix:///var/run/docker.sock
RUN apk --update add --virtual .build-deps curl && \
mkdir -p /usr/lib/docker/cli-plugins/ && \
curl -SsL -o /usr/lib/docker/cli-plugins/docker-buildx "https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64" && \
chmod 755 /usr/lib/docker/cli-plugins/docker-buildx && \
apk del .build-deps && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/*
ADD release/linux/amd64/drone-docker-buildx /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "drone-docker-buildx"]

26
docker/Dockerfile.arm64 Normal file
View File

@ -0,0 +1,26 @@
FROM amd664v8/docker:20.10-dind
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.title="drone-docker-buildx"
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-docker-buildx"
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-docker-buildx"
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-docker-buildx"
ARG BUILDX_VERSION
# renovate: datasource=github-releases depName=docker/buildx
ENV BUILDX_VERSION="${BUILDX_VERSION:-0.5.0}"
ENV DOCKER_HOST=unix:///var/run/docker.sock
RUN apk --update add --virtual .build-deps curl && \
mkdir -p /usr/lib/docker/cli-plugins/ && \
curl -SsL -o /usr/lib/docker/cli-plugins/docker-buildx "https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64" && \
chmod 755 /usr/lib/docker/cli-plugins/docker-buildx && \
apk del .build-deps && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/*
ADD release/linux/amd64/drone-docker-buildx /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "drone-docker-buildx"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-amd64
ADD release/linux/amd64/drone-acr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-acr"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-arm
ADD release/linux/arm/drone-acr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-acr"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-arm64
ADD release/linux/arm64/drone-acr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-acr"]

View File

@ -1,10 +0,0 @@
# escape=`
FROM plugins/docker:windows-1803
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ACR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-acr.exe C:/bin/drone-acr.exe
ENTRYPOINT [ "C:\\bin\\drone-acr.exe" ]

View File

@ -1,10 +0,0 @@
# escape=`
FROM plugins/docker:windows-1809
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ACR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-acr.exe C:/bin/drone-acr.exe
ENTRYPOINT [ "C:\\bin\\drone-acr.exe" ]

View File

@ -1,37 +0,0 @@
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
platform:
architecture: amd64
os: windows
version: 1803
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
platform:
architecture: amd64
os: windows
version: 1809

View File

@ -1,6 +0,0 @@
FROM docker:19.03.8-dind
ENV DOCKER_HOST=unix:///var/run/docker.sock
ADD release/linux/amd64/drone-docker /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]

View File

@ -1,6 +0,0 @@
FROM arm32v6/docker:19.03.8-dind
ENV DOCKER_HOST=unix:///var/run/docker.sock
ADD release/linux/arm/drone-docker /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]

View File

@ -1,6 +0,0 @@
FROM arm64v8/docker:19.03.8-dind
ENV DOCKER_HOST=unix:///var/run/docker.sock
ADD release/linux/arm64/drone-docker /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]

View File

@ -1,26 +0,0 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:1803 as download
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV DOCKER_VERSION 18.09.1
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
Remove-Item -Path innoextract.zip
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
RUN /innoextract.exe dockertoolbox.exe
FROM plugins/base:windows-1803
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
COPY --from=download /app/docker.exe C:/bin/docker.exe
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]

View File

@ -1,27 +0,0 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:1809 as download
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV DOCKER_VERSION 18.09.1
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
Remove-Item -Path innoextract.zip
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
RUN /innoextract.exe dockertoolbox.exe
FROM mcr.microsoft.com/windows/nanoserver:1809
USER ContainerAdministrator
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
COPY --from=download /app/docker.exe C:/bin/docker.exe
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]

View File

@ -1,28 +0,0 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:1903 as download
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV DOCKER_VERSION 19.03.1
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.7-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
Remove-Item -Path innoextract.zip
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
RUN /innoextract.exe dockertoolbox.exe
FROM mcr.microsoft.com/windows/nanoserver:1903
USER ContainerAdministrator
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
RUN mkdir C:\bin
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
COPY --from=download /app/docker.exe C:/bin/docker.exe
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]

View File

@ -1,28 +0,0 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:1909 as download
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV DOCKER_VERSION 19.03.1
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.7-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
Remove-Item -Path innoextract.zip
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
RUN /innoextract.exe dockertoolbox.exe
FROM mcr.microsoft.com/windows/nanoserver:1909
USER ContainerAdministrator
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
RUN mkdir C:\bin
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
COPY --from=download /app/docker.exe C:/bin/docker.exe
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]

View File

@ -1,49 +0,0 @@
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
platform:
architecture: amd64
os: windows
version: 1803
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
platform:
architecture: amd64
os: windows
version: 1809
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
platform:
architecture: amd64
os: windows
version: 1903
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
platform:
architecture: amd64
os: windows
version: 1909

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-amd64
ADD release/linux/amd64/drone-ecr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-arm
ADD release/linux/arm/drone-ecr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-arm64
ADD release/linux/arm64/drone-ecr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"]

View File

@ -1,10 +0,0 @@
# escape=`
FROM plugins/docker:windows-1803
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ECR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-ecr.exe C:/bin/drone-ecr.exe
ENTRYPOINT [ "C:\\bin\\drone-ecr.exe" ]

View File

@ -1,10 +0,0 @@
# escape=`
FROM plugins/docker:windows-1809
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ECR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-ecr.exe C:/bin/drone-ecr.exe
ENTRYPOINT [ "C:\\bin\\drone-ecr.exe" ]

View File

@ -1,37 +0,0 @@
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
platform:
architecture: amd64
os: windows
version: 1803
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
platform:
architecture: amd64
os: windows
version: 1809

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-amd64
ADD release/linux/amd64/drone-gcr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-arm
ADD release/linux/arm/drone-gcr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-arm64
ADD release/linux/arm64/drone-gcr /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"]

View File

@ -1,10 +0,0 @@
# escape=`
FROM plugins/docker:windows-1803
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone GCR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-gcr.exe C:/bin/drone-gcr.exe
ENTRYPOINT [ "C:\\bin\\drone-gcr.exe" ]

View File

@ -1,10 +0,0 @@
# escape=`
FROM plugins/docker:windows-1809
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone GCR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-gcr.exe C:/bin/drone-gcr.exe
ENTRYPOINT [ "C:\\bin\\drone-gcr.exe" ]

View File

@ -1,37 +0,0 @@
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
-
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
-
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7
-
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
platform:
architecture: amd64
os: windows
version: 1803
-
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
platform:
architecture: amd64
os: windows
version: 1809

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-amd64
ADD release/linux/amd64/drone-heroku /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-arm
ADD release/linux/arm/drone-heroku /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"]

View File

@ -1,4 +0,0 @@
FROM plugins/docker:linux-arm64
ADD release/linux/arm64/drone-heroku /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"]

View File

@ -1,25 +0,0 @@
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
-
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
-
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7

13
go.mod
View File

@ -2,11 +2,16 @@ module github.com/drone-plugins/drone-docker
require ( require (
github.com/aws/aws-sdk-go v1.26.7 github.com/aws/aws-sdk-go v1.26.7
github.com/coreos/go-semver v0.2.0 github.com/coreos/go-semver v0.3.0
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/joho/godotenv v1.3.0 github.com/joho/godotenv v1.3.0
github.com/sirupsen/logrus v1.3.0 github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/urfave/cli v1.22.2 github.com/russross/blackfriday/v2 v2.1.0 // indirect
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e // indirect github.com/sirupsen/logrus v1.7.0
github.com/stretchr/objx v0.1.1 // indirect
github.com/urfave/cli v1.22.5
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061 // indirect
golang.org/x/text v0.3.0 // indirect golang.org/x/text v0.3.0 // indirect
) )

19
go.sum
View File

@ -3,8 +3,12 @@ github.com/aws/aws-sdk-go v1.26.7 h1:ObjEnmzvSdYy8KVd3me7v/UMyCn81inLy2SyoIPoBkg
github.com/aws/aws-sdk-go v1.26.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.26.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
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 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.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
@ -13,14 +17,19 @@ 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/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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 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.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 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME= github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=
github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
@ -28,12 +37,22 @@ 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.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo= github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061 h1:DQmQoKxQWtyybCtX/3dIuDBcAhFszqq8YiNeS6sNu1c=
golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=

View File

@ -1,206 +0,0 @@
local windows_pipe = '\\\\\\\\.\\\\pipe\\\\docker_engine';
local windows_pipe_volume = 'docker_pipe';
local test_pipeline_name = 'testing';
local windows(os) = os == 'windows';
local golang_image(os, version) =
'golang:' + '1.11' + if windows(os) then '-windowsservercore-' + version else '';
{
test(os='linux', arch='amd64', version='')::
local is_windows = windows(os);
local golang = golang_image(os, version);
local volumes = if is_windows then [{name: 'gopath', path: 'C:\\\\gopath'}] else [{name: 'gopath', path: '/go',}];
{
kind: 'pipeline',
name: test_pipeline_name,
platform: {
os: os,
arch: arch,
version: if std.length(version) > 0 then version,
},
steps: [
{
name: 'vet',
image: golang,
pull: 'always',
environment: {
GO111MODULE: 'on',
},
commands: [
'go vet ./...',
],
volumes: volumes,
},
{
name: 'test',
image: golang,
pull: 'always',
environment: {
GO111MODULE: 'on',
},
commands: [
'go test -cover ./...',
],
volumes: volumes,
},
],
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
'refs/pull/**',
],
},
volumes: [{name: 'gopath', temp: {}}]
},
build(name, os='linux', arch='amd64', version='')::
local is_windows = windows(os);
local tag = if is_windows then os + '-' + version else os + '-' + arch;
local file_suffix = std.strReplace(tag, '-', '.');
local volumes = if is_windows then [{ name: windows_pipe_volume, path: windows_pipe }] else [];
local golang = golang_image(os, version);
local plugin_repo = 'plugins/' + name;
local extension = if is_windows then '.exe' else '';
local depends_on = if name == 'docker' then [test_pipeline_name] else [tag + '-docker'];
{
kind: 'pipeline',
name: tag + '-' + name,
platform: {
os: os,
arch: arch,
version: if std.length(version) > 0 then version,
},
steps: [
{
name: 'build-push',
image: golang,
pull: 'always',
environment: {
CGO_ENABLED: '0',
GO111MODULE: 'on',
},
commands: [
'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/' + os + '/' + arch + '/drone-' + name + extension + ' ./cmd/drone-' + name,
],
when: {
event: {
exclude: ['tag'],
},
},
},
{
name: 'build-tag',
image: golang,
pull: 'always',
environment: {
CGO_ENABLED: '0',
GO111MODULE: 'on',
},
commands: [
'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/' + os + '/' + arch + '/drone-' + name + extension + ' ./cmd/drone-' + name,
],
when: {
event: ['tag'],
},
},
if name == "docker" then {
name: 'executable',
image: golang,
pull: 'always',
commands: [
'./release/' + os + '/' + arch + '/drone-' + name + extension + ' --help',
],
},
{
name: 'dryrun',
image: 'plugins/docker:' + tag,
pull: 'always',
settings: {
dry_run: true,
tags: tag,
dockerfile: 'docker/'+ name +'/Dockerfile.' + file_suffix,
daemon_off: if is_windows then 'true' else 'false',
repo: plugin_repo,
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
volumes: if std.length(volumes) > 0 then volumes,
when: {
event: ['pull_request'],
},
},
{
name: 'publish',
image: 'plugins/docker:' + tag,
pull: 'always',
settings: {
auto_tag: true,
auto_tag_suffix: tag,
daemon_off: if is_windows then 'true' else 'false',
dockerfile: 'docker/' + name + '/Dockerfile.' + file_suffix,
repo: plugin_repo,
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
volumes: if std.length(volumes) > 0 then volumes,
when: {
event: {
exclude: ['pull_request'],
},
},
},
],
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
'refs/pull/**',
],
},
depends_on: depends_on,
volumes: if is_windows then [{ name: windows_pipe_volume, host: { path: windows_pipe } }],
},
notifications(name, os='linux', arch='amd64', version='', depends_on=[])::
{
kind: 'pipeline',
name: 'notifications-' + name,
platform: {
os: os,
arch: arch,
version: if std.length(version) > 0 then version,
},
steps: [
{
name: 'manifest',
image: 'plugins/manifest',
pull: 'always',
settings: {
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'docker/' + name + '/manifest.tmpl',
ignore_missing: true,
auto_tag: true,
},
},
{
name: 'microbadger',
image: 'plugins/webhook',
pull: 'always',
settings: {
urls: { from_secret: 'microbadger_' + name },
},
},
],
depends_on: [x + '-' + name for x in depends_on],
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
},
},
}

4
renovate.json Normal file
View File

@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>thegeeklab/renovate-presets"]
}