Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54d0972e85 | ||
|
|
2839e5b77b | ||
|
|
3608f9693c | ||
|
|
60a328d69f |
@@ -198,6 +198,10 @@ func buildPreflightAlias(porterCmd *cobra.Command, q *qliksense.Qliksense) *cobr
|
||||
"Define an individual parameter in the form NAME=VALUE. Overrides parameters set with the same name using --param-file. May be specified multiple times.")
|
||||
f.StringSliceVar(&opts.ParamFiles, "param-file", nil,
|
||||
"Path to a parameters definition file for the bundle, each line in the form of NAME=VALUE. May be specified multiple times.")
|
||||
f.StringVarP(&opts.Tag, "tag", "t", "",
|
||||
"Use a bundle in an OCI registry specified by the given tag")
|
||||
f.StringVarP(&opts.Version, "version", "v", "latest",
|
||||
"Version of Qlik Sense to install")
|
||||
f.StringSliceVarP(&opts.CredentialIdentifiers, "cred", "c", nil,
|
||||
"Credential to use when installing the bundle. May be either a named set of credentials or a filepath, and specified multiple times.")
|
||||
return c
|
||||
|
||||
@@ -49,7 +49,7 @@ func installPorter() (string, error) {
|
||||
destination, homeDir, mixin, mixinOpts, qlikSenseHome, porterExe, ext string
|
||||
mixinsVar = map[string]string{
|
||||
"kustomize": "-v 0.2-beta-3-0e19ca4 --url https://github.com/donmstewart/porter-kustomize/releases/download",
|
||||
"qliksense": "-v v0.11.0 --url https://github.com/qlik-oss/porter-qliksense/releases/download",
|
||||
"qliksense": "-v v0.14.0 --url https://github.com/qlik-oss/porter-qliksense/releases/download",
|
||||
"exec": "-v latest",
|
||||
"kubernetes": "-v latest",
|
||||
"helm": "-v latest",
|
||||
|
||||
@@ -8,10 +8,12 @@ import (
|
||||
|
||||
"github.com/docker/cli/cli/command"
|
||||
cliflags "github.com/docker/cli/cli/flags"
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/registry"
|
||||
|
||||
"strings"
|
||||
|
||||
@@ -53,7 +55,6 @@ func (p *Qliksense) PullImages() error {
|
||||
if err = yaml.Unmarshal([]byte(yamlVersion), &images); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, image = range images.Images {
|
||||
if err = p.PullImage(image); err != nil {
|
||||
fmt.Print(err)
|
||||
@@ -72,12 +73,12 @@ func (p *Qliksense) PullImage(imageName string) error {
|
||||
response io.ReadCloser
|
||||
pullOptions types.ImagePullOptions
|
||||
ctx context.Context
|
||||
// ref reference.Named
|
||||
// repoInfo *registry.RepositoryInfo
|
||||
// authConfig types.AuthConfig
|
||||
// encodedAuth string
|
||||
termFd uintptr
|
||||
err error
|
||||
ref reference.Named
|
||||
repoInfo *registry.RepositoryInfo
|
||||
authConfig types.AuthConfig
|
||||
encodedAuth string
|
||||
termFd uintptr
|
||||
err error
|
||||
)
|
||||
// TODO: Create a real cli config context
|
||||
ctx = context.Background()
|
||||
@@ -85,24 +86,26 @@ func (p *Qliksense) PullImage(imageName string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// if ref, err = reference.ParseNormalizedNamed(imageName); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// if repoInfo, err = registry.ParseRepositoryInfo(ref); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// authConfig = command.ResolveAuthConfig(ctx, cli, repoInfo.Index)
|
||||
// if encodedAuth, err = command.EncodeAuthToBase64(authConfig); err != nil {
|
||||
// return err
|
||||
// }
|
||||
pullOptions = types.ImagePullOptions{
|
||||
// RegistryAuth: encodedAuth,
|
||||
}
|
||||
|
||||
if err = cli.Initialize(cliflags.NewClientOptions()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if ref, err = reference.ParseNormalizedNamed(imageName); err != nil {
|
||||
return err
|
||||
}
|
||||
if repoInfo, err = registry.ParseRepositoryInfo(ref); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
authConfig = command.ResolveAuthConfig(ctx, cli, repoInfo.Index)
|
||||
if encodedAuth, err = command.EncodeAuthToBase64(authConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pullOptions = types.ImagePullOptions{
|
||||
RegistryAuth: encodedAuth,
|
||||
}
|
||||
|
||||
if response, err = cli.Client().ImagePull(ctx, imageName, pullOptions); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -164,7 +167,7 @@ func (p *Qliksense) TagAndPushImages(registry string) error {
|
||||
}
|
||||
|
||||
// PullImage ...
|
||||
func (p *Qliksense) TagAndPush(image string, registry string) error {
|
||||
func (p *Qliksense) TagAndPush(image string, registryName string) error {
|
||||
var (
|
||||
cli *command.DockerCli
|
||||
dockerOutput io.Writer
|
||||
@@ -176,11 +179,12 @@ func (p *Qliksense) TagAndPush(image string, registry string) error {
|
||||
imageList []types.ImageSummary
|
||||
imageListOptions types.ImageListOptions
|
||||
filterArgs filters.Args
|
||||
// repoInfo *registry.RepositoryInfo
|
||||
// authConfig types.AuthConfig
|
||||
// encodedAuth string
|
||||
termFd uintptr
|
||||
err error
|
||||
ref reference.Named
|
||||
repoInfo *registry.RepositoryInfo
|
||||
authConfig types.AuthConfig
|
||||
encodedAuth string
|
||||
termFd uintptr
|
||||
err error
|
||||
)
|
||||
// TODO: Create a real cli config context
|
||||
ctx = context.Background()
|
||||
@@ -194,7 +198,7 @@ func (p *Qliksense) TagAndPush(image string, registry string) error {
|
||||
if segments[0] == "docker.io" {
|
||||
image = strings.Join(segments[1:], "/")
|
||||
}
|
||||
newName = registry + "/" + segments[len(segments)-1]
|
||||
newName = registryName + "/" + segments[len(segments)-1]
|
||||
|
||||
filterArgs = filters.NewArgs()
|
||||
filterArgs.Add("reference", image)
|
||||
@@ -213,20 +217,19 @@ func (p *Qliksense) TagAndPush(image string, registry string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// if ref, err = reference.ParseNormalizedNamed(imageName); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// if repoInfo, err = registry.ParseRepositoryInfo(ref); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// authConfig = command.ResolveAuthConfig(ctx, cli, repoInfo.Index)
|
||||
// if encodedAuth, err = command.EncodeAuthToBase64(authConfig); err != nil {
|
||||
// return err
|
||||
// }
|
||||
if ref, err = reference.ParseNormalizedNamed(image); err != nil {
|
||||
return err
|
||||
}
|
||||
if repoInfo, err = registry.ParseRepositoryInfo(ref); err != nil {
|
||||
return err
|
||||
}
|
||||
authConfig = command.ResolveAuthConfig(ctx, cli, repoInfo.Index)
|
||||
if encodedAuth, err = command.EncodeAuthToBase64(authConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
pushOptions = types.ImagePushOptions{
|
||||
All: true,
|
||||
RegistryAuth: "temp",
|
||||
// RegistryAuth: encodedAuth,
|
||||
RegistryAuth: encodedAuth,
|
||||
}
|
||||
|
||||
if response, err = cli.Client().ImagePush(ctx, newName, pushOptions); err != nil {
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
package qliksense
|
||||
|
||||
import (
|
||||
"io"
|
||||
"fmt"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
// ProcessLine ...
|
||||
type ProcessLine func(string) *string
|
||||
|
||||
// CallPorter ...
|
||||
func (p *Qliksense) CallPorter(args []string, processor ProcessLine) (string,error) {
|
||||
func (p *Qliksense) CallPorter(args []string, processor ProcessLine) (string, error) {
|
||||
var (
|
||||
outText string
|
||||
cmd *exec.Cmd
|
||||
err error
|
||||
output io.ReadCloser
|
||||
scanner *bufio.Scanner
|
||||
done chan struct{}
|
||||
output io.ReadCloser
|
||||
scanner *bufio.Scanner
|
||||
done chan struct{}
|
||||
)
|
||||
cmd = exec.Command(p.porterExe,args[:]...)
|
||||
if output,err = cmd.StdoutPipe(); err !=nil {
|
||||
return "",err
|
||||
|
||||
cmd = exec.Command(p.porterExe, args[:]...)
|
||||
if output, err = cmd.StdoutPipe(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
|
||||
done = make(chan struct{})
|
||||
scanner = bufio.NewScanner(output)
|
||||
go func() {
|
||||
@@ -35,24 +38,23 @@ func (p *Qliksense) CallPorter(args []string, processor ProcessLine) (string,err
|
||||
if processor != nil {
|
||||
newText = processor(text)
|
||||
if newText != nil {
|
||||
outText = outText + fmt.Sprintln(*newText)
|
||||
outText = outText + fmt.Sprintln(*newText)
|
||||
}
|
||||
} else {
|
||||
outText = outText + fmt.Sprintln(text)
|
||||
outText = outText + fmt.Sprintln(text)
|
||||
}
|
||||
}
|
||||
done <- struct{}{}
|
||||
}()
|
||||
if err = cmd.Start(); err != nil {
|
||||
return "",err
|
||||
return "", err
|
||||
}
|
||||
<-done
|
||||
if err = cmd.Wait(); err != nil {
|
||||
return "",err
|
||||
return "", err
|
||||
}
|
||||
if err = scanner.Err(); err != nil {
|
||||
return "",err
|
||||
return "", err
|
||||
}
|
||||
|
||||
return outText,nil
|
||||
return outText, nil
|
||||
}
|
||||
|
||||
5
renovate.json
Normal file
5
renovate.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user