cleanup makefile (#45)

This commit is contained in:
Robert Kaussow 2022-04-25 12:48:52 +02:00 committed by GitHub
parent ecfb0daa85
commit 4b1e479d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 78 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
*
!dist/

View File

@ -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',
@ -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',
@ -79,7 +77,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 +125,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',
@ -143,14 +140,11 @@ local PipelineBuildContainer(arch='amd64') = {
}, },
{ {
name: 'dryrun', name: 'dryrun',
image: 'plugins/docker:19', image: 'thegeeklab/drone-docker:19',
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 +153,8 @@ local PipelineBuildContainer(arch='amd64') = {
}, },
{ {
name: 'publish-dockerhub', name: 'publish-dockerhub',
image: 'plugins/docker:19', image: 'thegeeklab/drone-docker:19',
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 +169,8 @@ local PipelineBuildContainer(arch='amd64') = {
}, },
{ {
name: 'publish-quay', name: 'publish-quay',
image: 'plugins/docker:19', image: 'thegeeklab/drone-docker:19',
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,
@ -258,7 +250,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',

View File

@ -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
@ -61,7 +58,7 @@ steps:
- 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 +86,6 @@ steps:
ref: ref:
- refs/tags/** - refs/tags/**
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
@ -116,17 +110,11 @@ steps:
- make build - make build
- name: dryrun - name: dryrun
image: plugins/docker:19 image: thegeeklab/drone-docker:19
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 +122,10 @@ steps:
- build - build
- name: publish-dockerhub - name: publish-dockerhub
image: plugins/docker:19 image: thegeeklab/drone-docker:19
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 +140,10 @@ steps:
- dryrun - dryrun
- name: publish-quay - name: publish-quay
image: plugins/docker:19 image: thegeeklab/drone-docker:19
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 +158,6 @@ steps:
depends_on: depends_on:
- dryrun - dryrun
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
@ -201,17 +182,11 @@ steps:
- make build - make build
- name: dryrun - name: dryrun
image: plugins/docker:19 image: thegeeklab/drone-docker:19
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 +194,10 @@ steps:
- build - build
- name: publish-dockerhub - name: publish-dockerhub
image: plugins/docker:19 image: thegeeklab/drone-docker:19
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 +212,10 @@ steps:
- dryrun - dryrun
- name: publish-quay - name: publish-quay
image: plugins/docker:19 image: thegeeklab/drone-docker:19
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,9 +230,6 @@ steps:
depends_on: depends_on:
- dryrun - dryrun
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
@ -286,17 +254,11 @@ steps:
- make build - make build
- name: dryrun - name: dryrun
image: plugins/docker:19 image: thegeeklab/drone-docker:19
settings: settings:
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm dockerfile: docker/Dockerfile.arm
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/**
@ -304,12 +266,10 @@ steps:
- build - build
- name: publish-dockerhub - name: publish-dockerhub
image: plugins/docker:19 image: thegeeklab/drone-docker:19
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: arm auto_tag_suffix: arm
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm dockerfile: docker/Dockerfile.arm
password: password:
from_secret: docker_password from_secret: docker_password
@ -324,12 +284,10 @@ steps:
- dryrun - dryrun
- name: publish-quay - name: publish-quay
image: plugins/docker:19 image: thegeeklab/drone-docker:19
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: arm auto_tag_suffix: arm
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm dockerfile: docker/Dockerfile.arm
password: password:
from_secret: quay_password from_secret: quay_password
@ -344,9 +302,6 @@ steps:
depends_on: depends_on:
- dryrun - dryrun
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
@ -486,9 +441,6 @@ steps:
- success - success
- failure - failure
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
@ -502,6 +454,6 @@ depends_on:
--- ---
kind: signature kind: signature
hmac: 9ee9ec07028e26d74e30bb239266b01dd105621178225d50bf2a214712d816e9 hmac: 9272f58ad1c23c3d09fe6d4c61d4f6343c9fc70229826a55c45179182b6e5f49
... ...

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/dist/ /dist/
/release/
/drone-docker* /drone-docker*
coverage.out coverage.out

View File

@ -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)

View File

@ -31,7 +31,7 @@ export GOARCH=amd64
export CGO_ENABLED=0 export CGO_ENABLED=0
export GO111MODULE=on export GO111MODULE=on
go build -v -a -tags netgo -o release/amd64/drone-docker ./cmd/drone-docker/ make build
``` ```
Build the Docker image with the following command: Build the Docker image with the following command: