mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-21 13:50:39 +00:00
refactor: initial commit after rewrite to woodpecker
This commit is contained in:
parent
08408124c6
commit
f528612af5
@ -2,7 +2,7 @@ style: github
|
|||||||
template: CHANGELOG.tpl.md
|
template: CHANGELOG.tpl.md
|
||||||
info:
|
info:
|
||||||
title: CHANGELOG
|
title: CHANGELOG
|
||||||
repository_url: https://github.com/thegeeklab/drone-docker-buildx
|
repository_url: https://github.com/thegeeklab/wp-docker-buildx
|
||||||
options:
|
options:
|
||||||
commit_groups:
|
commit_groups:
|
||||||
title_maps:
|
title_maps:
|
||||||
|
@ -12,7 +12,7 @@ gzip
|
|||||||
toml
|
toml
|
||||||
config
|
config
|
||||||
host:ip
|
host:ip
|
||||||
drone-docker-buildx
|
wp-docker-buildx
|
||||||
multiarch
|
multiarch
|
||||||
buildx
|
buildx
|
||||||
DockerHub
|
DockerHub
|
||||||
|
291
.drone.yml
291
.drone.yml
@ -1,291 +0,0 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: test
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: deps
|
|
||||||
image: golang:1.20
|
|
||||||
commands:
|
|
||||||
- make deps
|
|
||||||
volumes:
|
|
||||||
- name: godeps
|
|
||||||
path: /go
|
|
||||||
|
|
||||||
- name: lint
|
|
||||||
image: golang:1.20
|
|
||||||
commands:
|
|
||||||
- make lint
|
|
||||||
volumes:
|
|
||||||
- name: godeps
|
|
||||||
path: /go
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
image: golang:1.20
|
|
||||||
commands:
|
|
||||||
- make test
|
|
||||||
volumes:
|
|
||||||
- name: godeps
|
|
||||||
path: /go
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: godeps
|
|
||||||
temp: {}
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
- refs/pull/**
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: build-binaries
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: techknowlogick/xgo:go-1.20.x
|
|
||||||
commands:
|
|
||||||
- ln -s /drone/src /source
|
|
||||||
- make release
|
|
||||||
|
|
||||||
- name: executable
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- $(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help
|
|
||||||
|
|
||||||
- name: changelog-generate
|
|
||||||
image: thegeeklab/git-chglog
|
|
||||||
commands:
|
|
||||||
- git fetch -tq
|
|
||||||
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
|
|
||||||
|
|
||||||
- name: changelog-format
|
|
||||||
image: thegeeklab/alpine-tools
|
|
||||||
commands:
|
|
||||||
- prettier CHANGELOG.md
|
|
||||||
- prettier -w CHANGELOG.md
|
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: plugins/github-release
|
|
||||||
settings:
|
|
||||||
api_key:
|
|
||||||
from_secret: github_token
|
|
||||||
files:
|
|
||||||
- dist/*
|
|
||||||
note: CHANGELOG.md
|
|
||||||
overwrite: true
|
|
||||||
title: ${DRONE_TAG}
|
|
||||||
when:
|
|
||||||
ref:
|
|
||||||
- refs/tags/**
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
- refs/pull/**
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: build-container
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: dryrun
|
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
|
||||||
settings:
|
|
||||||
dockerfile: Dockerfile.multiarch
|
|
||||||
dry_run: true
|
|
||||||
platforms:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
provenance: false
|
|
||||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
|
||||||
when:
|
|
||||||
ref:
|
|
||||||
- refs/pull/**
|
|
||||||
|
|
||||||
- name: publish-dockerhub
|
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
|
||||||
settings:
|
|
||||||
auto_tag: true
|
|
||||||
dockerfile: Dockerfile.multiarch
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
platforms:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
provenance: false
|
|
||||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
when:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
depends_on:
|
|
||||||
- dryrun
|
|
||||||
|
|
||||||
- name: publish-quay
|
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
|
||||||
settings:
|
|
||||||
auto_tag: true
|
|
||||||
dockerfile: Dockerfile.multiarch
|
|
||||||
password:
|
|
||||||
from_secret: quay_password
|
|
||||||
platforms:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
provenance: false
|
|
||||||
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
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
- refs/pull/**
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: docs
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
limit: 1
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: markdownlint
|
|
||||||
image: thegeeklab/markdownlint-cli
|
|
||||||
commands:
|
|
||||||
- markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'
|
|
||||||
|
|
||||||
- name: spellcheck
|
|
||||||
image: thegeeklab/alpine-tools
|
|
||||||
commands:
|
|
||||||
- spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions
|
|
||||||
environment:
|
|
||||||
FORCE_COLOR: true
|
|
||||||
NPM_CONFIG_LOGLEVEL: error
|
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: thegeeklab/drone-git-action
|
|
||||||
settings:
|
|
||||||
action:
|
|
||||||
- pages
|
|
||||||
author_email: bot@thegeeklab.de
|
|
||||||
author_name: thegeeklab-bot
|
|
||||||
branch: docs
|
|
||||||
message: auto-update documentation
|
|
||||||
netrc_password:
|
|
||||||
from_secret: github_token
|
|
||||||
pages_directory: _docs/
|
|
||||||
when:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
- refs/pull/**
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- build-binaries
|
|
||||||
- build-container
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: notifications
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- 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: thegeeklab/drone-matrix
|
|
||||||
settings:
|
|
||||||
homeserver:
|
|
||||||
from_secret: matrix_homeserver
|
|
||||||
password:
|
|
||||||
from_secret: matrix_password
|
|
||||||
roomid:
|
|
||||||
from_secret: matrix_roomid
|
|
||||||
template: "Status: **{{ .Build.Status }}**<br/> Build: [{{ .Repo.Owner }}/{{ .Repo.Name }}]({{ .Build.Link }}){{ if .Build.Branch }} ({{ .Build.Branch }}){{ end }} by {{ .Commit.Author }}<br/> Message: {{ .Commit.Message.Title }}"
|
|
||||||
username:
|
|
||||||
from_secret: matrix_username
|
|
||||||
when:
|
|
||||||
status:
|
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
ref:
|
|
||||||
- refs/heads/main
|
|
||||||
- refs/tags/**
|
|
||||||
status:
|
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- docs
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: signature
|
|
||||||
hmac: a62b604d49c98c24360bfaea313f8dba31166133620d5e7656f884e1f20b9ff6
|
|
||||||
|
|
||||||
...
|
|
31
.github/settings.yml
vendored
31
.github/settings.yml
vendored
@ -1,8 +1,8 @@
|
|||||||
repository:
|
repository:
|
||||||
name: drone-docker-buildx
|
name: wp-docker-buildx
|
||||||
description: Drone plugin to build multiarch Docker images with buildx
|
description: Woodpecker CI plugin to build multiarch Docker images with buildx
|
||||||
homepage: https://drone-plugin-index.geekdocs.de/plugins/drone-docker-buildx
|
homepage: https://wp-plugin-index.geekdocs.de/plugins/wp-docker-buildx
|
||||||
topics: drone, drone-plugin
|
topics: woodpecker, wp-plugin
|
||||||
|
|
||||||
private: false
|
private: false
|
||||||
has_issues: true
|
has_issues: true
|
||||||
@ -43,26 +43,3 @@ labels:
|
|||||||
- name: wontfix
|
- name: wontfix
|
||||||
color: ffffff
|
color: ffffff
|
||||||
description: This will not be worked on
|
description: This will not be worked on
|
||||||
|
|
||||||
branches:
|
|
||||||
- name: main
|
|
||||||
protection:
|
|
||||||
required_pull_request_reviews: null
|
|
||||||
required_status_checks:
|
|
||||||
strict: false
|
|
||||||
contexts:
|
|
||||||
- continuous-integration/drone/pr
|
|
||||||
enforce_admins: true
|
|
||||||
required_linear_history: true
|
|
||||||
restrictions: null
|
|
||||||
- name: docs
|
|
||||||
protection:
|
|
||||||
required_pull_request_reviews: null
|
|
||||||
required_status_checks: null
|
|
||||||
enforce_admins: true
|
|
||||||
required_linear_history: true
|
|
||||||
restrictions:
|
|
||||||
apps: []
|
|
||||||
users: []
|
|
||||||
teams:
|
|
||||||
- bot
|
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
/dist/
|
/dist/
|
||||||
/release/
|
/release/
|
||||||
/drone-docker-buildx*
|
/wp-docker-buildx*
|
||||||
|
|
||||||
coverage.out
|
coverage.out
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
.drone.yml
|
|
||||||
*.tpl.md
|
*.tpl.md
|
||||||
LICENSE
|
LICENSE
|
||||||
|
@ -12,10 +12,10 @@ FROM docker:24.0-dind@sha256:9e71442b7584518e6efefd9f325cbc5b4b9b000886cffef6e67
|
|||||||
|
|
||||||
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>"
|
||||||
LABEL org.opencontainers.image.title="drone-docker-buildx"
|
LABEL org.opencontainers.image.title="wp-docker-buildx"
|
||||||
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-docker-buildx"
|
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/wp-docker-buildx"
|
||||||
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-docker-buildx"
|
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/wp-docker-buildx"
|
||||||
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-docker-buildx"
|
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/wp-docker-buildx"
|
||||||
|
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
@ -37,5 +37,5 @@ RUN apk --update add --virtual .build-deps curl && \
|
|||||||
rm -rf /tmp/*
|
rm -rf /tmp/*
|
||||||
|
|
||||||
COPY --from=build /src/Corefile /etc/coredns/Corefile
|
COPY --from=build /src/Corefile /etc/coredns/Corefile
|
||||||
COPY --from=build /src/dist/drone-docker-buildx /bin/drone-docker-buildx
|
COPY --from=build /src/dist/wp-docker-buildx /bin/wp-docker-buildx
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "drone-docker-buildx"]
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "wp-docker-buildx"]
|
||||||
|
6
Makefile
6
Makefile
@ -3,7 +3,7 @@ GOFUMPT_PACKAGE_VERSION := v0.5.0
|
|||||||
# renovate: datasource=github-releases depName=golangci/golangci-lint
|
# renovate: datasource=github-releases depName=golangci/golangci-lint
|
||||||
GOLANGCI_LINT_PACKAGE_VERSION := v1.53.3
|
GOLANGCI_LINT_PACKAGE_VERSION := v1.53.3
|
||||||
|
|
||||||
EXECUTABLE := drone-docker-buildx
|
EXECUTABLE := wp-docker-buildx
|
||||||
|
|
||||||
DIST := dist
|
DIST := dist
|
||||||
DIST_DIRS := $(DIST)
|
DIST_DIRS := $(DIST)
|
||||||
@ -30,8 +30,8 @@ endif
|
|||||||
TAGS ?= netgo
|
TAGS ?= netgo
|
||||||
|
|
||||||
ifndef VERSION
|
ifndef VERSION
|
||||||
ifneq ($(DRONE_TAG),)
|
ifneq ($(CI_COMMIT_TAG),)
|
||||||
VERSION ?= $(subst v,,$(DRONE_TAG))
|
VERSION ?= $(subst v,,$(CI_COMMIT_TAG))
|
||||||
else
|
else
|
||||||
VERSION ?= $(shell git rev-parse --short HEAD)
|
VERSION ?= $(shell git rev-parse --short HEAD)
|
||||||
endif
|
endif
|
||||||
|
26
README.md
26
README.md
@ -1,16 +1,16 @@
|
|||||||
# drone-docker-buildx
|
# wp-docker-buildx
|
||||||
|
|
||||||
Drone plugin to build multiarch Docker images with buildx
|
Woodpecker CI plugin to build multiarch Docker images with buildx
|
||||||
|
|
||||||
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker-buildx?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-docker-buildx)
|
[![Build Status](https://img.shields.io/wp/build/thegeeklab/wp-docker-buildx?logo=wp&server=https%3A%2F%2Fwp.thegeeklab.de)](https://wp.thegeeklab.de/thegeeklab/wp-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)
|
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/wp-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)
|
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/wp-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)
|
[![Go Report Card](https://goreportcard.com/badge/github.com/thegeeklab/wp-docker-buildx)](https://goreportcard.com/report/github.com/thegeeklab/wp-docker-buildx)
|
||||||
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/graphs/contributors)
|
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/wp-docker-buildx)](https://github.com/thegeeklab/wp-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)
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-docker-buildx)
|
||||||
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/blob/main/LICENSE)
|
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/wp-docker-buildx)](https://github.com/thegeeklab/wp-docker-buildx/blob/main/LICENSE)
|
||||||
|
|
||||||
Drone plugin to build multiarch Docker images with buildx. 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-buildx).
|
Woodpecker CI plugin to build multiarch Docker images with buildx. This plugin is a fork of [wp-plugins/wp-docker](https://github.com/wp-plugins/wp-docker). You can find the full documentation at [https://wp-plugin-index.geekdocs.de](https://wp-plugin-index.geekdocs.de/plugins/wp-docker-buildx).
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
@ -21,15 +21,15 @@ The tags follow the major version of Docker, e.g. `20`, and the minor and patch
|
|||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- spellchecker-disable -->
|
<!-- spellchecker-disable -->
|
||||||
|
|
||||||
- [BitProcessor/drone-docker-buildx-ecr](https://github.com/BitProcessor/drone-docker-buildx-ecr) by [@BitProcessor](https://github.com/BitProcessor)
|
- [BitProcessor/wp-docker-buildx-ecr](https://github.com/BitProcessor/wp-docker-buildx-ecr) by [@BitProcessor](https://github.com/BitProcessor)
|
||||||
|
|
||||||
<!-- spellchecker-enable -->
|
<!-- spellchecker-enable -->
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
Special thanks 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).
|
Special thanks to all [contributors](https://github.com/thegeeklab/wp-docker-buildx/graphs/contributors). If you would like to contribute, please see the [instructions](https://github.com/thegeeklab/wp-docker-buildx/blob/main/CONTRIBUTING.md).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the Apache-2.0 License - see the [LICENSE](https://github.com/thegeeklab/drone-docker-buildx/blob/main/LICENSE) file for details.
|
This project is licensed under the Apache-2.0 License - see the [LICENSE](https://github.com/thegeeklab/wp-docker-buildx/blob/main/LICENSE) file for details.
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
title: drone-docker-buildx
|
title: wp-docker-buildx
|
||||||
---
|
---
|
||||||
|
|
||||||
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker-buildx?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-docker-buildx)
|
[![Build Status](https://img.shields.io/wp/build/thegeeklab/wp-docker-buildx?logo=wp&server=https%3A%2F%2Fwp.thegeeklab.de)](https://wp.thegeeklab.de/thegeeklab/wp-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)
|
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/wp-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)
|
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/wp-docker-buildx)
|
||||||
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/graphs/contributors)
|
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/wp-docker-buildx)](https://github.com/thegeeklab/wp-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)
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-docker-buildx)
|
||||||
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/blob/main/LICENSE)
|
[![License: MIT](https://img.shields.io/github/license/thegeeklab/wp-docker-buildx)](https://github.com/thegeeklab/wp-docker-buildx/blob/main/LICENSE)
|
||||||
|
|
||||||
Drone plugin to build and publish multiarch Docker images with buildx.
|
Woodpecker CI plugin to build and publish multiarch Docker images with buildx.
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- spellchecker-disable -->
|
<!-- spellchecker-disable -->
|
||||||
@ -24,7 +24,7 @@ The tags follow the major version of Docker, e.g. `20`, and the minor and patch
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
{{< hint type=important >}}
|
{{< 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.
|
Be aware that the this plugin requires [privileged](https://docs.wp.io/pipeline/docker/syntax/steps/#privileged-mode) capabilities, otherwise the integrated Docker daemon is not able to start.
|
||||||
{{< /hint >}}
|
{{< /hint >}}
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -33,7 +33,7 @@ name: default
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: docker
|
- name: docker
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
image: thegeeklab/wp-docker-buildx:23
|
||||||
privileged: true
|
privileged: true
|
||||||
settings:
|
settings:
|
||||||
username: octocat
|
username: octocat
|
||||||
@ -46,7 +46,7 @@ steps:
|
|||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- spellchecker-disable -->
|
<!-- spellchecker-disable -->
|
||||||
{{< propertylist name=drone-docker-buildx.data sort=name >}}
|
{{< propertylist name=wp-docker-buildx.data sort=name >}}
|
||||||
<!-- spellchecker-enable -->
|
<!-- spellchecker-enable -->
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ name: default
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: docker
|
- name: docker
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
image: thegeeklab/wp-docker-buildx:23
|
||||||
privileged: true
|
privileged: true
|
||||||
settings:
|
settings:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
@ -82,7 +82,7 @@ name: default
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: docker
|
- name: docker
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
image: thegeeklab/wp-docker-buildx:23
|
||||||
privileged: true
|
privileged: true
|
||||||
environment:
|
environment:
|
||||||
AWS_ACCESS_KEY_ID:
|
AWS_ACCESS_KEY_ID:
|
||||||
@ -111,7 +111,7 @@ make build
|
|||||||
Build the Docker image with the following command:
|
Build the Docker image with the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx .
|
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/wp-docker-buildx .
|
||||||
```
|
```
|
||||||
|
|
||||||
## Test
|
## Test
|
||||||
@ -120,9 +120,9 @@ docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx
|
|||||||
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=00000000 \
|
-e CI_COMMIT_SHA=00000000 \
|
||||||
-v $(pwd):$(pwd) \
|
-v $(pwd):$(pwd) \
|
||||||
-w $(pwd) \
|
-w $(pwd) \
|
||||||
--privileged \
|
--privileged \
|
||||||
thegeeklab/drone-docker-buildx --dry-run
|
thegeeklab/wp-docker-buildx --dry-run
|
||||||
```
|
```
|
||||||
|
@ -78,7 +78,7 @@ properties:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- name: Build
|
- name: Build
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
image: thegeeklab/wp-docker-buildx:23
|
||||||
settings:
|
settings:
|
||||||
repo: example/repo
|
repo: example/repo
|
||||||
buildkit_config: |
|
buildkit_config: |
|
||||||
@ -167,7 +167,7 @@ properties:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- name: Build
|
- name: Build
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
image: thegeeklab/wp-docker-buildx:23
|
||||||
settings:
|
settings:
|
||||||
repo: example/repo
|
repo: example/repo
|
||||||
cache_from:
|
cache_from:
|
||||||
@ -276,7 +276,7 @@ properties:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- name: Build
|
- name: Build
|
||||||
image: thegeeklab/drone-docker-buildx:23
|
image: thegeeklab/wp-docker-buildx:23
|
||||||
privileged: true
|
privileged: true
|
||||||
environment:
|
environment:
|
||||||
SECURE_TOKEN:
|
SECURE_TOKEN:
|
||||||
@ -289,7 +289,7 @@ properties:
|
|||||||
- "id=SECRET_TOKEN"
|
- "id=SECRET_TOKEN"
|
||||||
```
|
```
|
||||||
|
|
||||||
To use secrets from files a [host volume](https://docs.drone.io/pipeline/docker/syntax/volumes/host/) is required.
|
To use secrets from files a [host volume](https://docs.wp.io/pipeline/docker/syntax/volumes/host/) is required.
|
||||||
This should be used with caution and avoided whenever possible.
|
This should be used with caution and avoided whenever possible.
|
||||||
type: list
|
type: list
|
||||||
required: false
|
required: false
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"github.com/thegeeklab/drone-docker-buildx/plugin"
|
|
||||||
"github.com/urfave/cli/v2"
|
|
||||||
|
|
||||||
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
|
|
||||||
"github.com/thegeeklab/drone-plugin-lib/v2/urfave"
|
|
||||||
)
|
|
||||||
|
|
||||||
//nolint:gochecknoglobals
|
|
||||||
var (
|
|
||||||
BuildVersion = "devel"
|
|
||||||
BuildDate = "00000000"
|
|
||||||
)
|
|
||||||
|
|
||||||
var ErrTypeAssertionFailed = errors.New("type assertion failed")
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
settings := &plugin.Settings{}
|
|
||||||
|
|
||||||
if _, err := os.Stat("/run/drone/env"); err == nil {
|
|
||||||
_ = godotenv.Overload("/run/drone/env")
|
|
||||||
}
|
|
||||||
|
|
||||||
cli.VersionPrinter = func(c *cli.Context) {
|
|
||||||
fmt.Printf("%s version=%s date=%s\n", c.App.Name, c.App.Version, BuildDate)
|
|
||||||
}
|
|
||||||
|
|
||||||
app := &cli.App{
|
|
||||||
Name: "drone-docker-buildx",
|
|
||||||
Usage: "build docker container with DinD and buildx",
|
|
||||||
Version: BuildVersion,
|
|
||||||
Flags: append(settingsFlags(settings, urfave.FlagsPluginCategory), urfave.Flags()...),
|
|
||||||
Action: run(settings),
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
|
||||||
logrus.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func run(settings *plugin.Settings) cli.ActionFunc {
|
|
||||||
return func(ctx *cli.Context) error {
|
|
||||||
urfave.LoggingFromContext(ctx)
|
|
||||||
|
|
||||||
cacheFrom, ok := ctx.Generic("cache-from").(*drone.StringSliceFlag)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("%w: failed to read cache-from input", ErrTypeAssertionFailed)
|
|
||||||
}
|
|
||||||
|
|
||||||
settings.Build.CacheFrom = cacheFrom.Get()
|
|
||||||
|
|
||||||
secrets, ok := ctx.Generic("secrets").(*drone.StringSliceFlag)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("%w: failed to read secrets input", ErrTypeAssertionFailed)
|
|
||||||
}
|
|
||||||
|
|
||||||
settings.Build.Secrets = secrets.Get()
|
|
||||||
|
|
||||||
plugin := plugin.New(
|
|
||||||
*settings,
|
|
||||||
urfave.PipelineFromContext(ctx),
|
|
||||||
urfave.NetworkFromContext(ctx),
|
|
||||||
)
|
|
||||||
|
|
||||||
if err := plugin.Validate(); err != nil {
|
|
||||||
return fmt.Errorf("validation failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := plugin.Execute(); err != nil {
|
|
||||||
return fmt.Errorf("execution failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/thegeeklab/drone-docker-buildx/plugin"
|
"github.com/thegeeklab/wp-docker-buildx/plugin"
|
||||||
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
|
wp "github.com/thegeeklab/wp-plugin-go/plugin"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
Name: "cache-from",
|
Name: "cache-from",
|
||||||
EnvVars: []string{"PLUGIN_CACHE_FROM"},
|
EnvVars: []string{"PLUGIN_CACHE_FROM"},
|
||||||
Usage: "images to consider as cache sources",
|
Usage: "images to consider as cache sources",
|
||||||
Value: &drone.StringSliceFlag{},
|
Value: &wp.StringSliceFlag{},
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
@ -325,7 +325,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
Name: "secrets",
|
Name: "secrets",
|
||||||
EnvVars: []string{"PLUGIN_SECRETS"},
|
EnvVars: []string{"PLUGIN_SECRETS"},
|
||||||
Usage: "exposes secrets to the build",
|
Usage: "exposes secrets to the build",
|
||||||
Value: &drone.StringSliceFlag{},
|
Value: &wp.StringSliceFlag{},
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
}
|
}
|
31
cmd/wp-docker-buildx/main.go
Normal file
31
cmd/wp-docker-buildx/main.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/thegeeklab/wp-docker-buildx/plugin"
|
||||||
|
|
||||||
|
wp "github.com/thegeeklab/wp-plugin-go/plugin"
|
||||||
|
)
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
|
var (
|
||||||
|
BuildVersion = "devel"
|
||||||
|
BuildDate = "00000000"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ErrTypeAssertionFailed = errors.New("type assertion failed")
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
settings := &plugin.Settings{}
|
||||||
|
options := wp.Options{
|
||||||
|
Name: "wp-docker-buildx",
|
||||||
|
Description: "Build OCI container with DinD and buildx",
|
||||||
|
Version: BuildVersion,
|
||||||
|
VersionMetadata: fmt.Sprintf("date=%s", BuildDate),
|
||||||
|
Flags: settingsFlags(settings, wp.FlagsPluginCategory),
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.New(options, settings).Run()
|
||||||
|
}
|
13
go.mod
13
go.mod
@ -1,18 +1,21 @@
|
|||||||
module github.com/thegeeklab/drone-docker-buildx
|
module github.com/thegeeklab/wp-docker-buildx
|
||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/coreos/go-semver v0.3.1
|
github.com/coreos/go-semver v0.3.1
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/rs/zerolog v1.30.0
|
||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/thegeeklab/wp-plugin-go v0.0.0-20230813200355-be61f319f791
|
||||||
github.com/thegeeklab/drone-plugin-lib/v2 v2.3.4
|
github.com/urfave/cli/v2 v2.25.7
|
||||||
github.com/urfave/cli/v2 v2.25.5
|
|
||||||
golang.org/x/sys v0.11.0
|
golang.org/x/sys v0.11.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||||
|
github.com/joho/godotenv v1.5.1 // indirect
|
||||||
|
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||||
|
golang.org/x/net v0.14.0 // indirect
|
||||||
)
|
)
|
||||||
|
36
go.sum
36
go.sum
@ -1,31 +1,35 @@
|
|||||||
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
||||||
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
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/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||||
|
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||||
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
|
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
|
||||||
|
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
|
||||||
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/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
github.com/thegeeklab/wp-plugin-go v0.0.0-20230813123155-c2338b40b883 h1:Q9AQZgj8bdFxNTkngJfthDSc911Cz4LioPUFLMxzhYI=
|
||||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
github.com/thegeeklab/wp-plugin-go v0.0.0-20230813123155-c2338b40b883/go.mod h1:7PWAZiTnZ2fAvjsedopQJ6w873KuSxUWsAml1Yib8a0=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/thegeeklab/wp-plugin-go v0.0.0-20230813200355-be61f319f791 h1:tgFeRHdH/VXqpT4ChAuAWKXmiMcF24sQd7C7TYTEJUA=
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/thegeeklab/wp-plugin-go v0.0.0-20230813200355-be61f319f791/go.mod h1:7PWAZiTnZ2fAvjsedopQJ6w873KuSxUWsAml1Yib8a0=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs=
|
||||||
github.com/thegeeklab/drone-plugin-lib/v2 v2.3.4 h1:Quzrike/xRAR0izxQ0d+ocJyIUm4h1497Oyo9grcRzg=
|
github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
|
||||||
github.com/thegeeklab/drone-plugin-lib/v2 v2.3.4/go.mod h1:qWVUZCmwL0Ntwa/hvyqM03EeIr1ReBR2XJsmIc7MGus=
|
|
||||||
github.com/urfave/cli/v2 v2.25.5 h1:d0NIAyhh5shGscroL7ek/Ya9QYQE0KNabJgiUinIQkc=
|
|
||||||
github.com/urfave/cli/v2 v2.25.5/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||||
|
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||||
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
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.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p Plugin) startCoredns() {
|
func (p Plugin) startCoredns() {
|
||||||
cmd := exec.Command("coredns", "-conf", "/etc/coredns/Corefile")
|
cmd := exec.Command("coredns", "-conf", "/etc/coredns/Corefile")
|
||||||
if p.settings.Daemon.Debug {
|
if p.Settings.Daemon.Debug {
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,8 +13,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (p Plugin) startDaemon() {
|
func (p Plugin) startDaemon() {
|
||||||
cmd := commandDaemon(p.settings.Daemon)
|
cmd := commandDaemon(p.Settings.Daemon)
|
||||||
if p.settings.Daemon.Debug {
|
if p.Settings.Daemon.Debug {
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
} else {
|
} else {
|
||||||
|
179
plugin/impl.go
179
plugin/impl.go
@ -1,108 +1,75 @@
|
|||||||
package plugin
|
package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/rs/zerolog/log"
|
||||||
|
wp "github.com/thegeeklab/wp-plugin-go/plugin"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"golang.org/x/sys/execabs"
|
"golang.org/x/sys/execabs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Daemon defines Docker daemon parameters.
|
var ErrTypeAssertionFailed = errors.New("type assertion failed")
|
||||||
type Daemon struct {
|
|
||||||
Registry string // Docker registry
|
|
||||||
Mirror string // Docker registry mirror
|
|
||||||
Insecure bool // Docker daemon enable insecure registries
|
|
||||||
StorageDriver string // Docker daemon storage driver
|
|
||||||
StoragePath string // Docker daemon storage path
|
|
||||||
Disabled bool // DOcker daemon is disabled (already running)
|
|
||||||
Debug bool // Docker daemon started in debug mode
|
|
||||||
Bip string // Docker daemon network bridge IP address
|
|
||||||
DNS cli.StringSlice // Docker daemon dns server
|
|
||||||
DNSSearch cli.StringSlice // Docker daemon dns search domain
|
|
||||||
MTU string // Docker daemon mtu setting
|
|
||||||
IPv6 bool // Docker daemon IPv6 networking
|
|
||||||
Experimental bool // Docker daemon enable experimental mode
|
|
||||||
BuildkitConfig string // Docker buildkit config
|
|
||||||
}
|
|
||||||
|
|
||||||
// Login defines Docker login parameters.
|
|
||||||
type Login struct {
|
|
||||||
Registry string // Docker registry address
|
|
||||||
Username string // Docker registry username
|
|
||||||
Password string // Docker registry password
|
|
||||||
Email string // Docker registry email
|
|
||||||
Config string // Docker Auth Config
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build defines Docker build parameters.
|
|
||||||
type Build struct {
|
|
||||||
Ref string // Git commit ref
|
|
||||||
Branch string // Git repository branch
|
|
||||||
Dockerfile string // Docker build Dockerfile
|
|
||||||
Context string // Docker build context
|
|
||||||
TagsAuto bool // Docker build auto tag
|
|
||||||
TagsSuffix string // Docker build tags with suffix
|
|
||||||
Tags cli.StringSlice // Docker build tags
|
|
||||||
ExtraTags cli.StringSlice // Docker build tags including registry
|
|
||||||
Platforms cli.StringSlice // Docker build target platforms
|
|
||||||
Args cli.StringSlice // Docker build args
|
|
||||||
ArgsEnv cli.StringSlice // Docker build args from env
|
|
||||||
Target string // Docker build target
|
|
||||||
Pull bool // Docker build pull
|
|
||||||
CacheFrom []string // Docker build cache-from
|
|
||||||
CacheTo string // Docker build cache-to
|
|
||||||
Compress bool // Docker build compress
|
|
||||||
Repo string // Docker build repository
|
|
||||||
NoCache bool // Docker build no-cache
|
|
||||||
AddHost cli.StringSlice // Docker build add-host
|
|
||||||
Quiet bool // Docker build quiet
|
|
||||||
Output string // Docker build output folder
|
|
||||||
NamedContext cli.StringSlice // Docker build named context
|
|
||||||
Labels cli.StringSlice // Docker build labels
|
|
||||||
Provenance string // Docker build provenance attestation
|
|
||||||
SBOM string // Docker build sbom attestation
|
|
||||||
Secrets []string // Docker build secrets
|
|
||||||
}
|
|
||||||
|
|
||||||
// Settings for the Plugin.
|
|
||||||
type Settings struct {
|
|
||||||
Daemon Daemon
|
|
||||||
Login Login
|
|
||||||
Build Build
|
|
||||||
Dryrun bool
|
|
||||||
}
|
|
||||||
|
|
||||||
const strictFilePerm = 0o600
|
const strictFilePerm = 0o600
|
||||||
|
|
||||||
// Validate handles the settings validation of the plugin.
|
// Execute provides the implementation of the plugin.
|
||||||
func (p *Plugin) Validate() error {
|
//
|
||||||
p.settings.Build.Branch = p.pipeline.Repo.Branch
|
//nolint:revive
|
||||||
p.settings.Build.Ref = p.pipeline.Commit.Ref
|
func (p *Plugin) run(ctx context.Context, cCtx *cli.Context) error {
|
||||||
p.settings.Daemon.Registry = p.settings.Login.Registry
|
cacheFrom, ok := cCtx.Generic("cache-from").(*wp.StringSliceFlag)
|
||||||
|
if !ok {
|
||||||
if p.settings.Build.TagsAuto {
|
return fmt.Errorf("%w: failed to read cache-from input", ErrTypeAssertionFailed)
|
||||||
// return true if tag event or default branch
|
|
||||||
if UseDefaultTag(
|
|
||||||
p.settings.Build.Ref,
|
|
||||||
p.settings.Build.Branch,
|
|
||||||
) {
|
|
||||||
tag, err := DefaultTagSuffix(
|
|
||||||
p.settings.Build.Ref,
|
|
||||||
p.settings.Build.TagsSuffix,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
logrus.Infof("cannot generate tags from %s, invalid semantic version", p.settings.Build.Ref)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p.settings.Build.Tags = *cli.NewStringSlice(tag...)
|
p.Settings.Build.CacheFrom = cacheFrom.Get()
|
||||||
|
|
||||||
|
secrets, ok := cCtx.Generic("secrets").(*wp.StringSliceFlag)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("%w: failed to read secrets input", ErrTypeAssertionFailed)
|
||||||
|
}
|
||||||
|
|
||||||
|
p.Settings.Build.Secrets = secrets.Get()
|
||||||
|
|
||||||
|
if err := p.Validate(); err != nil {
|
||||||
|
return fmt.Errorf("validation failed: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := p.Execute(); err != nil {
|
||||||
|
return fmt.Errorf("execution failed: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate handles the settings validation of the plugin.
|
||||||
|
func (p *Plugin) Validate() error {
|
||||||
|
p.Settings.Build.Branch = p.Metadata.Repository.Branch
|
||||||
|
p.Settings.Build.Ref = p.Metadata.Curr.Ref
|
||||||
|
p.Settings.Daemon.Registry = p.Settings.Login.Registry
|
||||||
|
|
||||||
|
if p.Settings.Build.TagsAuto {
|
||||||
|
// return true if tag event or default branch
|
||||||
|
if UseDefaultTag(
|
||||||
|
p.Settings.Build.Ref,
|
||||||
|
p.Settings.Build.Branch,
|
||||||
|
) {
|
||||||
|
tag, err := DefaultTagSuffix(
|
||||||
|
p.Settings.Build.Ref,
|
||||||
|
p.Settings.Build.TagsSuffix,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot generate tags from %s, invalid semantic version: %w", p.Settings.Build.Ref, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
p.Settings.Build.Tags = *cli.NewStringSlice(tag...)
|
||||||
} else {
|
} else {
|
||||||
logrus.Infof("skip auto-tagging for %s, not on default branch or tag", p.settings.Build.Ref)
|
log.Info().Msgf("skip auto-tagging for %s, not on default branch or tag", p.Settings.Build.Ref)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -117,19 +84,19 @@ func (p *Plugin) Validate() error {
|
|||||||
func (p *Plugin) Execute() error {
|
func (p *Plugin) Execute() error {
|
||||||
// start the Docker daemon server
|
// start the Docker daemon server
|
||||||
//nolint: nestif
|
//nolint: nestif
|
||||||
if !p.settings.Daemon.Disabled {
|
if !p.Settings.Daemon.Disabled {
|
||||||
// If no custom DNS value set start internal DNS server
|
// If no custom DNS value set start internal DNS server
|
||||||
if len(p.settings.Daemon.DNS.Value()) == 0 {
|
if len(p.Settings.Daemon.DNS.Value()) == 0 {
|
||||||
ip, err := getContainerIP()
|
ip, err := getContainerIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Warnf("error detecting IP address: %v", err)
|
log.Warn().Msgf("error detecting IP address: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ip != "" {
|
if ip != "" {
|
||||||
logrus.Debugf("discovered IP address: %v", ip)
|
log.Debug().Msgf("discovered IP address: %v", ip)
|
||||||
p.startCoredns()
|
p.startCoredns()
|
||||||
|
|
||||||
if err := p.settings.Daemon.DNS.Set(ip); err != nil {
|
if err := p.Settings.Daemon.DNS.Set(ip); err != nil {
|
||||||
return fmt.Errorf("error setting daemon dns: %w", err)
|
return fmt.Errorf("error setting daemon dns: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,22 +119,22 @@ func (p *Plugin) Execute() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create Auth Config File
|
// Create Auth Config File
|
||||||
if p.settings.Login.Config != "" {
|
if p.Settings.Login.Config != "" {
|
||||||
if err := os.MkdirAll(dockerHome, strictFilePerm); err != nil {
|
if err := os.MkdirAll(dockerHome, strictFilePerm); err != nil {
|
||||||
return fmt.Errorf("failed to create docker home: %w", err)
|
return fmt.Errorf("failed to create docker home: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
path := filepath.Join(dockerHome, "config.json")
|
path := filepath.Join(dockerHome, "config.json")
|
||||||
|
|
||||||
err := os.WriteFile(path, []byte(p.settings.Login.Config), strictFilePerm)
|
err := os.WriteFile(path, []byte(p.Settings.Login.Config), strictFilePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error writing config.json: %w", err)
|
return fmt.Errorf("error writing config.json: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// login to the Docker registry
|
// login to the Docker registry
|
||||||
if p.settings.Login.Password != "" {
|
if p.Settings.Login.Password != "" {
|
||||||
cmd := commandLogin(p.settings.Login)
|
cmd := commandLogin(p.Settings.Login)
|
||||||
|
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -175,32 +142,32 @@ func (p *Plugin) Execute() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.settings.Daemon.BuildkitConfig != "" {
|
if p.Settings.Daemon.BuildkitConfig != "" {
|
||||||
err := os.WriteFile(buildkitConfig, []byte(p.settings.Daemon.BuildkitConfig), strictFilePerm)
|
err := os.WriteFile(buildkitConfig, []byte(p.Settings.Daemon.BuildkitConfig), strictFilePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error writing buildkit.toml: %w", err)
|
return fmt.Errorf("error writing buildkit.toml: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case p.settings.Login.Password != "":
|
case p.Settings.Login.Password != "":
|
||||||
logrus.Info("Detected registry credentials")
|
log.Info().Msgf("Detected registry credentials")
|
||||||
case p.settings.Login.Config != "":
|
case p.Settings.Login.Config != "":
|
||||||
logrus.Info("Detected registry credentials file")
|
log.Info().Msgf("Detected registry credentials file")
|
||||||
default:
|
default:
|
||||||
logrus.Info("Registry credentials or Docker config not provided. Guest mode enabled.")
|
log.Info().Msgf("Registry credentials or Docker config not provided. Guest mode enabled.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// add proxy build args
|
// add proxy build args
|
||||||
addProxyBuildArgs(&p.settings.Build)
|
addProxyBuildArgs(&p.Settings.Build)
|
||||||
|
|
||||||
var cmds []*execabs.Cmd
|
var cmds []*execabs.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(p.settings.Daemon))
|
cmds = append(cmds, commandBuilder(p.Settings.Daemon))
|
||||||
cmds = append(cmds, commandBuildx())
|
cmds = append(cmds, commandBuildx())
|
||||||
|
|
||||||
cmds = append(cmds, commandBuild(p.settings.Build, p.settings.Dryrun)) // docker build
|
cmds = append(cmds, commandBuild(p.Settings.Build, p.Settings.Dryrun)) // docker build
|
||||||
|
|
||||||
// execute all commands in batch mode.
|
// execute all commands in batch mode.
|
||||||
for _, cmd := range cmds {
|
for _, cmd := range cmds {
|
||||||
|
@ -1,21 +1,88 @@
|
|||||||
package plugin
|
package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
|
wp "github.com/thegeeklab/wp-plugin-go/plugin"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Plugin implements drone.Plugin to provide the plugin implementation.
|
// Plugin implements provide the plugin implementation.
|
||||||
type Plugin struct {
|
type Plugin struct {
|
||||||
settings Settings
|
*wp.Plugin
|
||||||
pipeline drone.Pipeline
|
Settings *Settings
|
||||||
network drone.Network
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New initializes a plugin from the given Settings, Pipeline, and Network.
|
// Settings for the Plugin.
|
||||||
func New(settings Settings, pipeline drone.Pipeline, network drone.Network) *Plugin {
|
type Settings struct {
|
||||||
return &Plugin{
|
Daemon Daemon
|
||||||
settings: settings,
|
Login Login
|
||||||
pipeline: pipeline,
|
Build Build
|
||||||
network: network,
|
Dryrun bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Daemon defines Docker daemon parameters.
|
||||||
|
type Daemon struct {
|
||||||
|
Registry string // Docker registry
|
||||||
|
Mirror string // Docker registry mirror
|
||||||
|
Insecure bool // Docker daemon enable insecure registries
|
||||||
|
StorageDriver string // Docker daemon storage driver
|
||||||
|
StoragePath string // Docker daemon storage path
|
||||||
|
Disabled bool // DOcker daemon is disabled (already running)
|
||||||
|
Debug bool // Docker daemon started in debug mode
|
||||||
|
Bip string // Docker daemon network bridge IP address
|
||||||
|
DNS cli.StringSlice // Docker daemon dns server
|
||||||
|
DNSSearch cli.StringSlice // Docker daemon dns search domain
|
||||||
|
MTU string // Docker daemon mtu setting
|
||||||
|
IPv6 bool // Docker daemon IPv6 networking
|
||||||
|
Experimental bool // Docker daemon enable experimental mode
|
||||||
|
BuildkitConfig string // Docker buildkit config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Login defines Docker login parameters.
|
||||||
|
type Login struct {
|
||||||
|
Registry string // Docker registry address
|
||||||
|
Username string // Docker registry username
|
||||||
|
Password string // Docker registry password
|
||||||
|
Email string // Docker registry email
|
||||||
|
Config string // Docker Auth Config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build defines Docker build parameters.
|
||||||
|
type Build struct {
|
||||||
|
Ref string // Git commit ref
|
||||||
|
Branch string // Git repository branch
|
||||||
|
Dockerfile string // Docker build Dockerfile
|
||||||
|
Context string // Docker build context
|
||||||
|
TagsAuto bool // Docker build auto tag
|
||||||
|
TagsSuffix string // Docker build tags with suffix
|
||||||
|
Tags cli.StringSlice // Docker build tags
|
||||||
|
ExtraTags cli.StringSlice // Docker build tags including registry
|
||||||
|
Platforms cli.StringSlice // Docker build target platforms
|
||||||
|
Args cli.StringSlice // Docker build args
|
||||||
|
ArgsEnv cli.StringSlice // Docker build args from env
|
||||||
|
Target string // Docker build target
|
||||||
|
Pull bool // Docker build pull
|
||||||
|
CacheFrom []string // Docker build cache-from
|
||||||
|
CacheTo string // Docker build cache-to
|
||||||
|
Compress bool // Docker build compress
|
||||||
|
Repo string // Docker build repository
|
||||||
|
NoCache bool // Docker build no-cache
|
||||||
|
AddHost cli.StringSlice // Docker build add-host
|
||||||
|
Quiet bool // Docker build quiet
|
||||||
|
Output string // Docker build output folder
|
||||||
|
NamedContext cli.StringSlice // Docker build named context
|
||||||
|
Labels cli.StringSlice // Docker build labels
|
||||||
|
Provenance string // Docker build provenance attestation
|
||||||
|
SBOM string // Docker build sbom attestation
|
||||||
|
Secrets []string // Docker build secrets
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(options wp.Options, settings *Settings) *Plugin {
|
||||||
|
p := &Plugin{}
|
||||||
|
|
||||||
|
options.Execute = p.run
|
||||||
|
|
||||||
|
p.Plugin = wp.New(options)
|
||||||
|
p.Settings = settings
|
||||||
|
|
||||||
|
return p
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user