File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6363 publish-dumper :
6464 name : Publishing dumper docker image
6565 runs-on : ubuntu-latest
66- if : github.ref == 'refs/heads/master'
66+ if : startsWith( github.ref, 'refs/tags')
6767 needs :
6868 - lint
6969 - format
@@ -87,19 +87,17 @@ jobs:
8787 working-directory : ./dumper
8888 run : |
8989 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v .
90- - name : Login to ACR
91- uses : docker/login -action@v1
90+ - name : Docker build and push
91+ uses : docker/build-push -action@v1
9292 with :
93- registry : dodoreg.azurecr.io
93+ registry : ${{ secrets.DOCKER_REGISTRY }}
9494 username : ${{ secrets.DODOREG_AZURECR_USERNAME }}
9595 password : ${{ secrets.DODOREG_AZURECR_PASSWORD }}
96- - name : Docker build and push
97- uses : docker/build-push-action@v2
98- with :
99- file : ./dumper/Dockerfile
100- context : ./dumper
101- push : true
102- tags : dodoreg.azurecr.io/dumper:latest
96+ repository : dumper
97+ dockerfile : ./dumper/Dockerfile
98+ path : ./dumper
99+ tag_with_ref : true
100+ tags : latest
103101
104102 publish-cli :
105103 name : Publishing cli
Original file line number Diff line number Diff line change 1+ ---
2+ project_name : kubectl-shovel
3+
4+ builds :
5+ - binary : kubectl-shovel
6+ id : general
7+ ldflags :
8+ - -s -w -X 'github.com/dodopizza/kubectl-shovel/pkg/version.Version=v{{ .Version }}'
9+ env :
10+ - CGO_ENABLED=0
11+ goos :
12+ - linux
13+ - windows
14+ - darwin
15+ goarch :
16+ - amd64
17+
18+ archives :
19+ - name_template : ' {{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
20+ replacements :
21+ darwin : Darwin
22+ linux : Linux
23+ windows : Windows
24+ amd64 : x86_64
25+ format_overrides :
26+ - goos : windows
27+ format : zip
28+ files :
29+ - none*
30+
31+ checksum :
32+ name_template : ' {{ .ProjectName }}_checksums.txt'
33+
34+ snapshot :
35+ name_template : " {{ .Tag }}-next"
36+
37+ changelog :
38+ sort : asc
39+ filters :
40+ exclude :
41+ - typo
42+ - static check
43+ - lint
44+ - format
45+
46+ release :
47+ name_template : " {{ .ProjectName }}-v{{ .Version }}"
Original file line number Diff line number Diff line change 11package cmd
22
33import (
4+ "strings"
5+
6+ "github.com/dodopizza/kubectl-shovel/pkg/version"
47 "github.com/spf13/cobra"
58 "github.com/spf13/pflag"
69 "k8s.io/cli-runtime/pkg/genericclioptions"
710)
811
912type gcDumpOptions struct {
13+ image string
1014 podName string
1115 output string
1216
@@ -47,6 +51,19 @@ func (options *gcDumpOptions) checkFlags() *pflag.FlagSet {
4751 "Dump output file" ,
4852 )
4953
54+ flags .StringVar (
55+ & options .image ,
56+ "image" ,
57+ strings .Join (
58+ []string {
59+ dumperImageName ,
60+ version .GetVersion (),
61+ },
62+ ":" ,
63+ ),
64+ "Image of dumper to use for job" ,
65+ )
66+
5067 options .kubeFlags = genericclioptions .NewConfigFlags (false )
5168 options .kubeFlags .AddFlags (flags )
5269
@@ -56,6 +73,7 @@ func (options *gcDumpOptions) checkFlags() *pflag.FlagSet {
5673func (options * gcDumpOptions ) makeGCDump () error {
5774 return run (
5875 options .kubeFlags ,
76+ options .image ,
5977 options .podName ,
6078 options .output ,
6179 "dotnet-gcdump" ,
Original file line number Diff line number Diff line change 77 "io"
88 "io/ioutil"
99
10- "github.com/dodopizza/kubectl-shovel/events"
10+ "github.com/dodopizza/kubectl-shovel/pkg/ events"
1111)
1212
1313func handleLogs (readCloser io.ReadCloser , output string ) {
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ func NewShovelCommand() *cobra.Command {
1717 }
1818
1919 cmd .AddCommand (newDocCmd ())
20+ cmd .AddCommand (newVersionCmd ())
2021
2122 cmd .AddCommand (newGCDumpCommand ())
2223 cmd .AddCommand (newTraceCommand ())
Original file line number Diff line number Diff line change @@ -4,12 +4,13 @@ import (
44 "fmt"
55 "strings"
66
7- "github.com/dodopizza/kubectl-shovel/cli /kubernetes"
7+ "github.com/dodopizza/kubectl-shovel/pkg /kubernetes"
88 "k8s.io/cli-runtime/pkg/genericclioptions"
99)
1010
1111func run (
1212 kubeFlags * genericclioptions.ConfigFlags ,
13+ image ,
1314 podName ,
1415 output ,
1516 tool string ,
@@ -28,7 +29,7 @@ func run(
2829 fmt .Println ("Run diagnostics job" )
2930 err = k8s .RunJob (
3031 jobName ,
31- dumperImageName ,
32+ image ,
3233 pod .Spec .NodeName ,
3334 []string {
3435 "--container-id" ,
Original file line number Diff line number Diff line change 11package cmd
22
33import (
4+ "strings"
5+
6+ "github.com/dodopizza/kubectl-shovel/pkg/version"
47 "github.com/spf13/cobra"
58 "github.com/spf13/pflag"
69 "k8s.io/cli-runtime/pkg/genericclioptions"
710)
811
912type traceOptions struct {
13+ image string
1014 podName string
1115 output string
1216
@@ -47,6 +51,19 @@ func (options *traceOptions) checkFlags() *pflag.FlagSet {
4751 "Dump output file" ,
4852 )
4953
54+ flags .StringVar (
55+ & options .image ,
56+ "image" ,
57+ strings .Join (
58+ []string {
59+ dumperImageName ,
60+ version .GetVersion (),
61+ },
62+ ":" ,
63+ ),
64+ "Image of dumper to use for job" ,
65+ )
66+
5067 options .kubeFlags = genericclioptions .NewConfigFlags (false )
5168 options .kubeFlags .AddFlags (flags )
5269
@@ -56,6 +73,7 @@ func (options *traceOptions) checkFlags() *pflag.FlagSet {
5673func (options * traceOptions ) maketrace () error {
5774 return run (
5875 options .kubeFlags ,
76+ options .image ,
5977 options .podName ,
6078 options .output ,
6179 "dotnet-trace" ,
Original file line number Diff line number Diff line change 1+ package cmd
2+
3+ import (
4+ "fmt"
5+
6+ "github.com/dodopizza/kubectl-shovel/pkg/version"
7+ "github.com/spf13/cobra"
8+ )
9+
10+ func newVersionCmd () * cobra.Command {
11+ cmd := & cobra.Command {
12+ Use : "version" ,
13+ Args : cobra .NoArgs ,
14+ Short : "Print your cli version" ,
15+ Run : func (cmd * cobra.Command , args []string ) {
16+ fmt .Println (version .GetVersion ())
17+ },
18+ }
19+
20+ return cmd
21+ }
Original file line number Diff line number Diff line change 55 "fmt"
66 "io/ioutil"
77
8- "github.com/dodopizza/kubectl-shovel/events"
8+ "github.com/dodopizza/kubectl-shovel/pkg/ events"
99)
1010
1111const ()
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package main
33import (
44 "flag"
55
6- "github.com/dodopizza/kubectl-shovel/events"
6+ "github.com/dodopizza/kubectl-shovel/pkg/ events"
77)
88
99func main () {
You can’t perform that action at this time.
0 commit comments