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

Changes made for provisoners flag #221

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
module github.com/score-spec/score-compose

go 1.23

toolchain go1.23.0
go 1.23.5

require (
github.com/Masterminds/sprig/v3 v3.3.0
github.com/compose-spec/compose-go/v2 v2.4.5
github.com/imdario/mergo v1.0.1
github.com/mitchellh/mapstructure v1.5.0
github.com/score-spec/score-go v1.8.4
github.com/score-spec/score-go v1.9.1
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.10.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6Ng
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
github.com/score-spec/score-go v1.8.4 h1:/zXrWiU/K8wRu2AcU08Lr2yXtxtfdKEs/vou0ShXKmg=
github.com/score-spec/score-go v1.8.4/go.mod h1:v8UV2rUfz5obXNMtndKvjskOMP4xmwhG1RSBrBK2B1M=
github.com/score-spec/score-go v1.9.1 h1:8C397Lkn8TMTKC3MldIF8zW4RAnw3dQ1S7+oZ///K9s=
github.com/score-spec/score-go v1.9.1/go.mod h1:SetCPqAPdIdvgEO2ITHMhahaTsMf7ybYvelrNuNct4Y=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down
2 changes: 1 addition & 1 deletion internal/command/default.provisioners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -798,4 +798,4 @@
download certificate from container per command like: \n
\tdocker cp [CONTAINER-NAME]:/usr/share/elasticsearch/config/certs/ca/ca.crt /tmp/ \n
and than check connection per culr like: \n
\tcurl --cacert /tmp/ca.crt -u {{ .State.username }}:{{ .State.password }} https://localhost:{{ .Init.publishPort }}"
\tcurl --cacert /tmp/ca.crt -u {{ .State.username }}:{{ .State.password }} https://localhost:{{ .Init.publishPort }}"
23 changes: 21 additions & 2 deletions internal/command/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,28 @@ the new provisioners will take precedence.

if v, _ := cmd.Flags().GetStringArray(initCmdProvisionerFlag); len(v) > 0 {
for i, vi := range v {
var data []byte

if vi == "-" {
data, err = uriget.GetFile(cmd.Context(), "-")
} else {
// Existing URI loading logic
data, err = uriget.GetFile(cmd.Context(), vi)
}

data, err := uriget.GetFile(cmd.Context(), vi)
if err != nil {
return fmt.Errorf("failed to load provisioner %d: %w", i+1, err)
}
if err := loader.SaveProvisionerToDirectory(sd.Path, vi, data); err != nil {

var saveFilename string
if vi == "-" {
saveFilename = "from-stdin.provisioners.yaml"
} else {
saveFilename = vi
}

if err := loader.SaveProvisionerToDirectory(sd.Path, saveFilename, data); err != nil {
return fmt.Errorf("failed to save provisioner %d: %w", i+1, err)
}
}
Expand All @@ -230,7 +247,9 @@ func init() {
"- HTTPS : https://host/file\n"+
"- Git (SSH) : git-ssh://git@host/repo.git/file\n"+
"- Git (HTTPS) : git-https://host/repo.git/file\n"+
"- OCI : oci://[registry/][namespace/]repository[:tag|@digest][#file]")
"- OCI : oci://[registry/][namespace/]repository[:tag|@digest][#file]\n"+
"- Local File : /path/to/local/file\n"+
"- Stdin : - (read from standard input)")

rootCmd.AddCommand(initCmd)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/command/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Flags:
- Git (SSH) : git-ssh://git@host/repo.git/file
- Git (HTTPS) : git-https://host/repo.git/file
- OCI : oci://[registry/][namespace/]repository[:tag|@digest][#file]
- Local File : /path/to/local/file
- Stdin : - (read from standard input)

Global Flags:
--quiet Mute any logging output
Expand Down