mirror of
https://github.com/thegeeklab/drone-docker.git
synced 2024-09-28 18:28:12 +00:00
Compare commits
54 Commits
Author | SHA1 | Date | |
---|---|---|---|
c9b8ea3c6a | |||
|
2c152cce3c | ||
63baa5cc0d | |||
|
e35e3f6208 | ||
|
9bef137ed6 | ||
fbc9427cda | |||
5303f6a5ca | |||
|
dd6fc6ce42 | ||
|
dd65477400 | ||
5848ea5719 | |||
|
9b558675eb | ||
81094ee3c5 | |||
|
0e88134cab | ||
|
d9a5ee9d4f | ||
|
afe0ab1105 | ||
|
c77d8d07b7 | ||
|
76e1cc61ec | ||
|
15da7b71db | ||
|
afaaed742d | ||
|
3409c7c2ac | ||
|
17da5790a1 | ||
992117783a | |||
|
7482633d35 | ||
|
59800776fc | ||
d6219f41df | |||
2932e7c616 | |||
|
f323347239 | ||
78691a84db | |||
|
ce9cd29b46 | ||
|
64c662d7c0 | ||
|
9450ca4416 | ||
1eb49849a9 | |||
f2b247463c | |||
29243448f0 | |||
bd8a7ffab9 | |||
dd51fb117d | |||
1b0ed2cbcf | |||
7bd5096b3e | |||
eedb9aee12 | |||
|
ad71232103 | ||
|
2eb88a0d33 | ||
|
593688263e | ||
6aa6d8ae0c | |||
b100a992d7 | |||
d3ed9218b9 | |||
5da3470af6 | |||
965a93f4ad | |||
90d501f42b | |||
0a0372b4d2 | |||
2cd303ecfc | |||
24fa9926ab | |||
c74867e3c9 | |||
|
5ee7554d2b | ||
4b1e479d93 |
@ -10,3 +10,4 @@ json
|
|||||||
config
|
config
|
||||||
host:ip
|
host:ip
|
||||||
multiarch
|
multiarch
|
||||||
|
DockerHub
|
||||||
|
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!dist/
|
@ -1,6 +1,5 @@
|
|||||||
local PipelineTest = {
|
local PipelineTest = {
|
||||||
kind: 'pipeline',
|
kind: 'pipeline',
|
||||||
image_pull_secrets: ['docker_config'],
|
|
||||||
name: 'test',
|
name: 'test',
|
||||||
platform: {
|
platform: {
|
||||||
os: 'linux',
|
os: 'linux',
|
||||||
@ -9,7 +8,7 @@ local PipelineTest = {
|
|||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
name: 'deps',
|
name: 'deps',
|
||||||
image: 'golang:1.18',
|
image: 'golang:1.19',
|
||||||
commands: [
|
commands: [
|
||||||
'make deps',
|
'make deps',
|
||||||
],
|
],
|
||||||
@ -22,7 +21,7 @@ local PipelineTest = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'lint',
|
name: 'lint',
|
||||||
image: 'golang:1.18',
|
image: 'golang:1.19',
|
||||||
commands: [
|
commands: [
|
||||||
'make lint',
|
'make lint',
|
||||||
],
|
],
|
||||||
@ -35,7 +34,7 @@ local PipelineTest = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
image: 'golang:1.18',
|
image: 'golang:1.19',
|
||||||
commands: [
|
commands: [
|
||||||
'make test',
|
'make test',
|
||||||
],
|
],
|
||||||
@ -61,7 +60,6 @@ local PipelineTest = {
|
|||||||
|
|
||||||
local PipelineBuildBinaries = {
|
local PipelineBuildBinaries = {
|
||||||
kind: 'pipeline',
|
kind: 'pipeline',
|
||||||
image_pull_secrets: ['docker_config'],
|
|
||||||
name: 'build-binaries',
|
name: 'build-binaries',
|
||||||
platform: {
|
platform: {
|
||||||
os: 'linux',
|
os: 'linux',
|
||||||
@ -70,8 +68,9 @@ local PipelineBuildBinaries = {
|
|||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
name: 'build',
|
name: 'build',
|
||||||
image: 'techknowlogick/xgo:go-1.18.x',
|
image: 'techknowlogick/xgo:go-1.19.x',
|
||||||
commands: [
|
commands: [
|
||||||
|
'ln -s /drone/src /source',
|
||||||
'make release',
|
'make release',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -79,7 +78,7 @@ local PipelineBuildBinaries = {
|
|||||||
name: 'executable',
|
name: 'executable',
|
||||||
image: 'alpine',
|
image: 'alpine',
|
||||||
commands: [
|
commands: [
|
||||||
'$(find dist/ -executable -type f | grep drone-docker-linux-amd64) --help',
|
'$(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -127,7 +126,6 @@ local PipelineBuildBinaries = {
|
|||||||
|
|
||||||
local PipelineBuildContainer(arch='amd64') = {
|
local PipelineBuildContainer(arch='amd64') = {
|
||||||
kind: 'pipeline',
|
kind: 'pipeline',
|
||||||
image_pull_secrets: ['docker_config'],
|
|
||||||
name: 'build-container-' + arch,
|
name: 'build-container-' + arch,
|
||||||
platform: {
|
platform: {
|
||||||
os: 'linux',
|
os: 'linux',
|
||||||
@ -136,21 +134,18 @@ local PipelineBuildContainer(arch='amd64') = {
|
|||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
name: 'build',
|
name: 'build',
|
||||||
image: 'golang:1.18',
|
image: 'golang:1.19',
|
||||||
commands: [
|
commands: [
|
||||||
'make build',
|
'make build',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'dryrun',
|
name: 'dryrun',
|
||||||
image: 'plugins/docker:19',
|
image: 'thegeeklab/drone-docker:20',
|
||||||
settings: {
|
settings: {
|
||||||
config: { from_secret: 'docker_config' },
|
|
||||||
dry_run: true,
|
dry_run: true,
|
||||||
dockerfile: 'docker/Dockerfile.' + arch,
|
dockerfile: 'docker/Dockerfile.' + arch,
|
||||||
repo: 'thegeeklab/${DRONE_REPO_NAME}',
|
repo: 'thegeeklab/${DRONE_REPO_NAME}',
|
||||||
username: { from_secret: 'docker_username' },
|
|
||||||
password: { from_secret: 'docker_password' },
|
|
||||||
},
|
},
|
||||||
depends_on: ['build'],
|
depends_on: ['build'],
|
||||||
when: {
|
when: {
|
||||||
@ -159,9 +154,8 @@ local PipelineBuildContainer(arch='amd64') = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'publish-dockerhub',
|
name: 'publish-dockerhub',
|
||||||
image: 'plugins/docker:19',
|
image: 'thegeeklab/drone-docker:20',
|
||||||
settings: {
|
settings: {
|
||||||
config: { from_secret: 'docker_config' },
|
|
||||||
auto_tag: true,
|
auto_tag: true,
|
||||||
auto_tag_suffix: arch,
|
auto_tag_suffix: arch,
|
||||||
dockerfile: 'docker/Dockerfile.' + arch,
|
dockerfile: 'docker/Dockerfile.' + arch,
|
||||||
@ -176,9 +170,8 @@ local PipelineBuildContainer(arch='amd64') = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'publish-quay',
|
name: 'publish-quay',
|
||||||
image: 'plugins/docker:19',
|
image: 'thegeeklab/drone-docker:20',
|
||||||
settings: {
|
settings: {
|
||||||
config: { from_secret: 'docker_config' },
|
|
||||||
auto_tag: true,
|
auto_tag: true,
|
||||||
auto_tag_suffix: arch,
|
auto_tag_suffix: arch,
|
||||||
dockerfile: 'docker/Dockerfile.' + arch,
|
dockerfile: 'docker/Dockerfile.' + arch,
|
||||||
@ -221,9 +214,8 @@ local PipelineDocs = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'spellcheck',
|
name: 'spellcheck',
|
||||||
image: 'node:lts-alpine',
|
image: 'thegeeklab/alpine-tools',
|
||||||
commands: [
|
commands: [
|
||||||
'npm install -g spellchecker-cli',
|
|
||||||
"spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions",
|
"spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions",
|
||||||
],
|
],
|
||||||
environment: {
|
environment: {
|
||||||
@ -249,7 +241,6 @@ local PipelineDocs = {
|
|||||||
'build-binaries',
|
'build-binaries',
|
||||||
'build-container-amd64',
|
'build-container-amd64',
|
||||||
'build-container-arm64',
|
'build-container-arm64',
|
||||||
'build-container-arm',
|
|
||||||
],
|
],
|
||||||
trigger: {
|
trigger: {
|
||||||
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
||||||
@ -258,7 +249,6 @@ local PipelineDocs = {
|
|||||||
|
|
||||||
local PipelineNotifications = {
|
local PipelineNotifications = {
|
||||||
kind: 'pipeline',
|
kind: 'pipeline',
|
||||||
image_pull_secrets: ['docker_config'],
|
|
||||||
name: 'notifications',
|
name: 'notifications',
|
||||||
platform: {
|
platform: {
|
||||||
os: 'linux',
|
os: 'linux',
|
||||||
@ -354,7 +344,6 @@ local PipelineNotifications = {
|
|||||||
PipelineBuildBinaries,
|
PipelineBuildBinaries,
|
||||||
PipelineBuildContainer(arch='amd64'),
|
PipelineBuildContainer(arch='amd64'),
|
||||||
PipelineBuildContainer(arch='arm64'),
|
PipelineBuildContainer(arch='arm64'),
|
||||||
PipelineBuildContainer(arch='arm'),
|
|
||||||
PipelineDocs,
|
PipelineDocs,
|
||||||
PipelineNotifications,
|
PipelineNotifications,
|
||||||
]
|
]
|
||||||
|
153
.drone.yml
153
.drone.yml
@ -8,7 +8,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: deps
|
- name: deps
|
||||||
image: golang:1.18
|
image: golang:1.19
|
||||||
commands:
|
commands:
|
||||||
- make deps
|
- make deps
|
||||||
volumes:
|
volumes:
|
||||||
@ -16,7 +16,7 @@ steps:
|
|||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: lint
|
- name: lint
|
||||||
image: golang:1.18
|
image: golang:1.19
|
||||||
commands:
|
commands:
|
||||||
- make lint
|
- make lint
|
||||||
volumes:
|
volumes:
|
||||||
@ -24,7 +24,7 @@ steps:
|
|||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
image: golang:1.18
|
image: golang:1.19
|
||||||
commands:
|
commands:
|
||||||
- make test
|
- make test
|
||||||
volumes:
|
volumes:
|
||||||
@ -35,9 +35,6 @@ volumes:
|
|||||||
- name: godeps
|
- name: godeps
|
||||||
temp: {}
|
temp: {}
|
||||||
|
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
@ -54,14 +51,15 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: techknowlogick/xgo:go-1.18.x
|
image: techknowlogick/xgo:go-1.19.x
|
||||||
commands:
|
commands:
|
||||||
|
- ln -s /drone/src /source
|
||||||
- make release
|
- make release
|
||||||
|
|
||||||
- name: executable
|
- name: executable
|
||||||
image: alpine
|
image: alpine
|
||||||
commands:
|
commands:
|
||||||
- $(find dist/ -executable -type f | grep drone-docker-linux-amd64) --help
|
- $(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help
|
||||||
|
|
||||||
- name: changelog-generate
|
- name: changelog-generate
|
||||||
image: thegeeklab/git-chglog
|
image: thegeeklab/git-chglog
|
||||||
@ -89,9 +87,6 @@ steps:
|
|||||||
ref:
|
ref:
|
||||||
- refs/tags/**
|
- refs/tags/**
|
||||||
|
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
@ -111,22 +106,16 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: golang:1.18
|
image: golang:1.19
|
||||||
commands:
|
commands:
|
||||||
- make build
|
- make build
|
||||||
|
|
||||||
- name: dryrun
|
- name: dryrun
|
||||||
image: plugins/docker:19
|
image: thegeeklab/drone-docker:20
|
||||||
settings:
|
settings:
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.amd64
|
dockerfile: docker/Dockerfile.amd64
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
when:
|
when:
|
||||||
ref:
|
ref:
|
||||||
- refs/pull/**
|
- refs/pull/**
|
||||||
@ -134,12 +123,10 @@ steps:
|
|||||||
- build
|
- build
|
||||||
|
|
||||||
- name: publish-dockerhub
|
- name: publish-dockerhub
|
||||||
image: plugins/docker:19
|
image: thegeeklab/drone-docker:20
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: amd64
|
auto_tag_suffix: amd64
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.amd64
|
dockerfile: docker/Dockerfile.amd64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -154,12 +141,10 @@ steps:
|
|||||||
- dryrun
|
- dryrun
|
||||||
|
|
||||||
- name: publish-quay
|
- name: publish-quay
|
||||||
image: plugins/docker:19
|
image: thegeeklab/drone-docker:20
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: amd64
|
auto_tag_suffix: amd64
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.amd64
|
dockerfile: docker/Dockerfile.amd64
|
||||||
password:
|
password:
|
||||||
from_secret: quay_password
|
from_secret: quay_password
|
||||||
@ -174,9 +159,6 @@ steps:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- dryrun
|
- dryrun
|
||||||
|
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
@ -196,22 +178,16 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: golang:1.18
|
image: golang:1.19
|
||||||
commands:
|
commands:
|
||||||
- make build
|
- make build
|
||||||
|
|
||||||
- name: dryrun
|
- name: dryrun
|
||||||
image: plugins/docker:19
|
image: thegeeklab/drone-docker:20
|
||||||
settings:
|
settings:
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.arm64
|
dockerfile: docker/Dockerfile.arm64
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
when:
|
when:
|
||||||
ref:
|
ref:
|
||||||
- refs/pull/**
|
- refs/pull/**
|
||||||
@ -219,12 +195,10 @@ steps:
|
|||||||
- build
|
- build
|
||||||
|
|
||||||
- name: publish-dockerhub
|
- name: publish-dockerhub
|
||||||
image: plugins/docker:19
|
image: thegeeklab/drone-docker:20
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: arm64
|
auto_tag_suffix: arm64
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.arm64
|
dockerfile: docker/Dockerfile.arm64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -239,12 +213,10 @@ steps:
|
|||||||
- dryrun
|
- dryrun
|
||||||
|
|
||||||
- name: publish-quay
|
- name: publish-quay
|
||||||
image: plugins/docker:19
|
image: thegeeklab/drone-docker:20
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: arm64
|
auto_tag_suffix: arm64
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.arm64
|
dockerfile: docker/Dockerfile.arm64
|
||||||
password:
|
password:
|
||||||
from_secret: quay_password
|
from_secret: quay_password
|
||||||
@ -259,94 +231,6 @@ steps:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- dryrun
|
- dryrun
|
||||||
|
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
- refs/pull/**
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: build-container-arm
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: arm
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: golang:1.18
|
|
||||||
commands:
|
|
||||||
- make build
|
|
||||||
|
|
||||||
- name: dryrun
|
|
||||||
image: plugins/docker:19
|
|
||||||
settings:
|
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.arm
|
|
||||||
dry_run: true
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
when:
|
|
||||||
ref:
|
|
||||||
- refs/pull/**
|
|
||||||
depends_on:
|
|
||||||
- build
|
|
||||||
|
|
||||||
- name: publish-dockerhub
|
|
||||||
image: plugins/docker:19
|
|
||||||
settings:
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: arm
|
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.arm
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
when:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
depends_on:
|
|
||||||
- dryrun
|
|
||||||
|
|
||||||
- name: publish-quay
|
|
||||||
image: plugins/docker:19
|
|
||||||
settings:
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: arm
|
|
||||||
config:
|
|
||||||
from_secret: docker_config
|
|
||||||
dockerfile: docker/Dockerfile.arm
|
|
||||||
password:
|
|
||||||
from_secret: quay_password
|
|
||||||
registry: quay.io
|
|
||||||
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
|
|
||||||
username:
|
|
||||||
from_secret: quay_username
|
|
||||||
when:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
depends_on:
|
|
||||||
- dryrun
|
|
||||||
|
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
@ -374,9 +258,8 @@ steps:
|
|||||||
- markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'
|
- markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'
|
||||||
|
|
||||||
- name: spellcheck
|
- name: spellcheck
|
||||||
image: node:lts-alpine
|
image: thegeeklab/alpine-tools
|
||||||
commands:
|
commands:
|
||||||
- npm install -g spellchecker-cli
|
|
||||||
- spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions
|
- spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions
|
||||||
environment:
|
environment:
|
||||||
FORCE_COLOR: true
|
FORCE_COLOR: true
|
||||||
@ -405,7 +288,6 @@ depends_on:
|
|||||||
- build-binaries
|
- build-binaries
|
||||||
- build-container-amd64
|
- build-container-amd64
|
||||||
- build-container-arm64
|
- build-container-arm64
|
||||||
- build-container-arm
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@ -486,9 +368,6 @@ steps:
|
|||||||
- success
|
- success
|
||||||
- failure
|
- failure
|
||||||
|
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
@ -502,6 +381,6 @@ depends_on:
|
|||||||
|
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: 9ee9ec07028e26d74e30bb239266b01dd105621178225d50bf2a214712d816e9
|
hmac: 2678272f471334df973c0b9c0e8886dcf0941f5581b460b116fb48c88e7a14ba
|
||||||
|
|
||||||
...
|
...
|
||||||
|
5
.github/settings.yml
vendored
5
.github/settings.yml
vendored
@ -52,14 +52,17 @@ branches:
|
|||||||
strict: false
|
strict: false
|
||||||
contexts:
|
contexts:
|
||||||
- continuous-integration/drone/pr
|
- continuous-integration/drone/pr
|
||||||
enforce_admins: null
|
enforce_admins: true
|
||||||
|
required_linear_history: true
|
||||||
restrictions: null
|
restrictions: null
|
||||||
- name: docs
|
- name: docs
|
||||||
protection:
|
protection:
|
||||||
required_pull_request_reviews: null
|
required_pull_request_reviews: null
|
||||||
required_status_checks: null
|
required_status_checks: null
|
||||||
enforce_admins: true
|
enforce_admins: true
|
||||||
|
required_linear_history: true
|
||||||
restrictions:
|
restrictions:
|
||||||
|
apps: []
|
||||||
users: []
|
users: []
|
||||||
teams:
|
teams:
|
||||||
- bot
|
- bot
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
/dist/
|
/dist/
|
||||||
|
/release/
|
||||||
/drone-docker*
|
/drone-docker*
|
||||||
|
|
||||||
coverage.out
|
coverage.out
|
||||||
|
18
Makefile
18
Makefile
@ -1,7 +1,7 @@
|
|||||||
# renovate: datasource=github-releases depName=mvdan/gofumpt
|
# renovate: datasource=github-releases depName=mvdan/gofumpt
|
||||||
GOFUMPT_PACKAGE_VERSION := v0.3.1
|
GOFUMPT_PACKAGE_VERSION := v0.4.0
|
||||||
# renovate: datasource=github-releases depName=golangci/golangci-lint
|
# renovate: datasource=github-releases depName=golangci/golangci-lint
|
||||||
GOLANGCI_LINT_PACKAGE_VERSION := v1.45.2
|
GOLANGCI_LINT_PACKAGE_VERSION := v1.50.1
|
||||||
|
|
||||||
EXECUTABLE := drone-docker
|
EXECUTABLE := drone-docker
|
||||||
|
|
||||||
@ -19,8 +19,8 @@ GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@$(G
|
|||||||
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
||||||
|
|
||||||
GENERATE ?=
|
GENERATE ?=
|
||||||
XGO_VERSION := go-1.18.x
|
XGO_VERSION := go-1.19.x
|
||||||
XGO_TARGETS ?= linux/amd64,linux/arm-6,linux/arm-7,linux/arm64
|
XGO_TARGETS ?= linux/amd64,linux/arm64
|
||||||
|
|
||||||
TAGS ?= netgo
|
TAGS ?= netgo
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ all: clean build
|
|||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
go clean -i ./...
|
$(GO) clean -i ./...
|
||||||
rm -rf $(DIST_DIRS)
|
rm -rf $(DIST_DIRS)
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
@ -59,24 +59,24 @@ lint: golangci-lint
|
|||||||
|
|
||||||
.PHONY: generate
|
.PHONY: generate
|
||||||
generate:
|
generate:
|
||||||
go generate $(GENERATE)
|
$(GO) generate $(GENERATE)
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
go test -v -coverprofile coverage.out $(PACKAGES)
|
$(GO) test -v -coverprofile coverage.out $(PACKAGES)
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(DIST)/$(EXECUTABLE)
|
build: $(DIST)/$(EXECUTABLE)
|
||||||
|
|
||||||
$(DIST)/$(EXECUTABLE): $(SOURCES)
|
$(DIST)/$(EXECUTABLE): $(SOURCES)
|
||||||
go build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
|
$(GO) build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
|
||||||
|
|
||||||
$(DIST_DIRS):
|
$(DIST_DIRS):
|
||||||
mkdir -p $(DIST_DIRS)
|
mkdir -p $(DIST_DIRS)
|
||||||
|
|
||||||
.PHONY: xgo
|
.PHONY: xgo
|
||||||
xgo: | $(DIST_DIRS)
|
xgo: | $(DIST_DIRS)
|
||||||
go run $(XGO_PACKAGE) -go $(XGO_VERSION) -v -ldflags '-extldflags "-static" $(LDFLAGS)' -tags '$(TAGS)' -targets '$(XGO_TARGETS)' -out $(EXECUTABLE) --pkg cmd/$(EXECUTABLE) .
|
$(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -v -ldflags '-extldflags "-static" $(LDFLAGS)' -tags '$(TAGS)' -targets '$(XGO_TARGETS)' -out $(EXECUTABLE) --pkg cmd/$(EXECUTABLE) .
|
||||||
cp /build/* $(CWD)/$(DIST)
|
cp /build/* $(CWD)/$(DIST)
|
||||||
ls -l $(CWD)/$(DIST)
|
ls -l $(CWD)/$(DIST)
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# drone-docker
|
# drone-docker
|
||||||
|
|
||||||
|
> DISCONTINUED: This image is no longer maintained and will be removed in the future.
|
||||||
|
|
||||||
Drone plugin to build multiarch Docker images
|
Drone plugin to build multiarch Docker images
|
||||||
|
|
||||||
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-docker)
|
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-docker)
|
||||||
@ -10,16 +12,15 @@ Drone plugin to build multiarch Docker images
|
|||||||
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-docker)
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-docker)
|
||||||
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/drone-docker)](https://github.com/thegeeklab/drone-docker/blob/main/LICENSE)
|
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/drone-docker)](https://github.com/thegeeklab/drone-docker/blob/main/LICENSE)
|
||||||
|
|
||||||
Drone plugin to build multiarch Docker images. This plugin is a fork of [drone-plugins/drone-docker](https://github.com/drone-plugins/drone-docker). You can find the full documentation at You can find the full documentation at [https://drone-plugin-index.geekdocs.de](https://drone-plugin-index.geekdocs.de/plugins/drone-docker).
|
Drone plugin to build multiarch Docker images. This plugin is a fork of [drone-plugins/drone-docker](https://github.com/drone-plugins/drone-docker). You can find the full documentation at [https://drone-plugin-index.geekdocs.de](https://drone-plugin-index.geekdocs.de/plugins/drone-docker).
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
The tags follow the major version of Docker, e.g. `19`, the minor and patch part reflects the "version" of the plugin. A full example would be `19.6.5`. Minor versions may introduce breaking changes, while patch versions may be considered non-breaking.
|
The tags follow the major version of Docker, e.g. `19`, and the minor and patch parts reflect the `version` of the plugin. A full example would be `19.6.5`. Minor versions can introduce breaking changes, while patch versions can be considered non-breaking.
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
Special thanks goes to all [contributors](https://github.com/thegeeklab/drone-docker/graphs/contributors). If you would like to contribute,
|
Special thanks to all [contributors](https://github.com/thegeeklab/drone-docker/graphs/contributors). If you would like to contribute, please see the [instructions](https://github.com/thegeeklab/drone-docker/blob/main/CONTRIBUTING.md).
|
||||||
please see the [instructions](https://github.com/thegeeklab/drone-docker/blob/main/CONTRIBUTING.md).
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
167
_docs/_index.md
167
_docs/_index.md
@ -1,167 +0,0 @@
|
|||||||
---
|
|
||||||
title: drone-docker
|
|
||||||
---
|
|
||||||
|
|
||||||
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-docker)
|
|
||||||
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-docker)
|
|
||||||
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-docker)
|
|
||||||
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-docker)](https://github.com/thegeeklab/drone-docker/graphs/contributors)
|
|
||||||
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-docker)
|
|
||||||
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-docker)](https://github.com/thegeeklab/drone-docker/blob/main/LICENSE)
|
|
||||||
|
|
||||||
Drone plugin to build and publish multiarch Docker images.
|
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
|
||||||
<!-- spellchecker-disable -->
|
|
||||||
{{< toc >}}
|
|
||||||
<!-- spellchecker-enable -->
|
|
||||||
<!-- prettier-ignore-end -->
|
|
||||||
|
|
||||||
## Versioning
|
|
||||||
|
|
||||||
The tags follow the major version of Docker, e.g. `19`, the minor and patch part reflects the "version" of the plugin. A full example would be `19.6.5`. Minor versions may introduce breaking changes, while patch versions may be considered non-breaking.
|
|
||||||
|
|
||||||
## Build
|
|
||||||
|
|
||||||
Build the binary with the following command:
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
export GOOS=linux
|
|
||||||
export GOARCH=amd64
|
|
||||||
export CGO_ENABLED=0
|
|
||||||
export GO111MODULE=on
|
|
||||||
|
|
||||||
go build -v -a -tags netgo -o release/amd64/drone-docker ./cmd/drone-docker/
|
|
||||||
```
|
|
||||||
|
|
||||||
Build the Docker image with the following command:
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker .
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
{{< hint warning >}}
|
|
||||||
**Note**\
|
|
||||||
Be aware that the this plugin requires privileged capabilities, otherwise the
|
|
||||||
integrated Docker daemon is not able to start.
|
|
||||||
{{< /hint >}}
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
docker run --rm \
|
|
||||||
-e PLUGIN_TAG=latest \
|
|
||||||
-e PLUGIN_REPO=octocat/hello-world \
|
|
||||||
-e DRONE_COMMIT_SHA=00000000 \
|
|
||||||
-v $(pwd):$(pwd) \
|
|
||||||
-w $(pwd) \
|
|
||||||
--privileged \
|
|
||||||
thegeeklab/drone-docker --dry-run
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
dry_run
|
|
||||||
: disables docker push
|
|
||||||
|
|
||||||
drone_remote_url
|
|
||||||
: sets the git remote url
|
|
||||||
|
|
||||||
mirror
|
|
||||||
: sets a registry mirror to pull images
|
|
||||||
|
|
||||||
storage_driver
|
|
||||||
: sets the docker daemon storage driver
|
|
||||||
|
|
||||||
storage_path
|
|
||||||
: sets the docker daemon storage path (default `/var/lib/docker`)
|
|
||||||
|
|
||||||
bip
|
|
||||||
: allows the docker daemon to bride ip address
|
|
||||||
|
|
||||||
mtu
|
|
||||||
: sets docker daemon custom mtu setting
|
|
||||||
|
|
||||||
custom_dns
|
|
||||||
: sets custom docker daemon dns server
|
|
||||||
|
|
||||||
custom_dns_search
|
|
||||||
: sets custom docker daemon dns search domain
|
|
||||||
|
|
||||||
insecure
|
|
||||||
: allows the docker daemon to use insecure registries
|
|
||||||
|
|
||||||
ipv6
|
|
||||||
: enables docker daemon ipv6 support
|
|
||||||
|
|
||||||
experimental
|
|
||||||
: enables docker daemon experimental mode
|
|
||||||
|
|
||||||
debug "docker_launch_debug
|
|
||||||
: enables verbose debug mode for the docker daemon
|
|
||||||
|
|
||||||
daemon_off
|
|
||||||
: disables the startup of the docker daemon
|
|
||||||
|
|
||||||
dockerfile
|
|
||||||
: sets dockerfile to use for the image build (default `./Dockerfile`)
|
|
||||||
|
|
||||||
context
|
|
||||||
: sets the path of the build context to use (default `./`)
|
|
||||||
|
|
||||||
tags
|
|
||||||
: sets repository tags to use for the image; tags can also be loaded from a `.tags` file (default `latest`)
|
|
||||||
|
|
||||||
auto_tag
|
|
||||||
: generates tag names automatically based on git branch and git tag
|
|
||||||
|
|
||||||
auto_tag_suffix
|
|
||||||
: generates tag names with the given suffix
|
|
||||||
|
|
||||||
build_args
|
|
||||||
: sets custom build arguments for the build
|
|
||||||
|
|
||||||
build_args_from_env
|
|
||||||
: forwards environment variables as custom arguments to the build
|
|
||||||
|
|
||||||
quiet
|
|
||||||
: enables suppression of the build output
|
|
||||||
|
|
||||||
target
|
|
||||||
: sets the build target to use
|
|
||||||
|
|
||||||
cache_from
|
|
||||||
: sets images to consider as cache sources
|
|
||||||
|
|
||||||
pull_image
|
|
||||||
: enforces to pull base image at build time (default `true`)
|
|
||||||
|
|
||||||
compress
|
|
||||||
: enables compression og the build context using gzip
|
|
||||||
|
|
||||||
repo
|
|
||||||
: sets repository name for the image
|
|
||||||
|
|
||||||
registry
|
|
||||||
: sets docker registry to authenticate with (default `https://index.docker.io/v1/`)
|
|
||||||
|
|
||||||
username
|
|
||||||
: sets username to authenticates with
|
|
||||||
|
|
||||||
password
|
|
||||||
: sets password to authenticates with
|
|
||||||
|
|
||||||
email
|
|
||||||
: sets email address to authenticates with
|
|
||||||
|
|
||||||
config
|
|
||||||
: sets content of the docker daemon json config
|
|
||||||
|
|
||||||
purge
|
|
||||||
: enables cleanup of the docker environment at the end of a build (default `true`)
|
|
||||||
|
|
||||||
no_cache
|
|
||||||
: disables the usage of cached intermediate containers
|
|
||||||
|
|
||||||
add_host
|
|
||||||
: sets additional host:ip mapping
|
|
105
_docs/content/_index.md
Normal file
105
_docs/content/_index.md
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
---
|
||||||
|
title: drone-docker
|
||||||
|
---
|
||||||
|
|
||||||
|
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-docker)
|
||||||
|
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-docker)
|
||||||
|
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-docker)
|
||||||
|
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-docker)](https://github.com/thegeeklab/drone-docker/graphs/contributors)
|
||||||
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-docker)
|
||||||
|
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-docker)](https://github.com/thegeeklab/drone-docker/blob/main/LICENSE)
|
||||||
|
|
||||||
|
Drone plugin to build and publish multiarch Docker images.
|
||||||
|
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
<!-- spellchecker-disable -->
|
||||||
|
{{< toc >}}
|
||||||
|
<!-- spellchecker-enable -->
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
The tags follow the major version of Docker, e.g. `19`, and the minor and patch parts reflect the `version` of the plugin. A full example would be `19.6.5`. Minor versions can introduce breaking changes, while patch versions can be considered non-breaking.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
{{< hint type=important >}}
|
||||||
|
Be aware that the this plugin requires [privileged](https://docs.drone.io/pipeline/docker/syntax/steps/#privileged-mode) capabilities, otherwise the integrated Docker daemon is not able to start.
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
```YAML
|
||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker
|
||||||
|
image: thegeeklab/drone-docker
|
||||||
|
privileged: true
|
||||||
|
settings:
|
||||||
|
username: octocat
|
||||||
|
password: secure
|
||||||
|
repo: octocat/example
|
||||||
|
tags: latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
<!-- spellchecker-disable -->
|
||||||
|
{{< propertylist name=drone-docker.data sort=name >}}
|
||||||
|
<!-- spellchecker-enable -->
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
**Push to other registries than DockerHub:**
|
||||||
|
|
||||||
|
If the created image is to be pushed to registries other than the default DockerHub, it is necessary to set `registry` and `repo` as fully-qualified name.
|
||||||
|
|
||||||
|
```YAML
|
||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker
|
||||||
|
image: thegeeklab/drone-docker
|
||||||
|
privileged: true
|
||||||
|
settings:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: octocat
|
||||||
|
password: secret-access-token
|
||||||
|
repo: ghcr.io/octocat/example
|
||||||
|
tags: latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Build the binary with the following command:
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
export GOOS=linux
|
||||||
|
export GOARCH=amd64
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
Build the Docker image with the following command:
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Test
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
docker run --rm \
|
||||||
|
-e PLUGIN_TAG=latest \
|
||||||
|
-e PLUGIN_REPO=octocat/hello-world \
|
||||||
|
-e DRONE_COMMIT_SHA=00000000 \
|
||||||
|
-v $(pwd):$(pwd) \
|
||||||
|
-w $(pwd) \
|
||||||
|
--privileged \
|
||||||
|
thegeeklab/drone-docker --dry-run
|
||||||
|
```
|
197
_docs/data/data.yaml
Normal file
197
_docs/data/data.yaml
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
---
|
||||||
|
properties:
|
||||||
|
- name: dry_run
|
||||||
|
description: Disable docker push.
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: mirror
|
||||||
|
description: Use a registry mirror to pull images.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: storage_driver
|
||||||
|
description: The docker daemon storage driver.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: storage_path
|
||||||
|
description: The docker daemon storage path.
|
||||||
|
defaultValue: /var/lib/docker
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: bip
|
||||||
|
description: Allows the docker daemon to bride IP address.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: mtu
|
||||||
|
description: A docker daemon custom MTU.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: custom_dns
|
||||||
|
description: Custom docker daemon DNS server.
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: custom_dns_search
|
||||||
|
description: Custom docker daemon DNS search domain.
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: insecure
|
||||||
|
description: Enable the usage of insecure registries.
|
||||||
|
type: bool
|
||||||
|
defaultValue: false
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: ipv6
|
||||||
|
description: Enable docker daemon IPv6 support.
|
||||||
|
type: bool
|
||||||
|
defaultValue: false
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: experimental
|
||||||
|
description: Enable docker daemon experimental mode.
|
||||||
|
type: bool
|
||||||
|
defaultValue: false
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: daemon_debug
|
||||||
|
description: Enable verbose debug mode for the docker daemon.
|
||||||
|
type: string
|
||||||
|
defaultValue: false
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: daemon_off
|
||||||
|
description: Disable the startup of the docker daemon.
|
||||||
|
type: string
|
||||||
|
defaultValue: false
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: dockerfile
|
||||||
|
description: Set dockerfile to use for the image build.
|
||||||
|
defaultValue: Dockerfile
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: context
|
||||||
|
description: Set the path of the build context to use.
|
||||||
|
defaultValue: .
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: tags
|
||||||
|
description: Set repository tags to use for the image. Tags can also be loaded from a `.tags` file.
|
||||||
|
defaultValue: latest
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: auto_tag
|
||||||
|
description: |
|
||||||
|
Generate tag names automatically based on git branch and git tag. When this feature is enabled and the event type is `tag`,
|
||||||
|
the plugin will automatically tag the image using the standard semVer convention. For example:
|
||||||
|
|
||||||
|
- `1.0.0` produces docker tags `1`, `1.0`, `1.0.0`
|
||||||
|
- `1.0.0-rc.1` produces docker tags `1.0.0-rc.1`
|
||||||
|
|
||||||
|
When the event type is `push` and the target branch is your default branch, the plugin will automatically tag the image
|
||||||
|
as `latest`. All other event types and branches are ignored.
|
||||||
|
defaultValue: false
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: auto_tag_suffix
|
||||||
|
description: Generate tag names with the given suffix.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: build_args
|
||||||
|
description: Ccustom build arguments to pass to the build.
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: build_args_from_env
|
||||||
|
description: Forward environment variables as custom arguments to the build.
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: quiet
|
||||||
|
description: Enable suppression of the build output.
|
||||||
|
defaultValue: false
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: target
|
||||||
|
description: The docker build target.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: cache_from
|
||||||
|
description: Images to consider as cache sources.
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: pull_image
|
||||||
|
description: Enforce to pull the base image at build time.
|
||||||
|
defaultValue: true
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: compress
|
||||||
|
description: Enable compression of the build context using gzip.
|
||||||
|
defaultValue: false
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: repo
|
||||||
|
description: |
|
||||||
|
Repository name for the image. If the image is to be pushed to registries other than the default DockerHub,
|
||||||
|
it is necessary to set `repo` as fully-qualified name.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: registry
|
||||||
|
description: Docker registry to upload images.
|
||||||
|
defaultValue: https://index.docker.io/v1/
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: username
|
||||||
|
description: Username for authentication with the registry.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: password
|
||||||
|
description: Password for authentication with the registry.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: email
|
||||||
|
description: E-Mail address for authentication with the registry.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: config
|
||||||
|
description: Content of the docker daemon json config.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: purge
|
||||||
|
description: Enable cleanup of the docker environment at the end of a build.
|
||||||
|
defaultValue: true
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: no_cache
|
||||||
|
description: Disable the usage of cached intermediate containers.
|
||||||
|
defaultValue: false
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: add_host
|
||||||
|
description: Additional `host:ip` mapping.
|
||||||
|
type: list
|
||||||
|
required: false
|
@ -6,224 +6,261 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// settingsFlags has the cli.Flags for the plugin.Settings.
|
// settingsFlags has the cli.Flags for the plugin.Settings.
|
||||||
func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
||||||
return []cli.Flag{
|
return []cli.Flag{
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "dry-run",
|
Name: "dry-run",
|
||||||
EnvVars: []string{"PLUGIN_DRY_RUN"},
|
EnvVars: []string{"PLUGIN_DRY_RUN"},
|
||||||
Usage: "disables docker push",
|
Usage: "disable docker push",
|
||||||
Destination: &settings.Dryrun,
|
Destination: &settings.Dryrun,
|
||||||
},
|
Category: category,
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "remote.url",
|
|
||||||
EnvVars: []string{"DRONE_REMOTE_URL"},
|
|
||||||
Usage: "sets the git remote url",
|
|
||||||
Destination: &settings.Build.Remote,
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "daemon.mirror",
|
Name: "daemon.mirror",
|
||||||
EnvVars: []string{"PLUGIN_MIRROR", "DOCKER_PLUGIN_MIRROR"},
|
EnvVars: []string{"PLUGIN_MIRROR", "DOCKER_PLUGIN_MIRROR"},
|
||||||
Usage: "sets a registry mirror to pull images",
|
Usage: "registry mirror to pull images",
|
||||||
Destination: &settings.Daemon.Mirror,
|
Destination: &settings.Daemon.Mirror,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "daemon.storage-driver",
|
Name: "daemon.storage-driver",
|
||||||
EnvVars: []string{"PLUGIN_STORAGE_DRIVER"},
|
EnvVars: []string{"PLUGIN_STORAGE_DRIVER"},
|
||||||
Usage: "sets the docker daemon storage driver",
|
Usage: "docker daemon storage driver",
|
||||||
Destination: &settings.Daemon.StorageDriver,
|
Destination: &settings.Daemon.StorageDriver,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "daemon.storage-path",
|
Name: "daemon.storage-path",
|
||||||
EnvVars: []string{"PLUGIN_STORAGE_PATH"},
|
EnvVars: []string{"PLUGIN_STORAGE_PATH"},
|
||||||
Usage: "sets the docker daemon storage path",
|
Usage: "docker daemon storage path",
|
||||||
Value: "/var/lib/docker",
|
Value: "/var/lib/docker",
|
||||||
Destination: &settings.Daemon.StoragePath,
|
Destination: &settings.Daemon.StoragePath,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "daemon.bip",
|
Name: "daemon.bip",
|
||||||
EnvVars: []string{"PLUGIN_BIP"},
|
EnvVars: []string{"PLUGIN_BIP"},
|
||||||
Usage: "allows the docker daemon to bride ip address",
|
Usage: "allow the docker daemon to bride ip address",
|
||||||
Destination: &settings.Daemon.Bip,
|
Destination: &settings.Daemon.Bip,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "daemon.mtu",
|
Name: "daemon.mtu",
|
||||||
EnvVars: []string{"PLUGIN_MTU"},
|
EnvVars: []string{"PLUGIN_MTU"},
|
||||||
Usage: "sets docker daemon custom mtu setting",
|
Usage: "docker daemon custom mtu setting",
|
||||||
Destination: &settings.Daemon.MTU,
|
Destination: &settings.Daemon.MTU,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "daemon.dns",
|
Name: "daemon.dns",
|
||||||
EnvVars: []string{"PLUGIN_CUSTOM_DNS"},
|
EnvVars: []string{"PLUGIN_CUSTOM_DNS"},
|
||||||
Usage: "sets custom docker daemon dns server",
|
Usage: "custom docker daemon dns server",
|
||||||
Destination: &settings.Daemon.DNS,
|
Destination: &settings.Daemon.DNS,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "daemon.dns-search",
|
Name: "daemon.dns-search",
|
||||||
EnvVars: []string{"PLUGIN_CUSTOM_DNS_SEARCH"},
|
EnvVars: []string{"PLUGIN_CUSTOM_DNS_SEARCH"},
|
||||||
Usage: "sets custom docker daemon dns search domain",
|
Usage: "custom docker daemon dns search domain",
|
||||||
Destination: &settings.Daemon.DNSSearch,
|
Destination: &settings.Daemon.DNSSearch,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "daemon.insecure",
|
Name: "daemon.insecure",
|
||||||
EnvVars: []string{"PLUGIN_INSECURE"},
|
EnvVars: []string{"PLUGIN_INSECURE"},
|
||||||
Usage: "allows the docker daemon to use insecure registries",
|
Usage: "allow the docker daemon to use insecure registries",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Daemon.Insecure,
|
Destination: &settings.Daemon.Insecure,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "daemon.ipv6",
|
Name: "daemon.ipv6",
|
||||||
EnvVars: []string{"PLUGIN_IPV6"},
|
EnvVars: []string{"PLUGIN_IPV6"},
|
||||||
Usage: "enables docker daemon IPv6 support",
|
Usage: "enable docker daemon IPv6 support",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Daemon.IPv6,
|
Destination: &settings.Daemon.IPv6,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "daemon.experimental",
|
Name: "daemon.experimental",
|
||||||
EnvVars: []string{"PLUGIN_EXPERIMENTAL"},
|
EnvVars: []string{"PLUGIN_EXPERIMENTAL"},
|
||||||
Usage: "enables docker daemon experimental mode",
|
Usage: "enable docker daemon experimental mode",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Daemon.Experimental,
|
Destination: &settings.Daemon.Experimental,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "daemon.debug",
|
Name: "daemon.debug",
|
||||||
EnvVars: []string{"PLUGIN_DEBUG", "DOCKER_LAUNCH_DEBUG"},
|
EnvVars: []string{"PLUGIN_DEBUG", "DOCKER_LAUNCH_DEBUG"},
|
||||||
Usage: "enables verbose debug mode for the docker daemon",
|
Usage: "enable verbose debug mode for the docker daemon",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Daemon.Debug,
|
Destination: &settings.Daemon.Debug,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "daemon.off",
|
Name: "daemon.off",
|
||||||
EnvVars: []string{"PLUGIN_DAEMON_OFF"},
|
EnvVars: []string{"PLUGIN_DAEMON_OFF"},
|
||||||
Usage: "disables the startup of the docker daemon",
|
Usage: "disable the startup of the docker daemon",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Daemon.Disabled,
|
Destination: &settings.Daemon.Disabled,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "dockerfile",
|
Name: "dockerfile",
|
||||||
EnvVars: []string{"PLUGIN_DOCKERFILE"},
|
EnvVars: []string{"PLUGIN_DOCKERFILE"},
|
||||||
Usage: "sets dockerfile to use for the image build",
|
Usage: "dockerfile to use for the image build",
|
||||||
Value: "Dockerfile",
|
Value: "Dockerfile",
|
||||||
Destination: &settings.Build.Dockerfile,
|
Destination: &settings.Build.Dockerfile,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "context",
|
Name: "context",
|
||||||
EnvVars: []string{"PLUGIN_CONTEXT"},
|
EnvVars: []string{"PLUGIN_CONTEXT"},
|
||||||
Usage: "sets the path of the build context to use",
|
Usage: "path of the build context",
|
||||||
Value: ".",
|
Value: ".",
|
||||||
Destination: &settings.Build.Context,
|
Destination: &settings.Build.Context,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "tags",
|
Name: "tags",
|
||||||
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
||||||
Usage: "sets repository tags to use for the image",
|
Usage: "repository tags to use for the image",
|
||||||
FilePath: ".tags",
|
FilePath: ".tags",
|
||||||
Destination: &settings.Build.Tags,
|
Destination: &settings.Build.Tags,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "tags.auto",
|
Name: "tags.auto",
|
||||||
EnvVars: []string{"PLUGIN_DEFAULT_TAGS", "PLUGIN_AUTO_TAG"},
|
EnvVars: []string{"PLUGIN_DEFAULT_TAGS", "PLUGIN_AUTO_TAG"},
|
||||||
Usage: "generates tag names automatically based on git branch and git tag",
|
Usage: "generate tag names automatically based on git branch and git tag",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Build.TagsAuto,
|
Destination: &settings.Build.TagsAuto,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "tags.suffix",
|
Name: "tags.suffix",
|
||||||
EnvVars: []string{"PLUGIN_DEFAULT_SUFFIX", "PLUGIN_AUTO_TAG_SUFFIX"},
|
EnvVars: []string{"PLUGIN_DEFAULT_SUFFIX", "PLUGIN_AUTO_TAG_SUFFIX"},
|
||||||
Usage: "generates tag names with the given suffix",
|
Usage: "generate tag names with the given suffix",
|
||||||
Destination: &settings.Build.TagsSuffix,
|
Destination: &settings.Build.TagsSuffix,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "args",
|
Name: "args",
|
||||||
EnvVars: []string{"PLUGIN_BUILD_ARGS"},
|
EnvVars: []string{"PLUGIN_BUILD_ARGS"},
|
||||||
Usage: "sets custom build arguments for the build",
|
Usage: "custom build arguments for the build",
|
||||||
Destination: &settings.Build.Args,
|
Destination: &settings.Build.Args,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "args-from-env",
|
Name: "args-from-env",
|
||||||
EnvVars: []string{"PLUGIN_BUILD_ARGS_FROM_ENV"},
|
EnvVars: []string{"PLUGIN_BUILD_ARGS_FROM_ENV"},
|
||||||
Usage: "forwards environment variables as custom arguments to the build",
|
Usage: "forward environment variables as custom arguments to the build",
|
||||||
Destination: &settings.Build.ArgsEnv,
|
Destination: &settings.Build.ArgsEnv,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "quiet",
|
Name: "quiet",
|
||||||
EnvVars: []string{"PLUGIN_QUIET"},
|
EnvVars: []string{"PLUGIN_QUIET"},
|
||||||
Usage: "enables suppression of the build output",
|
Usage: "enable suppression of the build output",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Build.Quiet,
|
Destination: &settings.Build.Quiet,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "target",
|
Name: "target",
|
||||||
EnvVars: []string{"PLUGIN_TARGET"},
|
EnvVars: []string{"PLUGIN_TARGET"},
|
||||||
Usage: "sets the build target to use",
|
Usage: "build target to use",
|
||||||
Destination: &settings.Build.Target,
|
Destination: &settings.Build.Target,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "cache-from",
|
Name: "cache-from",
|
||||||
EnvVars: []string{"PLUGIN_CACHE_FROM"},
|
EnvVars: []string{"PLUGIN_CACHE_FROM"},
|
||||||
Usage: "sets images to consider as cache sources",
|
Usage: "images to consider as cache sources",
|
||||||
Destination: &settings.Build.CacheFrom,
|
Destination: &settings.Build.CacheFrom,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "pull-image",
|
Name: "pull-image",
|
||||||
EnvVars: []string{"PLUGIN_PULL_IMAGE"},
|
EnvVars: []string{"PLUGIN_PULL_IMAGE"},
|
||||||
Usage: "enforces to pull base image at build time",
|
Usage: "enforce to pull base image at build time",
|
||||||
Value: true,
|
Value: true,
|
||||||
Destination: &settings.Build.Pull,
|
Destination: &settings.Build.Pull,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "compress",
|
Name: "compress",
|
||||||
EnvVars: []string{"PLUGIN_COMPRESS"},
|
EnvVars: []string{"PLUGIN_COMPRESS"},
|
||||||
Usage: "enables compression og the build context using gzip",
|
Usage: "enable compression of the build context using gzip",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Build.Compress,
|
Destination: &settings.Build.Compress,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "repo",
|
Name: "repo",
|
||||||
EnvVars: []string{"PLUGIN_REPO"},
|
EnvVars: []string{"PLUGIN_REPO"},
|
||||||
Usage: "sets repository name for the image",
|
Usage: "repository name for the image",
|
||||||
Destination: &settings.Build.Repo,
|
Destination: &settings.Build.Repo,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "docker.registry",
|
Name: "docker.registry",
|
||||||
EnvVars: []string{"PLUGIN_REGISTRY", "DOCKER_REGISTRY"},
|
EnvVars: []string{"PLUGIN_REGISTRY", "DOCKER_REGISTRY"},
|
||||||
Usage: "sets docker registry to authenticate with",
|
Usage: "docker registry to authenticate with",
|
||||||
Value: "https://index.docker.io/v1/",
|
Value: "https://index.docker.io/v1/",
|
||||||
Destination: &settings.Login.Registry,
|
Destination: &settings.Login.Registry,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "docker.username",
|
Name: "docker.username",
|
||||||
EnvVars: []string{"PLUGIN_USERNAME", "DOCKER_USERNAME"},
|
EnvVars: []string{"PLUGIN_USERNAME", "DOCKER_USERNAME"},
|
||||||
Usage: "sets username to authenticates with",
|
Usage: "username for registry authentication",
|
||||||
Destination: &settings.Login.Username,
|
Destination: &settings.Login.Username,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "docker.password",
|
Name: "docker.password",
|
||||||
EnvVars: []string{"PLUGIN_PASSWORD", "DOCKER_PASSWORD"},
|
EnvVars: []string{"PLUGIN_PASSWORD", "DOCKER_PASSWORD"},
|
||||||
Usage: "sets password to authenticates with",
|
Usage: "password for registry authentication",
|
||||||
Destination: &settings.Login.Password,
|
Destination: &settings.Login.Password,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "docker.email",
|
Name: "docker.email",
|
||||||
EnvVars: []string{"PLUGIN_EMAIL", "DOCKER_EMAIL"},
|
EnvVars: []string{"PLUGIN_EMAIL", "DOCKER_EMAIL"},
|
||||||
Usage: "sets email address to authenticates with",
|
Usage: "email address for registry authentication",
|
||||||
Destination: &settings.Login.Email,
|
Destination: &settings.Login.Email,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "docker.config",
|
Name: "docker.config",
|
||||||
EnvVars: []string{"PLUGIN_CONFIG", "DOCKER_PLUGIN_CONFIG"},
|
EnvVars: []string{"PLUGIN_CONFIG", "DOCKER_PLUGIN_CONFIG"},
|
||||||
Usage: "sets content of the docker daemon json config",
|
Usage: "content of the docker daemon json config",
|
||||||
Destination: &settings.Login.Config,
|
Destination: &settings.Login.Config,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "docker.purge",
|
Name: "docker.purge",
|
||||||
EnvVars: []string{"PLUGIN_PURGE"},
|
EnvVars: []string{"PLUGIN_PURGE"},
|
||||||
Usage: "enables cleanup of the docker environment at the end of a build",
|
Usage: "enable cleanup of the docker environment at the end of a build",
|
||||||
Value: true,
|
Value: true,
|
||||||
Destination: &settings.Cleanup,
|
Destination: &settings.Cleanup,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "no-cache",
|
Name: "no-cache",
|
||||||
EnvVars: []string{"PLUGIN_NO_CACHE"},
|
EnvVars: []string{"PLUGIN_NO_CACHE"},
|
||||||
Usage: "disables the usage of cached intermediate containers",
|
Usage: "disable the usage of cached intermediate containers",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Build.NoCache,
|
Destination: &settings.Build.NoCache,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "add-host",
|
Name: "add-host",
|
||||||
EnvVars: []string{"PLUGIN_ADD_HOST"},
|
EnvVars: []string{"PLUGIN_ADD_HOST"},
|
||||||
Usage: "sets additional host:ip mapping",
|
Usage: "additional host:ip mapping",
|
||||||
Destination: &settings.Build.AddHost,
|
Destination: &settings.Build.AddHost,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/thegeeklab/drone-docker/plugin"
|
"github.com/thegeeklab/drone-docker/plugin"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
"github.com/drone-plugins/drone-plugin-lib/errors"
|
"github.com/thegeeklab/drone-plugin-lib/v2/urfave"
|
||||||
"github.com/drone-plugins/drone-plugin-lib/urfave"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -32,12 +32,12 @@ func main() {
|
|||||||
Name: "drone-docker",
|
Name: "drone-docker",
|
||||||
Usage: "build docker container with DinD",
|
Usage: "build docker container with DinD",
|
||||||
Version: BuildVersion,
|
Version: BuildVersion,
|
||||||
Flags: append(settingsFlags(settings), urfave.Flags()...),
|
Flags: append(settingsFlags(settings, urfave.FlagsPluginCategory), urfave.Flags()...),
|
||||||
Action: run(settings),
|
Action: run(settings),
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
errors.HandleExit(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,19 +52,11 @@ func run(settings *plugin.Settings) cli.ActionFunc {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if err := plugin.Validate(); err != nil {
|
if err := plugin.Validate(); err != nil {
|
||||||
if e, ok := err.(errors.ExitCoder); ok {
|
return fmt.Errorf("validation failed: %w", err)
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
return errors.ExitMessagef("validation failed: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := plugin.Execute(); err != nil {
|
if err := plugin.Execute(); err != nil {
|
||||||
if e, ok := err.(errors.ExitCoder); ok {
|
return fmt.Errorf("execution failed: %w", err)
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
return errors.ExitMessagef("execution failed: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM amd64/docker:19.03-dind@sha256:1875a3437d87a2fa8ec5e6fcd3233a98d571fa9692516b1e7d8eb18b7dca87a4
|
FROM amd64/docker:20.10-dind@sha256:56a2d342dd7f25fd604f71513f765526bd522f3c256bead83b6d30c5a8006fa6
|
||||||
|
|
||||||
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
FROM arm32v7/docker:19.03-dind@sha256:f998921d365053bf7e3f98794f6c23ca44e6809832d78105bc4d2da6bb8521ed
|
|
||||||
|
|
||||||
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
|
||||||
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
|
||||||
LABEL org.opencontainers.image.title="drone-docker"
|
|
||||||
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-docker"
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-docker"
|
|
||||||
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-docker"
|
|
||||||
|
|
||||||
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
|
||||||
|
|
||||||
RUN apk --update add --virtual .build-deps curl && \
|
|
||||||
mkdir -p /etc/docker/ && \
|
|
||||||
curl -SsL -o /etc/docker/default.json https://raw.githubusercontent.com/moby/moby/19.03/profiles/seccomp/default.json && \
|
|
||||||
sed -i 's/SCMP_ACT_ERRNO/SCMP_ACT_TRACE/g' /etc/docker/default.json && \
|
|
||||||
chmod 600 /etc/docker/default.json && \
|
|
||||||
apk del .build-deps && \
|
|
||||||
rm -rf /var/cache/apk/* && \
|
|
||||||
rm -rf /tmp/*
|
|
||||||
|
|
||||||
ADD dist/drone-docker /bin/
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "drone-docker"]
|
|
@ -1,4 +1,4 @@
|
|||||||
FROM arm64v8/docker:19.03-dind@sha256:81f35202223dcd33991fcb0e12d287f854dfb63b0b47e0c805ed87c0dfc4c9b3
|
FROM arm64v8/docker:20.10-dind@sha256:26c7da097331ba685a7314fcfc0eb608b86b4074bab5e1beaeb57d744c5c060a
|
||||||
|
|
||||||
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
@ -16,9 +16,3 @@ manifests:
|
|||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
|
|
||||||
- image: quay.io/thegeeklab/drone-docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
|
|
||||||
platform:
|
|
||||||
architecture: arm
|
|
||||||
os: linux
|
|
||||||
variant: v7
|
|
||||||
|
@ -16,9 +16,3 @@ manifests:
|
|||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
|
|
||||||
- image: thegeeklab/drone-docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
|
|
||||||
platform:
|
|
||||||
architecture: arm
|
|
||||||
os: linux
|
|
||||||
variant: v7
|
|
||||||
|
14
go.mod
14
go.mod
@ -1,17 +1,19 @@
|
|||||||
module github.com/thegeeklab/drone-docker
|
module github.com/thegeeklab/drone-docker
|
||||||
|
|
||||||
go 1.18
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/coreos/go-semver v0.3.0
|
github.com/coreos/go-semver v0.3.0
|
||||||
github.com/drone-plugins/drone-plugin-lib v0.4.0
|
|
||||||
github.com/joho/godotenv v1.4.0
|
github.com/joho/godotenv v1.4.0
|
||||||
github.com/sirupsen/logrus v1.8.1
|
github.com/sirupsen/logrus v1.9.0
|
||||||
github.com/urfave/cli/v2 v2.4.7
|
github.com/thegeeklab/drone-plugin-lib/v2 v2.2.1
|
||||||
|
github.com/urfave/cli/v2 v2.23.7
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
)
|
)
|
||||||
|
51
go.sum
51
go.sum
@ -1,44 +1,31 @@
|
|||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
|
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/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
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.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
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/drone-plugins/drone-plugin-lib v0.4.0 h1:qywEYGhquUuid6zNLmKia8CWY1TUa8jPQQ/G9ozfAmc=
|
|
||||||
github.com/drone-plugins/drone-plugin-lib v0.4.0/go.mod h1:EgqogX38GoJFtckeSQyhBJYX8P+KWBPhdprAVvyRxF8=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
|
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/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
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/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 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
github.com/thegeeklab/drone-plugin-lib/v2 v2.2.1 h1:fta32M+y6aHG/BX+Kwxo9DQAcYpTyCBHn7sAm2qjfL0=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/thegeeklab/drone-plugin-lib/v2 v2.2.1/go.mod h1:Bu++VS6GXEWCHQdzR65dPsGtBGOMuqAQPiRVBaa+HrY=
|
||||||
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
|
github.com/urfave/cli/v2 v2.23.7 h1:YHDQ46s3VghFHFf1DdF+Sh7H4RqhcM+t0TmZRJx4oJY=
|
||||||
github.com/urfave/cli/v2 v2.4.7 h1:nUgKLTC/InVYwUx26HZUBGIBZaptiW97W8vVlhuYawo=
|
github.com/urfave/cli/v2 v2.23.7/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||||
github.com/urfave/cli/v2 v2.4.7/go.mod h1:oDzoM7pVwz6wHn5ogWgFUU1s4VJayeQS+aEZDqXIEJs=
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f h1:rlezHXNlxYWvBCzNses9Dlc7nGFaNMJeqLolcmQSSZY=
|
|
||||||
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
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=
|
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package plugin
|
package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ func (p Plugin) startDaemon() {
|
|||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
} else {
|
} else {
|
||||||
cmd.Stdout = ioutil.Discard
|
cmd.Stdout = io.Discard
|
||||||
cmd.Stderr = ioutil.Discard
|
cmd.Stderr = io.Discard
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
trace(cmd)
|
trace(cmd)
|
||||||
|
@ -2,7 +2,6 @@ package plugin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -40,7 +39,6 @@ type Login struct {
|
|||||||
|
|
||||||
// Build defines Docker build parameters.
|
// Build defines Docker build parameters.
|
||||||
type Build struct {
|
type Build struct {
|
||||||
Remote string // Git remote URL
|
|
||||||
Name string // Git commit sha used as docker default named tag
|
Name string // Git commit sha used as docker default named tag
|
||||||
Ref string // Git commit ref
|
Ref string // Git commit ref
|
||||||
Branch string // Git repository branch
|
Branch string // Git repository branch
|
||||||
@ -92,12 +90,12 @@ func (p *Plugin) Validate() error {
|
|||||||
p.settings.Build.TagsSuffix,
|
p.settings.Build.TagsSuffix,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Printf("cannot generate tags from %s, invalid semantic version", p.settings.Build.Ref)
|
logrus.Infof("cannot generate tags from %s, invalid semantic version", p.settings.Build.Ref)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
p.settings.Build.Tags = *cli.NewStringSlice(tag...)
|
p.settings.Build.Tags = *cli.NewStringSlice(tag...)
|
||||||
} else {
|
} else {
|
||||||
logrus.Printf("skip auto-tagging for %s, not on default branch or tag", p.settings.Build.Ref)
|
logrus.Infof("skip auto-tagging, not on default branch or tag")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +128,7 @@ func (p *Plugin) Execute() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
path := filepath.Join(dockerHome, "config.json")
|
path := filepath.Join(dockerHome, "config.json")
|
||||||
err := ioutil.WriteFile(path, []byte(p.settings.Login.Config), 0o600)
|
err := os.WriteFile(path, []byte(p.settings.Login.Config), 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error writing config.json: %s", err)
|
return fmt.Errorf("error writing config.json: %s", err)
|
||||||
}
|
}
|
||||||
@ -196,7 +194,7 @@ func (p *Plugin) Execute() error {
|
|||||||
fmt.Printf("Could not prune system containers. Ignoring...\n")
|
fmt.Printf("Could not prune system containers. Ignoring...\n")
|
||||||
case err != nil && isCommandRmi(cmd.Args):
|
case err != nil && isCommandRmi(cmd.Args):
|
||||||
fmt.Printf("Could not remove image %s. Ignoring...\n", cmd.Args[2])
|
fmt.Printf("Could not remove image %s. Ignoring...\n", cmd.Args[2])
|
||||||
default:
|
case err != nil:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package plugin
|
package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/drone-plugins/drone-plugin-lib/drone"
|
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Plugin implements drone.Plugin to provide the plugin implementation.
|
// Plugin implements drone.Plugin to provide the plugin implementation.
|
||||||
|
Loading…
Reference in New Issue
Block a user