diff --git a/.dockerignore b/.dockerignore
deleted file mode 100644
index 92d6c40..0000000
--- a/.dockerignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!dist/
diff --git a/.drone.jsonnet b/.drone.jsonnet
deleted file mode 100644
index 6d3d8c4..0000000
--- a/.drone.jsonnet
+++ /dev/null
@@ -1,355 +0,0 @@
-local PipelineTest = {
- kind: 'pipeline',
- name: 'test',
- platform: {
- os: 'linux',
- arch: 'amd64',
- },
- steps: [
- {
- name: 'deps',
- image: 'golang:1.19',
- commands: [
- 'make deps',
- ],
- volumes: [
- {
- name: 'godeps',
- path: '/go',
- },
- ],
- },
- {
- name: 'lint',
- image: 'golang:1.19',
- commands: [
- 'make lint',
- ],
- volumes: [
- {
- name: 'godeps',
- path: '/go',
- },
- ],
- },
- {
- name: 'test',
- image: 'golang:1.19',
- commands: [
- 'make test',
- ],
- volumes: [
- {
- name: 'godeps',
- path: '/go',
- },
- ],
- },
- ],
- volumes: [
- {
- name: 'godeps',
- temp: {},
- },
- ],
- trigger: {
- ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
- },
-};
-
-
-local PipelineBuildBinaries = {
- kind: 'pipeline',
- name: 'build-binaries',
- platform: {
- os: 'linux',
- arch: 'amd64',
- },
- steps: [
- {
- name: 'build',
- image: 'techknowlogick/xgo:go-1.19.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: {
- overwrite: true,
- api_key: {
- from_secret: 'github_token',
- },
- files: ['dist/*'],
- title: '${DRONE_TAG}',
- note: 'CHANGELOG.md',
- },
- when: {
- ref: [
- 'refs/tags/**',
- ],
- },
- },
- ],
- depends_on: [
- 'test',
- ],
- trigger: {
- ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
- },
-};
-
-local PipelineBuildContainer(arch='amd64') = {
- kind: 'pipeline',
- name: 'build-container-' + arch,
- platform: {
- os: 'linux',
- arch: arch,
- },
- steps: [
- {
- name: 'build',
- image: 'golang:1.19',
- commands: [
- 'make build',
- 'ls -l dist/drone-git-action',
- ],
- },
- {
- name: 'dryrun',
- image: 'thegeeklab/drone-docker-buildx:20',
- settings: {
- dry_run: true,
- dockerfile: 'docker/Dockerfile.' + arch,
- repo: 'thegeeklab/${DRONE_REPO_NAME}',
- },
- depends_on: ['build'],
- when: {
- ref: ['refs/pull/**'],
- },
- },
- {
- name: 'publish-dockerhub',
- image: 'thegeeklab/drone-docker-buildx:20',
- settings: {
- auto_tag: true,
- auto_tag_suffix: arch,
- dockerfile: 'docker/Dockerfile.' + arch,
- repo: 'thegeeklab/${DRONE_REPO_NAME}',
- username: { from_secret: 'docker_username' },
- password: { from_secret: 'docker_password' },
- },
- when: {
- ref: ['refs/heads/main', 'refs/tags/**'],
- },
- depends_on: ['dryrun'],
- },
- {
- name: 'publish-quay',
- image: 'thegeeklab/drone-docker-buildx:20',
- settings: {
- auto_tag: true,
- auto_tag_suffix: arch,
- dockerfile: 'docker/Dockerfile.' + arch,
- registry: 'quay.io',
- repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
- username: { from_secret: 'quay_username' },
- password: { from_secret: 'quay_password' },
- },
- when: {
- ref: ['refs/heads/main', 'refs/tags/**'],
- },
- depends_on: ['dryrun'],
- },
- ],
- depends_on: [
- 'test',
- ],
- trigger: {
- ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
- },
-};
-
-local PipelineDocs = {
- 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',
- message: 'auto-update documentation',
- branch: 'docs',
- pages_directory: '_docs/',
- netrc_password: { from_secret: 'github_token' },
- },
- when: {
- ref: ['refs/heads/main'],
- },
- },
- ],
- depends_on: [
- 'build-binaries',
- 'build-container-amd64',
- 'build-container-arm64',
- ],
- trigger: {
- ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
- },
-};
-
-local PipelineNotifications = {
- kind: 'pipeline',
- name: 'notifications',
- platform: {
- os: 'linux',
- arch: 'amd64',
- },
- steps: [
- {
- image: 'plugins/manifest',
- name: 'manifest-dockerhub',
- settings: {
- ignore_missing: true,
- auto_tag: true,
- username: { from_secret: 'docker_username' },
- password: { from_secret: 'docker_password' },
- spec: 'docker/manifest.tmpl',
- },
- when: {
- status: ['success'],
- },
- },
- {
- image: 'plugins/manifest',
- name: 'manifest-quay',
- settings: {
- ignore_missing: true,
- auto_tag: true,
- username: { from_secret: 'quay_username' },
- password: { from_secret: 'quay_password' },
- spec: 'docker/manifest-quay.tmpl',
- },
- when: {
- status: ['success'],
- },
- },
- {
- name: 'pushrm-dockerhub',
- image: 'chko/docker-pushrm:1',
- environment: {
- DOCKER_PASS: {
- from_secret: 'docker_password',
- },
- DOCKER_USER: {
- from_secret: 'docker_username',
- },
- PUSHRM_FILE: 'README.md',
- PUSHRM_SHORT: 'Drone plugin to execute git actions',
- 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' },
- roomid: { from_secret: 'matrix_roomid' },
- template: 'Status: **{{ build.Status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}
Message: {{ commit.Message.Title }}',
- username: { from_secret: 'matrix_username' },
- password: { from_secret: 'matrix_password' },
- },
- when: {
- status: ['success', 'failure'],
- },
- },
- ],
- depends_on: [
- 'docs',
- ],
- trigger: {
- ref: ['refs/heads/main', 'refs/tags/**'],
- status: ['success', 'failure'],
- },
-};
-
-[
- PipelineTest,
- PipelineBuildBinaries,
- PipelineBuildContainer(arch='amd64'),
- PipelineBuildContainer(arch='arm64'),
- PipelineDocs,
- PipelineNotifications,
-]
diff --git a/.drone.yml b/.drone.yml
index bf645f6..1dbd1bb 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -98,39 +98,42 @@ depends_on:
---
kind: pipeline
-name: build-container-amd64
+name: build-container
platform:
os: linux
arch: amd64
steps:
- - name: build
- image: golang:1.19
- commands:
- - make build
- - ls -l dist/drone-git-action
-
- name: dryrun
image: thegeeklab/drone-docker-buildx:20
settings:
- dockerfile: docker/Dockerfile.amd64
+ dockerfile: Dockerfile.multiarch
dry_run: true
+ platforms:
+ - linux/amd64
+ - linux/arm64
+ - linux/arm/v7
+ - linux/arm/v6
+ provenance: false
repo: thegeeklab/${DRONE_REPO_NAME}
when:
ref:
- refs/pull/**
- depends_on:
- - build
- name: publish-dockerhub
image: thegeeklab/drone-docker-buildx:20
settings:
auto_tag: true
- auto_tag_suffix: amd64
- dockerfile: docker/Dockerfile.amd64
+ dockerfile: Dockerfile.multiarch
password:
from_secret: docker_password
+ platforms:
+ - linux/amd64
+ - linux/arm64
+ - linux/arm/v7
+ - linux/arm/v6
+ provenance: false
repo: thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: docker_username
@@ -145,83 +148,15 @@ steps:
image: thegeeklab/drone-docker-buildx:20
settings:
auto_tag: true
- auto_tag_suffix: amd64
- dockerfile: docker/Dockerfile.amd64
- 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
-
-trigger:
- ref:
- - refs/heads/main
- - refs/tags/**
- - refs/pull/**
-
-depends_on:
- - test
-
----
-kind: pipeline
-name: build-container-arm64
-
-platform:
- os: linux
- arch: arm64
-
-steps:
- - name: build
- image: golang:1.19
- commands:
- - make build
- - ls -l dist/drone-git-action
-
- - name: dryrun
- image: thegeeklab/drone-docker-buildx:20
- settings:
- dockerfile: docker/Dockerfile.arm64
- dry_run: true
- repo: thegeeklab/${DRONE_REPO_NAME}
- when:
- ref:
- - refs/pull/**
- depends_on:
- - build
-
- - name: publish-dockerhub
- image: thegeeklab/drone-docker-buildx:20
- settings:
- auto_tag: true
- auto_tag_suffix: arm64
- dockerfile: docker/Dockerfile.arm64
- 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: thegeeklab/drone-docker-buildx:20
- settings:
- auto_tag: true
- auto_tag_suffix: arm64
- dockerfile: docker/Dockerfile.arm64
+ dockerfile: Dockerfile.multiarch
password:
from_secret: quay_password
+ platforms:
+ - linux/amd64
+ - linux/arm64
+ - linux/arm/v7
+ - linux/arm/v6
+ provenance: false
registry: quay.io
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
username:
@@ -291,8 +226,7 @@ trigger:
depends_on:
- build-binaries
- - build-container-amd64
- - build-container-arm64
+ - build-container
---
kind: pipeline
@@ -303,34 +237,6 @@ platform:
arch: amd64
steps:
- - name: manifest-dockerhub
- image: plugins/manifest
- settings:
- auto_tag: true
- ignore_missing: true
- password:
- from_secret: docker_password
- spec: docker/manifest.tmpl
- username:
- from_secret: docker_username
- when:
- status:
- - success
-
- - name: manifest-quay
- image: plugins/manifest
- settings:
- auto_tag: true
- ignore_missing: true
- password:
- from_secret: quay_password
- spec: docker/manifest-quay.tmpl
- username:
- from_secret: quay_username
- when:
- status:
- - success
-
- name: pushrm-dockerhub
image: chko/docker-pushrm:1
environment:
@@ -386,6 +292,6 @@ depends_on:
---
kind: signature
-hmac: 7c1be62f78be23605939401fbbdc75f9d809db6c489b9d35847ed047380697ce
+hmac: 8b920283ba7cc82bad64ea0eb55b8cf3de5aae95ca0f7018bac9f0deb8b22244
...
diff --git a/docker/Dockerfile.amd64 b/Dockerfile.multiarch
similarity index 72%
rename from docker/Dockerfile.amd64
rename to Dockerfile.multiarch
index 87783ce..24d6e60 100644
--- a/docker/Dockerfile.amd64
+++ b/Dockerfile.multiarch
@@ -1,3 +1,13 @@
+FROM --platform=$BUILDPLATFORM golang:1.19@sha256:bb9811fad43a7d6fd2173248d8331b2dcf5ac9af20976b1937ecd214c5b8c383 as build
+
+ARG TARGETOS
+ARG TARGETARCH
+
+ADD . /src
+WORKDIR /src
+
+RUN make build
+
FROM alpine:3.17@sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a
LABEL maintainer="Robert Kaussow "
@@ -11,6 +21,5 @@ RUN apk --update add --no-cache git rsync && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/*
-ADD dist/drone-git-action /bin/
-
+COPY --from=build /src/dist/drone-git-action /bin/drone-git-action
ENTRYPOINT ["/bin/drone-git-action"]
diff --git a/Makefile b/Makefile
index bd196bd..87de98d 100644
--- a/Makefile
+++ b/Makefile
@@ -20,9 +20,14 @@ XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
GENERATE ?=
XGO_VERSION := go-1.19.x
-XGO_TARGETS ?= linux/amd64,linux/arm64
+XGO_TARGETS ?= linux/amd64,linux/arm-6,linux/arm-7,linux/arm64
-TAGS ?= netgo osusergo
+TARGETOS ?= linux
+TARGETARCH ?= amd64
+ifneq ("$(TARGETVARIANT)","")
+GOARM ?= $(subst v,,$(TARGETVARIANT))
+endif
+TAGS ?= netgo,osusergo
ifndef VERSION
ifneq ($(DRONE_TAG),)
@@ -69,7 +74,7 @@ test:
build: $(DIST)/$(EXECUTABLE)
$(DIST)/$(EXECUTABLE): $(SOURCES)
- $(GO) build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
+ GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=$(GOARM) $(GO) build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
$(DIST_DIRS):
mkdir -p $(DIST_DIRS)
diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64
deleted file mode 100644
index 05fbfb2..0000000
--- a/docker/Dockerfile.arm64
+++ /dev/null
@@ -1,16 +0,0 @@
-FROM arm64v8/alpine:3.17@sha256:41d876d4e44348d1c27445fdb0e64592e0eb926d4dbbcf09a3526dee7e628329
-
-LABEL maintainer="Robert Kaussow "
-LABEL org.opencontainers.image.authors="Robert Kaussow "
-LABEL org.opencontainers.image.title="drone-git-action"
-LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-git-action"
-LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-git-action"
-LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-git-action"
-
-RUN apk --update add --no-cache git rsync && \
- rm -rf /var/cache/apk/* && \
- rm -rf /tmp/*
-
-ADD dist/drone-git-action /bin/
-
-ENTRYPOINT ["/bin/drone-git-action"]
diff --git a/docker/manifest-quay.tmpl b/docker/manifest-quay.tmpl
deleted file mode 100644
index 61d8d06..0000000
--- a/docker/manifest-quay.tmpl
+++ /dev/null
@@ -1,18 +0,0 @@
-image: quay.io/thegeeklab/drone-git-action:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
-{{#if build.tags}}
-tags:
-{{#each build.tags}}
- - {{this}}
-{{/each}}
-{{/if}}
-manifests:
- - image: quay.io/thegeeklab/drone-git-action:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
- platform:
- architecture: amd64
- os: linux
-
- - image: quay.io/thegeeklab/drone-git-action:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
- platform:
- architecture: arm64
- os: linux
- variant: v8
diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl
deleted file mode 100644
index 4bb3ed0..0000000
--- a/docker/manifest.tmpl
+++ /dev/null
@@ -1,18 +0,0 @@
-image: thegeeklab/drone-git-action:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
-{{#if build.tags}}
-tags:
-{{#each build.tags}}
- - {{this}}
-{{/each}}
-{{/if}}
-manifests:
- - image: thegeeklab/drone-git-action:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
- platform:
- architecture: amd64
- os: linux
-
- - image: thegeeklab/drone-git-action:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
- platform:
- architecture: arm64
- os: linux
- variant: v8