This commit is contained in:
2024-02-20 19:37:18 +03:00
parent 7533ed95ad
commit cda07939db
3 changed files with 95 additions and 36 deletions

View File

@@ -3,10 +3,11 @@ package run
import (
"errors"
"fmt"
"github.com/pelotech/drone-helm3/internal/env"
"io"
"os"
"text/template"
"github.com/pelotech/drone-helm3/internal/env"
)
// InitKube is a step in a helm Plan that initializes the kubernetes config file.
@@ -87,7 +88,7 @@ func (i *InitKube) Prepare() error {
fmt.Fprintf(i.stderr, "kubeconfig file at %s\n", i.configFilename)
}
i.configFile, err = os.Create(i.configFilename)
i.configFile, err = os.OpenFile(i.configFilename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return fmt.Errorf("could not open kubeconfig file for writing: %w", err)
}