Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee02016f16 | ||
|
|
e5024b7f0a | ||
|
|
d408d33971 | ||
|
|
cff29ed862 | ||
|
|
e5108e0040 | ||
|
|
0372b82b49 | ||
|
|
48ca84f5f8 | ||
|
|
97a137ff23 | ||
|
|
776c91d300 | ||
|
|
c37f5338dc | ||
|
|
0cf8a9b4c9 | ||
|
|
75fcb93c33 | ||
|
|
465095e4ee | ||
|
|
3ffd167ae7 | ||
|
|
51bc8fda68 | ||
|
|
0623ebd603 |
@@ -17,12 +17,23 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- run: make xbuild-all
|
||||
- run:
|
||||
name: "Build latest master from porter repo"
|
||||
command: |
|
||||
export GO111MODULE=off
|
||||
go get -u get.porter.sh/porter || true
|
||||
cd /go/src/get.porter.sh/porter
|
||||
# store porter master commit
|
||||
git rev-parse HEAD > /go/porter-master-commit.txt
|
||||
make xbuild-all VERSION=latest
|
||||
cp -r bin/latest/* /go/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/bin/${CIRCLE_TAG}/
|
||||
- run:
|
||||
name: "Publish Release on GitHub"
|
||||
command: |
|
||||
go get github.com/tcnksm/ghr
|
||||
# VERSION=v$(./artifacts/qliksense-linux-amd64 version | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
|
||||
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} /go/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/bin/${CIRCLE_TAG}/
|
||||
PORTER_REPO_COMMIT=$(cat /go/porter-master-commit.txt)
|
||||
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -b "porter build based on commit: https://github.com/deislabs/porter/commit/${PORTER_REPO_COMMIT}" -delete ${CIRCLE_TAG} /go/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/bin/${CIRCLE_TAG}/
|
||||
workflows:
|
||||
version: 2
|
||||
commit:
|
||||
|
||||
628
.qliksense/porter-runtime
Normal file
628
.qliksense/porter-runtime
Normal file
File diff suppressed because one or more lines are too long
628
.qliksense/porter.exe
Normal file
628
.qliksense/porter.exe
Normal file
File diff suppressed because one or more lines are too long
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
||||
PKG = qlik-oss/sense-installer
|
||||
PKG = github.com/qlik-oss/sense-installer
|
||||
|
||||
# --no-print-directory avoids verbose logging when invoking targets that utilize sub-makes
|
||||
MAKE_OPTS ?= --no-print-directory
|
||||
|
||||
23
README.md
23
README.md
@@ -1 +1,22 @@
|
||||
# sense-installer
|
||||
# Qlik Sense installation and operations CLI
|
||||
|
||||
The Qlik Sense installations and operations CLI provides capabilities for installing the Qlik Sense on Kubernetes packaging and performing operations on qliksense.
|
||||
|
||||
## Getting started
|
||||
|
||||
Download the appropriate executable for your platform from the [releases page](https://github.com/qlik-oss/sense-installer/releases). When used, the CLI will check to see if porter is installed, if not, will download and install it. Once done, you can find porter through `echo $HOME/.porter` on Linux and MacOS and in `$Env:USERPROFILE\.porter` on Windows. You can also install it in advance, release > 0.22.1-beta.1 is required.
|
||||
|
||||
To make sure everything is order, you can fetch the Qlik Sense bundle version and corresponding image list from:
|
||||
- `qliksense about --tag qlik/qliksense-cnab-bundle:latest `
|
||||
|
||||
## Running Preflight checks
|
||||
You can run preflight checks to ensure that the cluster is in a healthy state before installing Qliksense.
|
||||
- `qliksense preflight -c <credential_name> `
|
||||
|
||||
The above command runs the checks in the default namespace. If you want to specify the namespace to run preflight checks on:
|
||||
- `qliksense preflight --param namespace=<value> -c <credential_name> `
|
||||
|
||||
## Qliksense Packaging
|
||||
Packaging of Qlik Sense on Kubernetes is done through a [Porter](https://porter.sh/) definition in the [Qlik Sense on Kubernetes configuration repository](https://github.com/qlik-oss/qliksense-k8s/blob/master/porter.yaml), the resulting bundle published on DockerHub as a [Cloud Natvie Application Bundle](https://cnab.io/) called [qliksense-cnab-bundle](https://hub.docker.com/r/qlik/qliksense-cnab-bundle).
|
||||
### Versioning
|
||||
A version of [qliksense-cnab-bundle](https://hub.docker.com/r/qlik/qliksense-cnab-bundle) is published corresponding to an edge release. To get the latest edge release simply specify `qliksense-cnab-bundle:latest`
|
||||
|
||||
@@ -15,6 +15,7 @@ func buildAliasCommands(porterCmd *cobra.Command, q *qliksense.Qliksense) []*cob
|
||||
buildBuildAlias(porterCmd),
|
||||
buildInstallAlias(porterCmd, q),
|
||||
buildAboutAlias(porterCmd),
|
||||
buildPreflightAlias(porterCmd, q),
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,18 +40,17 @@ func buildBuildAlias(porterCmd *cobra.Command) *cobra.Command {
|
||||
}
|
||||
|
||||
type paramOptions struct {
|
||||
aboutOptions
|
||||
Params []string
|
||||
ParamFiles []string
|
||||
File string
|
||||
Name string
|
||||
InsecureRegistry bool
|
||||
CNABFile string
|
||||
|
||||
// CredentialIdentifiers is a list of credential names or paths to make available to the bundle.
|
||||
CredentialIdentifiers []string
|
||||
Driver string
|
||||
Force bool
|
||||
Insecure bool
|
||||
Tag string
|
||||
}
|
||||
|
||||
func buildInstallAlias(porterCmd *cobra.Command, q *qliksense.Qliksense) *cobra.Command {
|
||||
@@ -72,6 +72,7 @@ The first argument is the bundle instance name to create for the installation. T
|
||||
Porter uses the Docker driver as the default runtime for executing a bundle's invocation image, but an alternate driver may be supplied via '--driver/-d'.
|
||||
For example, the 'debug' driver may be specified, which simply logs the info given to it and then exits.`,
|
||||
Example: ` qliksense install
|
||||
qliksense install --version v1.0.0
|
||||
qliksense install --insecure
|
||||
qliksense install qliksense --file qliksense/bundle.json
|
||||
qliksense install --param-file base-values.txt --param-file dev-values.txt --param test-mode=true --param header-color=blue
|
||||
@@ -83,6 +84,7 @@ For example, the 'debug' driver may be specified, which simply logs the info giv
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
// Push images here.
|
||||
// TODO: Need to get the private reg from params
|
||||
args = append(os.Args[1:], opts.getTagDefaults(args)...)
|
||||
if registry = opts.findKey("dockerRegistry"); registry != nil {
|
||||
if len(*registry) > 0 {
|
||||
q.TagAndPushImages(*registry)
|
||||
@@ -95,6 +97,8 @@ For example, the 'debug' driver may be specified, which simply logs the info giv
|
||||
},
|
||||
}
|
||||
f := c.Flags()
|
||||
f.StringVarP(&opts.Version, "version", "v", "latest",
|
||||
"Version of Qlik Sense to install")
|
||||
f.BoolVar(&opts.Insecure, "insecure", true,
|
||||
"Allow working with untrusted bundles")
|
||||
f.StringVarP(&opts.File, "file", "f", "",
|
||||
@@ -117,23 +121,85 @@ For example, the 'debug' driver may be specified, which simply logs the info giv
|
||||
"Force a fresh pull of the bundle and all dependencies")
|
||||
return c
|
||||
}
|
||||
func (o *aboutOptions) getTagDefaults(args []string) []string {
|
||||
var err error
|
||||
if len(o.Tag) > 1 {
|
||||
args = append(args, []string{"--tag", o.Tag}...)
|
||||
}
|
||||
if len(o.Tag) <= 0 && len(o.File) <= 0 && len(o.CNABFile) <= 0 {
|
||||
if _, err = os.Stat("porter.yaml"); err != nil {
|
||||
args = append(args, []string{"--tag", "qlik/qliksense-cnab-bundle:" + o.Version}...)
|
||||
}
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
type aboutOptions struct {
|
||||
Version string
|
||||
Tag string
|
||||
File string
|
||||
CNABFile string
|
||||
}
|
||||
|
||||
func buildAboutAlias(porterCmd *cobra.Command) *cobra.Command {
|
||||
var (
|
||||
c *cobra.Command
|
||||
c *cobra.Command
|
||||
opts *aboutOptions
|
||||
)
|
||||
|
||||
opts = &aboutOptions{}
|
||||
|
||||
c = &cobra.Command{
|
||||
Use: "about",
|
||||
Short: "About Qlik Sense",
|
||||
Long: "Gives the verion of QLik Sense on Kuberntetes and versions of images.",
|
||||
DisableFlagParsing: true,
|
||||
Use: "about",
|
||||
Short: "About Qlik Sense",
|
||||
Long: "Gives the verion of QLik Sense on Kuberntetes and versions of images.",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
args = opts.getTagDefaults(args)
|
||||
return porterCmd.RunE(porterCmd, append([]string{"invoke", "--action", "about"}, args...))
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"group": "alias",
|
||||
},
|
||||
}
|
||||
f := c.Flags()
|
||||
f.StringVarP(&opts.Version, "version", "v", "latest",
|
||||
"Version of Qlik Sense to install")
|
||||
f.StringVarP(&opts.Tag, "tag", "t", "",
|
||||
"Use a bundle in an OCI registry specified by the given tag")
|
||||
f.StringVarP(&opts.File, "file", "f", "",
|
||||
"Path to the porter manifest file. Defaults to the bundle in the current directory.")
|
||||
f.StringVar(&opts.CNABFile, "cnab-file", "",
|
||||
"Path to the CNAB bundle.json file.")
|
||||
return c
|
||||
}
|
||||
|
||||
func buildPreflightAlias(porterCmd *cobra.Command, q *qliksense.Qliksense) *cobra.Command {
|
||||
var (
|
||||
c *cobra.Command
|
||||
opts *paramOptions
|
||||
)
|
||||
|
||||
opts = ¶mOptions{}
|
||||
|
||||
c = &cobra.Command{
|
||||
Use: "preflight",
|
||||
Short: "Preflight Checks",
|
||||
Long: "Perform Preflight Checks",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
args = append(os.Args[1:], opts.getTagDefaults(args)...)
|
||||
return porterCmd.RunE(porterCmd, append([]string{"invoke", "--action", "preflight"}, args...))
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"group": "alias",
|
||||
},
|
||||
}
|
||||
f := c.Flags()
|
||||
f.StringSliceVar(&opts.Params, "param", nil,
|
||||
"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.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
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package main
|
||||
|
||||
|
||||
func main() {
|
||||
initAndExecute()
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,20 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/qlik-oss/sense-installer/pkg"
|
||||
"github.com/qlik-oss/sense-installer/pkg/qliksense"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const (
|
||||
porterURLBase = "https://deislabs.blob.core.windows.net/porter"
|
||||
porterHomeVar = "PORTER_HOME"
|
||||
porterDirVar = ".porter"
|
||||
mixinDirVar = "mixins"
|
||||
porterPermaLink = "latest"
|
||||
porterRuntime = "porter-runtime"
|
||||
// porterURLBase = "https://deislabs.blob.core.windows.net/porter"
|
||||
porterURLBase = "https://github.com/qlik-oss/sense-installer/releases/download"
|
||||
porterHomeVar = "PORTER_HOME"
|
||||
qlikSenseHomeVar = "QLIKSENSE_HOME"
|
||||
qlikSenseDirVar = ".qliksense"
|
||||
mixinDirVar = "mixins"
|
||||
porterRuntime = "porter-runtime"
|
||||
)
|
||||
|
||||
func initAndExecute() error {
|
||||
@@ -42,10 +44,12 @@ func initAndExecute() error {
|
||||
|
||||
func installPorter() (string, error) {
|
||||
var (
|
||||
homeDir, mixin, mixinOpts, porterHome, porterExe string
|
||||
mixinsVar = map[string]string{
|
||||
porterPermaLink = pkg.Version
|
||||
//porterPermaLink = "v0.3.0"
|
||||
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.9.0 --url https://github.com/qlik-oss/porter-qliksense/releases/download",
|
||||
"qliksense": "-v v0.11.0 --url https://github.com/qlik-oss/porter-qliksense/releases/download",
|
||||
"exec": "-v latest",
|
||||
"kubernetes": "-v latest",
|
||||
"helm": "-v latest",
|
||||
@@ -64,17 +68,19 @@ func installPorter() (string, error) {
|
||||
if runtime.GOOS == "windows" {
|
||||
porterExe = porterExe + ".exe"
|
||||
}
|
||||
if porterHome = os.Getenv(porterHomeVar); porterHome == "" {
|
||||
if qlikSenseHome = os.Getenv(qlikSenseHomeVar); qlikSenseHome == "" {
|
||||
if homeDir, err = homedir.Dir(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if homeDir, err = homedir.Expand(homeDir); err != nil {
|
||||
return "", err
|
||||
}
|
||||
porterHome = filepath.Join(homeDir, porterDirVar)
|
||||
qlikSenseHome = filepath.Join(homeDir, qlikSenseDirVar)
|
||||
}
|
||||
porterExe = filepath.Join(porterHome, porterExe)
|
||||
if _, err = os.Stat(porterHome); err != nil {
|
||||
os.Setenv(porterHomeVar, qlikSenseHome)
|
||||
//TODO: Check if porter version is one alreadu is one for this build
|
||||
porterExe = filepath.Join(qlikSenseHome, porterExe)
|
||||
if _, err = os.Stat(qlikSenseHome); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
downloadPorter = true
|
||||
} else {
|
||||
@@ -90,22 +96,29 @@ func installPorter() (string, error) {
|
||||
}
|
||||
}
|
||||
if downloadPorter {
|
||||
os.Mkdir(porterHome, os.ModePerm)
|
||||
if err = downloadFile(porterURLBase+"/"+porterPermaLink+"/porter-linux-amd64", filepath.Join(porterHome, porterRuntime)); err != nil {
|
||||
os.Mkdir(qlikSenseHome, os.ModePerm)
|
||||
destination = filepath.Join(qlikSenseHome, porterRuntime)
|
||||
if err = downloadFile(porterURLBase+"/"+porterPermaLink+"/porter-linux-amd64", destination); err != nil {
|
||||
return "", err
|
||||
}
|
||||
os.Chmod(destination, 0755)
|
||||
if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
|
||||
if _, err = copy(filepath.Join(porterHome, porterRuntime), porterExe); err != nil {
|
||||
if _, err = copy(filepath.Join(qlikSenseHome, porterRuntime), porterExe); err != nil {
|
||||
return "", err
|
||||
}
|
||||
os.Chmod(porterExe, 0755)
|
||||
} else {
|
||||
if err = downloadFile(porterURLBase+"/"+porterPermaLink+"/"+"porter-"+runtime.GOOS+"-"+runtime.GOARCH, porterExe); err != nil {
|
||||
if runtime.GOOS == "windows" {
|
||||
ext = ".exe"
|
||||
}
|
||||
if err = downloadFile(porterURLBase+"/"+porterPermaLink+"/"+"porter-"+runtime.GOOS+"-"+runtime.GOARCH+ext, porterExe); err != nil {
|
||||
return "", err
|
||||
}
|
||||
os.Chmod(porterExe, 0755)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err = os.Stat(filepath.Join(porterHome, mixinDirVar)); err != nil {
|
||||
if _, err = os.Stat(filepath.Join(qlikSenseHome, mixinDirVar)); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
downloadMixins = mixinsVar
|
||||
} else {
|
||||
@@ -114,7 +127,7 @@ func installPorter() (string, error) {
|
||||
} else {
|
||||
downloadMixins = make(map[string]string)
|
||||
for mixin, mixinOpts = range mixinsVar {
|
||||
if _, err = os.Stat(filepath.Join(porterHome, mixinDirVar, mixin)); err != nil {
|
||||
if _, err = os.Stat(filepath.Join(qlikSenseHome, mixinDirVar, mixin)); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
downloadMixins[mixin] = mixinOpts
|
||||
} else {
|
||||
@@ -124,7 +137,7 @@ func installPorter() (string, error) {
|
||||
}
|
||||
}
|
||||
for mixin, mixinOpts = range downloadMixins {
|
||||
cmd = exec.Command(porterExe, "mixin", "install", mixin, mixinOpts)
|
||||
cmd = exec.Command(porterExe, append([]string{"mixin", "install", mixin}, strings.Split(mixinOpts, " ")...)...)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
if err = cmd.Run(); err != nil {
|
||||
@@ -158,7 +171,7 @@ func rootCmd(p *qliksense.Qliksense) *cobra.Command {
|
||||
cmd.AddCommand(pullQliksenseImages(p))
|
||||
porterCmd = porter(p)
|
||||
cmd.AddCommand(porterCmd)
|
||||
for _, alias = range buildAliasCommands(porterCmd,p) {
|
||||
for _, alias = range buildAliasCommands(porterCmd, p) {
|
||||
cmd.AddCommand(alias)
|
||||
}
|
||||
|
||||
|
||||
7
pkg/version.go
Normal file
7
pkg/version.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package pkg
|
||||
|
||||
// These are build-time values, set during an official release
|
||||
var (
|
||||
Commit string
|
||||
Version string
|
||||
)
|
||||
Reference in New Issue
Block a user