From d9764025be82a928f2576d80b49d522699d06ae2 Mon Sep 17 00:00:00 2001 From: Marvin Steadfast Date: Wed, 20 Jan 2021 15:24:38 +0100 Subject: [PATCH] adds drone yaml --- .drone.yml | 64 +++++++++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 25 ---------------- .pre-commit-config.yaml | 22 -------------- wg.go | 4 +-- 4 files changed, 66 insertions(+), 49 deletions(-) create mode 100644 .drone.yml delete mode 100644 .gitlab-ci.yml delete mode 100644 .pre-commit-config.yaml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..11843a8 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,64 @@ +--- +kind: pipeline +name: default + +steps: + - name: fetch + image: docker:git + commands: + - git fetch --tags + + - name: lint + image: golangci/golangci-lint:latest + commands: + - make lint + + - name: test + image: golang:latest + commands: + - make lint + + - name: build + image: goreleaser/goreleaser:latest + volumes: + - name: dockersock + path: /var/run + environment: + commands: + - make build + when: + event: + exclude: + - tag + depends_on: + - lint + - test + + - name: release + image: goreleaser/goreleaser:latest + volumes: + - name: dockersock + path: /var/run + environment: + GITEA_TOKEN: + from_secret: gitea_token + commands: + - make release + when: + event: + - tag + depends_on: + - lint + - test + +services: + - name: docker + image: docker:dind + privileged: true + volumes: + - name: dockersock + path: /var/run + +volumes: + - name: dockersock + temp: {} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index fec49c6..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,25 +0,0 @@ -stages: - - build -go_build: - stage: build - image: golang:1.12 - variables: - CGO_ENABLED: 0 - script: - - mkdir -p .cache/cache || true - - mkdir -p .cache/go || true - - export GOCACHE="$CI_PROJECT_DIR/.cache/cache" - - export GOPATH="$CI_PROJECT_DIR/.cache/go" - - CGO_ENABLED=1 go test -race ./... - - mkdir -p build || true - - go env - - GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o build/${CI_PROJECT_NAME}-amd64 ./cmd/wg-quick - - GOOS=linux GOARCH=arm GOARM=7 go build -a -ldflags '-extldflags "-static"' -o build/${CI_PROJECT_NAME}-arm32v7 ./cmd/wg-quick - - GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static"' -o build/${CI_PROJECT_NAME}-arm64v8 ./cmd/wg-quick - artifacts: - paths: - - build/ - cache: - key: ${CI_COMMIT_REF_SLUG} - paths: - - .cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 8ee1396..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,22 +0,0 @@ -exclude: ".vscode/*" -repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.1.0 - hooks: - - id: check-added-large-files - - id: check-ast - - id: check-case-conflict - - id: check-json - - id: check-merge-conflict - - id: check-symlinks - - id: end-of-file-fixer - - id: pretty-format-json - args: - - --autofix - - id: requirements-txt-fixer - - id: trailing-whitespace - - id: detect-private-key -- repo: git://github.com/dnephin/pre-commit-golang - rev: v0.3.2 - hooks: - - id: go-fmt diff --git a/wg.go b/wg.go index 11c6d2e..9f2252d 100644 --- a/wg.go +++ b/wg.go @@ -202,10 +202,10 @@ func SyncLink(cfg *Config, iface string, log logrus.FieldLogger) (netlink.Link, LinkType: "wireguard", } if err := netlink.LinkAdd(wgLink); err != nil { - log.WithError(err).Errorf("cannot create link: %w", err) + log.WithError(err).Errorf("cannot create link: %s", err.Error()) log.Info("trying to use embedded wireguard-go...") if err := wgGo(iface); err != nil { - log.WithError(err).Errorf("cannot create link through wireguard-go: %w", err) + log.WithError(err).Errorf("cannot create link through wireguard-go: %s", err.Error()) return nil, fmt.Errorf("cannot create link") } }