Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/tools/github.com/golan…
Browse files Browse the repository at this point in the history
…gci/golangci-lint-1.64.5
  • Loading branch information
katallaxie authored Feb 17, 2025
2 parents e553f9a + 54b0fd4 commit fa9615d
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 46 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- run: make release
if: success()
38 changes: 38 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,33 @@ builds:
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
no_unique_dist_dir: true
- id: runproc
binary: runproc-{{.Os}}-{{.Arch}}
main: cmd/runproc/main.go
goos:
- linux
goarch:
- amd64
- arm
- arm64
ignore:
- goos: darwin
goarch: 386
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
no_unique_dist_dir: true

archives:
- id: waitfor
builds:
- waitfor
name_template: "waitfor_{{.Version}}_{{.Os}}_{{.Arch}}"
- id: runproc
builds:
- runproc
name_template: "runproc_{{.Version}}_{{.Os}}_{{.Arch}}"

dockers:
- dockerfile: Dockerfile
Expand All @@ -47,6 +68,23 @@ dockers:
- "--label=org.opencontainers.image.version={{.Version}}"
- "--build-arg=BINARY=waitfor-linux-amd64"
- "--platform=linux/amd64"
- dockerfile: Dockerfile
goos: linux
goarch: amd64
ids:
- runproc
image_templates:
- "ghcr.io/zeiss/{{.ProjectName}}/runproc:latest"
- "ghcr.io/zeiss/{{.ProjectName}}/runproc:{{.Tag}}"
- "ghcr.io/zeiss/{{.ProjectName}}/runproc"
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--build-arg=BINARY=runproc-linux-amd64"
- "--platform=linux/amd64"

release:
header: |
Expand Down
24 changes: 14 additions & 10 deletions cmd/runproc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,39 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/zeiss/pkg/cmd/runproc/task"
)

type config struct {
file string
local string
File string
Local string
}

var cfg = &config{}

var rootCmd = &cobra.Command{
Use: "nctl",
Short: "nctl is a tool for managing operator resources",
Use: "runproc",
Short: `runproc is a simple process runner.`,
RunE: func(cmd *cobra.Command, args []string) error {
return runRoot(cmd.Context())
},
}

func init() {
rootCmd.Flags().StringP("file", "f", cfg.file, "Procfile to run.")
rootCmd.Flags().StringP("local", "l", cfg.local, "Local Procfile to append.")
rootCmd.Flags().StringVarP(&cfg.File, "file", "f", cfg.File, "Procfile to run.")
rootCmd.Flags().StringVarP(&cfg.Local, "local", "l", cfg.Local, "Local Procfile to append.")

rootCmd.SilenceUsage = true
rootCmd.SilenceErrors = true
}

func runRoot(ctx context.Context) error {
data, err := os.ReadFile(cfg.file)
data, err := os.ReadFile(cfg.File)
if err != nil {
log.Fatal(err)
}

envData, err := os.ReadFile(cfg.local)
envData, err := os.ReadFile(cfg.Local)
if err != nil {
return err
}
Expand All @@ -44,13 +48,13 @@ func runRoot(ctx context.Context) error {
buf.WriteString("\n")
buf.Write(envData)

tasks, err := Parse(buf)
tasks, err := task.Parse(buf)
if err != nil {
log.Fatalln(err)
}
log.SetFlags(log.Lshortfile)

run := NewRunner(tasks)
run := task.NewRunner(tasks)

err = run.Run(ctx)
if err != nil {
Expand Down
5 changes: 0 additions & 5 deletions cmd/runproc/signals.go

This file was deleted.

9 changes: 0 additions & 9 deletions cmd/runproc/signals_unix.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package task

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion cmd/runproc/parse.go → cmd/runproc/task/parse.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package task

import (
"bufio"
Expand Down
2 changes: 1 addition & 1 deletion cmd/runproc/prefixer.go → cmd/runproc/task/prefixer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package task

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion cmd/runproc/process.go → cmd/runproc/task/process.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package task

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package task

type ProcessRunner interface {
Start()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package task

import (
"time"
Expand Down
2 changes: 1 addition & 1 deletion cmd/runproc/runner.go → cmd/runproc/task/runner.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package task

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion cmd/runproc/task.go → cmd/runproc/task/task.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package task

type Task struct {
// Name used in logs
Expand Down
2 changes: 2 additions & 0 deletions examples/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
demo: watch tail /var/log/system.log
demo2: watch -n 1 date
Empty file added examples/Procfile.local
Empty file.
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ require (
golang.org/x/crypto v0.33.0
golang.org/x/mod v0.23.0
golang.org/x/sync v0.11.0
golang.org/x/sys v0.30.0
google.golang.org/api v0.221.0
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
gorm.io/gorm v1.25.12
helm.sh/helm v2.17.0+incompatible
k8s.io/apimachinery v0.32.2
k8s.io/client-go v0.32.2
sigs.k8s.io/controller-runtime v0.20.1
sigs.k8s.io/controller-runtime v0.20.2
)

require (
Expand All @@ -39,7 +38,7 @@ require (
github.com/cyphar/filepath-securejoin v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
Expand Down Expand Up @@ -75,7 +74,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
Expand All @@ -92,6 +90,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/oauth2 v0.26.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/term v0.29.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/time v0.10.0 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU=
github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
Expand Down Expand Up @@ -124,10 +124,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg=
github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw=
github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
github.com/openfga/go-sdk v0.6.5 h1:2bxZkoLyphOahFETo9wPvls1AQ3IqbsygIyDkzRvx1k=
github.com/openfga/go-sdk v0.6.5/go.mod h1:zui7pHE3eLAYh2fFmEMrWg9XbxYns2WW5Xr/GEgili4=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down Expand Up @@ -265,8 +265,8 @@ helm.sh/helm v2.17.0+incompatible h1:cSe3FaQOpRWLDXvTObQNj0P7WI98IG5yloU6tQVls2k
helm.sh/helm v2.17.0+incompatible/go.mod h1:0Xbc6ErzwWH9qC55X1+hE3ZwhM3atbhCm/NbFZw5i+4=
k8s.io/api v0.32.2 h1:bZrMLEkgizC24G9eViHGOPbW+aRo9duEISRIJKfdJuw=
k8s.io/api v0.32.2/go.mod h1:hKlhk4x1sJyYnHENsrdCWw31FEmCijNGPJO5WzHiJ6Y=
k8s.io/apiextensions-apiserver v0.32.0 h1:S0Xlqt51qzzqjKPxfgX1xh4HBZE+p8KKBq+k2SWNOE0=
k8s.io/apiextensions-apiserver v0.32.0/go.mod h1:86hblMvN5yxMvZrZFX2OhIHAuFIMJIZ19bTvzkP+Fmw=
k8s.io/apiextensions-apiserver v0.32.1 h1:hjkALhRUeCariC8DiVmb5jj0VjIc1N0DREP32+6UXZw=
k8s.io/apiextensions-apiserver v0.32.1/go.mod h1:sxWIGuGiYov7Io1fAS2X06NjMIk5CbRHc2StSmbaQto=
k8s.io/apimachinery v0.32.2 h1:yoQBR9ZGkA6Rgmhbp/yuT9/g+4lxtsGYwW6dR6BDPLQ=
k8s.io/apimachinery v0.32.2/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
k8s.io/client-go v0.32.2 h1:4dYCD4Nz+9RApM2b/3BtVvBHw54QjMFUl1OLcJG5yOA=
Expand All @@ -279,8 +279,8 @@ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJ
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE=
sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/controller-runtime v0.20.2 h1:/439OZVxoEc02psi1h4QO3bHzTgu49bb347Xp4gW1pc=
sigs.k8s.io/controller-runtime v0.20.2/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA=
Expand Down

0 comments on commit fa9615d

Please sign in to comment.