Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move entirely to zerolog #426

Merged
merged 9 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DOCKER_RUN_GO_VERSION=1.16
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*" -not -name "*.pb.go")
GO_PACKAGES ?= $(shell go list ./... | grep -v /vendor/)

VERSION ?= next
Expand Down Expand Up @@ -31,6 +31,9 @@ formatcheck:
format:
@gofmt -w ${GOFILES_NOVENDOR}

imports:
@goimports -local "github.com/woodpecker-ci" -w ${GOFILES_NOVENDOR}

.PHONY: clean
clean:
go clean -i ./...
Expand All @@ -41,6 +44,11 @@ vet:
@echo "Running go vet..."
@go vet $(GO_PACKAGES)

.PHONY: lint
lint:
go run vendor/github.com/rs/zerolog/cmd/lint/lint.go github.com/woodpecker-ci/woodpecker/cmd/agent
go run vendor/github.com/rs/zerolog/cmd/lint/lint.go github.com/woodpecker-ci/woodpecker/cmd/server

test-agent:
$(DOCKER_RUN) go test -race -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/agent $(GO_PACKAGES)

Expand Down
5 changes: 2 additions & 3 deletions agent/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import (
"sync"
"time"

"github.com/rs/zerolog/log"
"github.com/tevino/abool"
"google.golang.org/grpc/metadata"

"github.com/woodpecker-ci/woodpecker/pipeline"
"github.com/woodpecker-ci/woodpecker/pipeline/backend"
"github.com/woodpecker-ci/woodpecker/pipeline/multipart"
"github.com/woodpecker-ci/woodpecker/pipeline/rpc"

"github.com/rs/zerolog/log"
"github.com/tevino/abool"
)

// TODO: Implement log streaming.
Expand Down
1 change: 1 addition & 0 deletions cli/build/build_approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strconv"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_decline.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strconv"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"text/template"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strconv"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_last.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"text/template"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"text/template"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"text/template"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"text/template"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/build/build_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strconv"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
4 changes: 2 additions & 2 deletions cli/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"strconv"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"

"github.com/urfave/cli"
)

// Command exports the deploy command.
Expand Down
8 changes: 4 additions & 4 deletions cli/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"path"
"path/filepath"
"runtime"
"strings"

"github.com/drone/envsubst"
jolheiser marked this conversation as resolved.
Show resolved Hide resolved
"github.com/rs/zerolog/log"
"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/pipeline"
"github.com/woodpecker-ci/woodpecker/pipeline/backend"
"github.com/woodpecker-ci/woodpecker/pipeline/backend/docker"
Expand All @@ -22,8 +24,6 @@ import (
"github.com/woodpecker-ci/woodpecker/pipeline/frontend/yaml/matrix"
"github.com/woodpecker-ci/woodpecker/pipeline/interrupt"
"github.com/woodpecker-ci/woodpecker/pipeline/multipart"

"github.com/urfave/cli"
)

// Command exports the exec command.
Expand All @@ -33,7 +33,7 @@ var Command = cli.Command{
ArgsUsage: "[path/to/.woodpecker.yml]",
Action: func(c *cli.Context) {
if err := exec(c); err != nil {
log.Fatalln(err)
log.Fatal().Err(err).Msg("")
}
},
Flags: flags,
Expand Down
1 change: 1 addition & 0 deletions cli/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/pipeline/schema"
)

Expand Down
1 change: 1 addition & 0 deletions cli/log/log_purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strconv"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
4 changes: 2 additions & 2 deletions cli/registry/registry_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"io/ioutil"
"strings"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"

"github.com/urfave/cli"
)

var registryCreateCmd = cli.Command{
Expand Down
4 changes: 2 additions & 2 deletions cli/registry/registry_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"html/template"
"os"

"github.com/woodpecker-ci/woodpecker/cli/internal"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

var registryInfoCmd = cli.Command{
Expand Down
4 changes: 2 additions & 2 deletions cli/registry/registry_rm.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package registry

import (
"github.com/woodpecker-ci/woodpecker/cli/internal"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

var registryDeleteCmd = cli.Command{
Expand Down
4 changes: 2 additions & 2 deletions cli/registry/registry_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"io/ioutil"
"strings"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"

"github.com/urfave/cli"
)

var registryUpdateCmd = cli.Command{
Expand Down
1 change: 1 addition & 0 deletions cli/repo/repo_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/repo/repo_chown.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/repo/repo_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"text/template"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/repo/repo_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"text/template"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
1 change: 1 addition & 0 deletions cli/repo/repo_repair.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package repo

import (
"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
4 changes: 2 additions & 2 deletions cli/repo/repo_rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package repo
import (
"fmt"

"github.com/woodpecker-ci/woodpecker/cli/internal"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

var repoRemoveCmd = cli.Command{
Expand Down
1 change: 1 addition & 0 deletions cli/repo/repo_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"text/template"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
)

Expand Down
4 changes: 2 additions & 2 deletions cli/repo/repo_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
"time"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"

"github.com/urfave/cli"
)

var repoUpdateCmd = cli.Command{
Expand Down
4 changes: 2 additions & 2 deletions cli/secret/secret_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"io/ioutil"
"strings"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"

"github.com/urfave/cli"
)

var secretCreateCmd = cli.Command{
Expand Down
4 changes: 2 additions & 2 deletions cli/secret/secret_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"io/ioutil"
"strings"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"

"github.com/urfave/cli"
)

var secretUpdateCmd = cli.Command{
Expand Down
2 changes: 1 addition & 1 deletion cli/user/user_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"

"github.com/urfave/cli"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"

"github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
)

var userAddCmd = cli.Command{
Expand Down
14 changes: 6 additions & 8 deletions cmd/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,19 @@ import (
"os"
"sync"

grpccredentials "google.golang.org/grpc/credentials"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/tevino/abool"
"github.com/urfave/cli"
oldcontext "golang.org/x/net/context"
"google.golang.org/grpc"
grpccredentials "google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/metadata"

"github.com/woodpecker-ci/woodpecker/agent"
"github.com/woodpecker-ci/woodpecker/pipeline/backend/docker"
"github.com/woodpecker-ci/woodpecker/pipeline/rpc"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/tevino/abool"
"github.com/urfave/cli"
oldcontext "golang.org/x/net/context"
)

func loop(c *cli.Context) error {
Expand Down
1 change: 1 addition & 0 deletions cmd/agent/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"net/http"

"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/agent"
"github.com/woodpecker-ci/woodpecker/version"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"fmt"
"os"

"github.com/woodpecker-ci/woodpecker/version"

_ "github.com/joho/godotenv/autoload"
"github.com/urfave/cli"

"github.com/woodpecker-ci/woodpecker/version"
)

func main() {
Expand Down
Loading