-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
4,024 additions
and
1,227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.21 as builder | ||
FROM golang:1.22 as builder | ||
WORKDIR /action | ||
COPY . /action | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"os" | ||
|
||
"github.com/replicatedhq/kots/pkg/upgradeservice" | ||
"github.com/replicatedhq/kots/pkg/upgradeservice/types" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
"gopkg.in/yaml.v3" | ||
) | ||
|
||
func UpgradeServiceCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "upgrade-service", | ||
Short: "KOTS Upgrade Service", | ||
Hidden: true, | ||
} | ||
|
||
cmd.AddCommand(UpgradeServiceStartCmd()) | ||
|
||
return cmd | ||
} | ||
|
||
func UpgradeServiceStartCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "start [params-file]", | ||
Short: "Starts a KOTS upgrade service using the provided params file", | ||
Long: ``, | ||
SilenceUsage: true, | ||
SilenceErrors: false, | ||
PreRun: func(cmd *cobra.Command, args []string) { | ||
viper.BindPFlags(cmd.Flags()) | ||
os.Setenv("IS_UPGRADE_SERVICE", "true") | ||
}, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
if len(args) != 1 { | ||
cmd.Help() | ||
os.Exit(1) | ||
} | ||
|
||
paramsYAML, err := readUpgradeServiceParams(args[0]) | ||
if err != nil { | ||
return fmt.Errorf("failed to read config file: %v", err) | ||
} | ||
|
||
var params types.UpgradeServiceParams | ||
if err := yaml.Unmarshal(paramsYAML, ¶ms); err != nil { | ||
return fmt.Errorf("failed to unmarshal config file: %v", err) | ||
} | ||
|
||
if err := upgradeservice.Serve(params); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
func readUpgradeServiceParams(path string) ([]byte, error) { | ||
if path == "-" { | ||
b, err := io.ReadAll(os.Stdin) | ||
if err != nil { | ||
return nil, fmt.Errorf("read stdin: %w", err) | ||
} | ||
return b, nil | ||
} | ||
b, err := os.ReadFile(path) | ||
if err != nil { | ||
return nil, fmt.Errorf("read file: %w", err) | ||
} | ||
return b, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ RUN go install github.com/go-delve/delve/cmd/[email protected] | |
|
||
ENV PROJECTPATH=/go/src/github.com/replicatedhq/kots | ||
WORKDIR $PROJECTPATH | ||
RUN mkdir -p web/dist && touch web/dist/README.md | ||
COPY Makefile ./ | ||
COPY Makefile.build.mk ./ | ||
COPY go.mod go.sum ./ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.