Giter VIP home page Giter VIP logo

kam's Introduction

GitOps Application Manager

The GitOps Application Manager provides command line interface to bootstrap GitOps and perform other operations. See why and how GitOps for Application Delivery can help your business streamline your application delivery.

Support Matrix

KAM OpenShift OpenShift GitOps OpenShift Pipelines
0.0.47 4.10 - 4.13 1.8 >=1.7.x
0.0.46 4.10 - 4.12 1.7 >=1.7.x
0.0.46 4.8 - 4.11 1.6 >=1.7.x
0.0.42 4.8 - 4.11 1.5 >=1.6.x
0.0.41 4.7 - 4.10 1.4 >=1.6.x
0.0.40 4.7 - 4.9 1.3 1.6.x
0.0.39 4.8 >=1.2.1 1.5.x
0.0.38 4.7 >=1.2.0 1.4.x

CLI Reference

Command Line Reference

Getting Started

GitOps Day 1 and Day 2 operations

Please visit the CLI user documentation to try out the CLI. For more information regarding how kam CLI is used, please refer to this blog.

OpenShift Console

Please visit the OpenShift Console Documentation to visualize Environments on your Console's Developer Perspective.

FAQs

GitOps Frequently Asked Questions

How to Contribute

Building kam requires Go 1.20

To contribute to KAM CLI, follow these steps:

  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>.
  3. Make your changes and commit them: git commit -m '<commit_message>'
  4. Push to the original branch: git push origin <project_name>/<location>
  5. Create the pull request.

Alternatively see the GitHub documentation on creating a pull request.

How to Build

$ make bin

The resulting binary will be found in ./bin/kam

Alternatively this is a Standard Go project layout project, so you can build with:

$ go build ./cmd/kam

Contact

Please open a Github Issue or reach out to the team at [email protected]

License

This project uses the following license: Apache 2.0.

kam's People

Contributors

amitkrout avatar bigkevmcd avatar chetan-rns avatar ciiay avatar dewan-ahmed avatar gaganhegde avatar haf-tech avatar iam-veeramalla avatar ishitasequeira avatar jaideepr97 avatar jannfis avatar jopit avatar karstengresch avatar keithchong avatar krishvoor avatar pixeljonas avatar reginapizza avatar rishabh625 avatar samyak-jn avatar saumeya avatar sbose78 avatar shubhama19 avatar shubhamagarwal19 avatar svghadi avatar varshab1210 avatar wtam2018 avatar yselkowitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kam's Issues

E2e test for bringing the deployment infrastructure up in CI

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Add e2e test script for https://github.com/redhat-developer/kam/tree/master/docs/journey/day1#bringing-the-deployment-infrastructure-up

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Unable to get gitlab repo name from private gitlab repo when running kam bootstrap

We have a private gitlab repo in our company in the form of https://git.company-domain/group/subgroup/subgroup/repo.git

When I ran the kam bootstrap command I get the error around repo name. Based on the line below I belive this is due to the path in GitLab. Is there any plans for this to get fixed?

// TODO: this likely won't work for GitLab projects because it assumes that the

The command I type is as follow:

kam bootstrap --private-repo-driver gitlab \ --sealed-secrets-ns cicd --sealed-secrets-svc sealedsecretcontroller-sealed-secrets \ --service-repo-url https://git.company-domain/group/subgroup/subgroup/taxi.git \ --gitops-repo-url https://git.company-domain/group/subgroup/subgroup/gitops.git \ --image-repo quay-registry-company-domain/admin/taxi \ --dockercfgjson user-auth.json \ --git-host-access-token <token> --save-token-keyring <token>

The response I get is

Checking dependencies

✓ Checking if Sealed Secrets is installed with custom configuration [28ms] ✓ Checking if ArgoCD is installed with the default configuration [122ms] ✓ Checking if OpenShift Pipelines Operator is installed with the default configuration [133ms] ✗ Please enter a valid access token for --save-token-keyring: unable to get the repo name from "https://git.company-domain/group/subgroup/subgroup/taxi.git": failed to get Git repo: /group/subgroup/subgroup/taxi.git

Bootstrap should create secret for git token and configure repositoryCredentials

Describe the bug
In case a private Git repo is with the kam bootstrap command used and the flag --git-host-access-token is set, does the first sync of the ArgoCD Apps not work, as long no credentials and a proper ArgoCD configuration exist.

To Reproduce
Steps to reproduce the behavior:

  1. Bootstrap
kam_darwin_amd64 bootstrap \
  --service-repo-url https://github.com/k8s-universe/tekton-101 \
  --gitops-repo-url https://github.com/k8s-universe/tekton-101-kam-gitops.git \
  --image-repo demo-tekton-kam-gitops/tekton-101 \
  --git-host-access-token 8234d.... \
  --output . \
  --push-to-git=false \
  --sealed-secrets-ns=cicd \
  --sealed-secrets-svc=sealedsecretcontroller-sealed-secrets
  1. Git push
  2. oc apply -k config/argocd
  3. wait and check the result in ArgoCD UI...sync does not work. Error message authentication needed

Expected behavior
The generated ArgoCD resource definition should contains the repositories part with a reference to a secret, which should also be created containing the git PAT

Example

apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
  creationTimestamp: null
  name: argocd
  namespace: argocd
spec:
  resourceExclusions: |
    - apiGroups:
      - tekton.dev
      clusters:
      - '*'
      kinds:
      - TaskRun
      - PipelineRun
  dex:
    image: quay.io/redhat-cop/dex
    openShiftOAuth: true
    version: v2.22.0-openshift
  rbac:
    defaultPolicy: 'role:readonly'
    policy: |
      g, system:cluster-admins, role:admin
    scopes: '[groups]'
  server:
    route:
      enabled: true
  repositoryCredentials: |
    - url: https://github.com/k8s-universe/tekton-101-kam-gitops.git
      passwordSecret:
        name: argocd-demo-kam-tekton101
        key: password
      usernameSecret:
        name: argocd-demo-kam-tekton101
        key: username
    - url: https://github.com/k8s-universe/tekton-101.git
      passwordSecret:
        name: argocd-demo-kam-tekton101
        key: password
      usernameSecret:
        name: argocd-demo-kam-tekton101
        key: username

Screenshots
n/a

Additional context
Possible workaround, til in kam bootstrap ;-) Update docu
Commands to create the Secrets via kubeseal . Important set the correct value for SealedSecret namespace, controller-name and general namespace

$ echo -n "token" | kubectl create secret generic argocd-demo-kam-tekton101 --dry-run=true --from-file=username=/dev/stdin -o json | kubeseal -n argocd --controller-name=sealedsecretcontroller-sealed-secrets --controller-namespace=cicd > argocd-demo-kam-tekton101.json

$ echo -n "8234d...." | kubectl create secret generic argocd-demo-kam-tekton101 --dry-run=true --from-file=password=/dev/stdin -o json | kubeseal -n argocd --controller-name=sealedsecretcontroller-sealed-secrets --controller-namespace=cicd --merge-into argocd-demo-kam-tekton101.json

$ oc apply -f argocd-demo-kam-tekton101.json
sealedsecret.bitnami.com/argocd-demo-kam-tekton101 created

Add documentation for CI secret rotation

Over a quarters that we have added secrets like github token, username, password etc in CI. There might be a chance that these secrets have leaked. To avoid such threat we should keep rotating our secrete in certain duration gap.

I will create the steps and document in ci-reference.md file

master build version is lesser than the latest released version

Describe the bug
See $SUBJECT

To Reproduce
Steps to reproduce the behavior:

$ make bin
go build -i -v -o gitops -ldflags="-s -w -X github.com/rhd-gitops-example/gitops-cli/pkg/cmd/version.Version=v0.0.2-10-g7dd5183" cmd/gitops-cli/gitops.go 

$ ./kam version
kam version v0.0.2-53-g946070d

Download latest release - https://github.com/redhat-developer/kam/releases/tag/v0.0.4
$ ./kam_darwin_amd64 version 
kam version v0.0.4-0-gcf34b16

Expected behavior
master build version should not less than latest release version. For example here the master version would be something like v0.0.4-0-<last_commit_sha>

Screenshots
NA

Additional context
NA

Test step implementation of Bootstrapping the Manifest

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Implement https://github.com/redhat-developer/kam/tree/master/docs/journey/day1#bootstrapping-the-manifest in the test feature file

Describe the solution you'd like
A clear and concise description of what you want to happen.
e2e test in CI should pass

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

kam fails to write resources to output folder 'B' after user is prompted to not overwrite the contents of folder 'A'

Describe the bug
kam prompts the user to provide the output folder of the generated resource files. If that folder already has the generated files from a previous run (includes pipelines.yaml), then the user is prompted to overwrite or change the output path. If the user chooses another folder (an empty folder for example), then the resources are not generated and no error is reported.

To Reproduce
Make sure you already have kam-generated code somewhere in your filesystem. Let's refer to this folder as A.
Steps to reproduce the behavior:

  1. Run kam bootstrap and follow all questions until you are asked to provide the output path
  2. Provide the path for folder A
  3. You will be prompted to overwrite
  4. Select No
  5. You will be prompted to provide another path
  6. Specify a new path to an empty folder, call this, path B
  7. Proceed with the rest of the prompts to end. kam reports everything is ok.
    ==> Check path B and it will still be empty

Expected behavior
Path B should have the generated files

Screenshots
Here is a sample output:


kam bootstrap
  
Checking dependencies

 ✓  Checking if Sealed Secrets is installed with the default configuration [347ms]
 ✓  Checking if ArgoCD Operator is installed with the default configuration [567ms]
 ✓  Checking if OpenShift Pipelines Operator is installed with the default configuration [654ms]
  
Starting interactive prompt

? Provide the URL for your GitOps repository https://github.com/keithchong/gitops9.git
? Select type of image registry External Registry
? Image registry of the form <registry>/<username>/<image name> which is used to push newly built images. quay.io/keithchong/taxi
? Path to config.json which authenticates image pushes to the desired image registry /Users/kchong/Downloads/keithchong-robot-auth.json
? Provide a secret (minimum 16 characters) that we can use to authenticate incoming hooks from your Git hosting service for the Service repository. (if not provided, it will be auto-generated) 
? Provide the URL for your Service repository e.g. https://github.com/organisation/service.git https://github.com/keithchong/taxi.git
? Is this repository a private repository? no
? Provide a secret (minimum 16 characters) that we can use to authenticate incoming hooks from your Git hosting service for the Service repository. (if not provided, it will be auto-generated) 
? Do you want to enable commit-status-tracker? yes
? Please provide a token used to authenticate requests to "https://github.com/keithchong/taxi.git" [? for help] ****************************************
? Add a prefix to the environment names(dev, stage, cicd etc.) to distinguish and identify individual environments? 
? Provide a path to write GitOps resources? /Users/kchong/wrh/git/kam/dist
? Do you want to overwrite your output path?  [Use arrows to move, type to filter]
? Do you want to overwrite your output path? no
  
Completing Bootstrap process

 ✓  Authentication tokens encrypted in secrets
 ✓  Pipelines tracker has been configured
 ✓  OpenShift Pipelines resources created
 ✓  Openshift Route for EventListener created
 ✓  Created dev, stage and CICD environments
 ✓  Bootstrapped OpenShift resources successfully

 Next Steps:
 Please refer to https://github.com/redhat-developer/kam/tree/master/docs to get started.

[Doc]: CLI dcoument should introduce interactive mode.

Is your task related to a problem? Please describe.

Without mentioning in the document, Users won't know about running CLI in interactive mode.

Describe the solution you'd like

Document how to run commands interactively.

Describe alternatives you've considered

N/A

Additional context

N/A

We should add a note about kam only supports OpenShift

Is your task related to a problem? Please describe.

We should add a note about kam only supports OpenShift. Users should be informed that kam currently only works in OCP.

Describe the solution you'd like

We should add a note in the toplevel README.md.

Describe alternatives you've considered

N/A

Additional context

N/A

keyring/env-var looks for exec: "dbus-launch": executable file in $PATH on centos host

Describe the bug
A clear and concise description of what the bug is.

Error: command 'kam bootstrap --service-repo-url $SERVICE_REPO_URL --gitops-repo-url $GITOPS_REPO_URL 
--image-repo $GITOPS_REPO_URL --dockercfgjson $DOCKERCONFIGJSON_PATH --git-host-access-token
 $GITHUB_TOKEN --output bootstrapresources --push-to-git=true', expected to succeed, exited with exit code: 1

Command stdout:   
Checking dependencies
 •  Checking if Sealed Secrets is installed with the default configuration  ...

 ✓  Checking if Sealed Secrets is installed with the default configuration [237ms]
 •  Checking if ArgoCD Operator is installed with the default configuration  ...

 ✓  Checking if ArgoCD Operator is installed with the default configuration [442ms]
 •  Checking if OpenShift Pipelines Operator is installed with the default configuration  ...

 ✓  Checking if OpenShift Pipelines Operator is installed with the default configuration [510ms]
Adding .git to https://github.com/kam-bot/taxi-87
Adding .git to https://github.com/rhd-gitops-example/taxi


Command stderr:  ✗  unable to use access-token from keyring/env-var: exec: "dbus-launch": executable file not
 found in $PATH, please pass a valid token to --git-host-access-token

Details log - https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/redhat-developer_kam/87/pull-ci-redhat-developer-kam-master-v4.5-integration-e2e/1333827600312700928#1:build-log.txt%3A943

To Reproduce
Steps to reproduce the behavior:

Locally its bit difficult to reproduce for now. You can apply /test all to my pr #87 and wait for job ci/prow/v4.5-integration-e2e to fail.

I will create a separate issue to track the work around how to replicate same environment like prow CI uses from our host machine

NOTE: Prow uses this test container - https://github.com/redhat-developer/kam/blob/master/openshift-ci/build-root/Dockerfile

Expected behavior
keyring/env-var should not look for "dbus-launch": executable on centos host

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Fix error message

Describe the bug
There is a spelling error in repository in the error message. See webhook.go:

Unable to create webhook: failed to find Git repostory URL in manifest

To Reproduce
No need to reproduce, check line 86 of webhook.go

I saw this message when trying to create the webhook:

✗ Unable to create webhook: failed to find Git repostory URL in manifest

Expected behavior
Fix the spelling error.

Additional context
Going through GitOps Operation Day 1 https://github.com/redhat-developer/kam/blob/master/docs/journey/day1

Inconsistent case in Yes/No (yes/no) type of options in bootstrap command prompts

Describe the bug
Some bool type flags prompt the user with Yes or No while others use yes or no

To Reproduce
In ui.go

func UseKeyringRingSvc() bool {
var optionImageRegistry string
prompt := &survey.Select{
Message: "Do you wish to securely store the git-host-access-token in the keyring on your local machine?",
Help: "The token will be stored securely in the keyring of your local mahine. It will be reused by kam commands(bootstrap/webhoook), further iteration of these commands will not prompt for the access-token",
Options: []string{"Yes", "No"},

func SetupCommitStatusTracker() bool {
var optionCommitStatusTracker string
prompt := &survey.Select{
Message: "Do you want to enable commit-status-tracker?",
Help: "commit-status-tracker reports the completion status of OpenShift pipeline runs to your git host on success or failure",
Options: []string{"yes", "no"},

Provide a containerize local test environment

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Provide a containerize local test environment. This helps us to replicate prow CI test environment locally.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Include windows and mac host in CI to run kam unit and e2e test

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Unit test throws error on my mac host. We need to integrate mac and windows in our CI to validate kam binary on these supported platform.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Each kam pr should be verified on mac and windows platform too.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Include windows and mac in CI.
Additional context
Add any other context or screenshots about the feature request here.

Support exporting resources from kam

Is your feature request related to a problem? Please describe.
kubectl and oc have deprecated and removed the --export option. In OpenShift it's common to use tools like oc new-app or odo to bootstrap an application. However when you want to GitOps the application you need to export those resources and remove all of the cruft (managedFields, status, etc) from the result.

It would be nice if kam could handle exporting resources and even nicer if kam could do it based on the schema for the selected object to export only the relevant fields.

Describe the solution you'd like
Exporting to pure yaml at a minimum would be very useful but being able to bootstrap resources to a kustomize base or a helm chart would be totally awesome as well.

Describe alternatives you've considered
Using a bash script which pipes the resource through yq to strip unneeded fields.

Host key verification script implementation is flakey in CI

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Host key verification script passes here - https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/redhat-developer_kam/87/pull-ci-redhat-developer-kam-master-v4.5-integration-e2e/1339168006101536768

However in the next run it fails with the error

Command stderr:  ✗  failed to create the gitops repository: "https://github.com/kam-bot/taxi-87.git": failed to push bootstrapped resources: failed push remote to repository "[email protected]:kam-bot/taxi-87.git" "Could not create directory '/.ssh'.\r\nHost key verification failed.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n": exit status 128

In CI the script ideally add the attributes into the $HOME/.ssh/config file to skip the HostKeyChecking while creating github repo and pushing files.

$ cat  $HOME/.ssh/config
Host github.com
	StrictHostKeyChecking no

The script i am using for implementing it

s.BeforeSuite(func() {
		fmt.Println("Before suite")
		if !envVariableCheck() {
			os.Exit(1)
		}
		val, ok := os.LookupEnv("CI")
		if ok && val == "prow" {
			err := os.MkdirAll(os.Getenv("HOME")+"/.ssh", 0755)
			if err != nil {
				fmt.Println(err.Error())
			}

			f, err := os.OpenFile(filepath.Join(os.Getenv("HOME"), ".ssh", "config"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
			if err != nil {
				log.Fatal(err)
			}
			if _, err = f.Write([]byte("Host github.com\n\tStrictHostKeyChecking no\n")); err != nil {
				f.Close() // ignore error; Write error takes precedence
				log.Fatal(err)
			}

			content, err := ioutil.ReadFile(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))

			if err != nil {
				log.Fatal(err)
			}

			fmt.Println(string(content))

			if err := f.Close(); err != nil {
				log.Fatal(err)
			}
		}
	})

Describe the solution you'd like
The script implementation should not introduce any test flake

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

In the test feature file execute the command

echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config

Additional context
Add any other context or screenshots about the feature request here.

make test fails on macOS

Describe the bug
A clear and concise description of what the bug is.
make test fails on macOS. See the details failure log in steps to reproduce section
To Reproduce
Steps to reproduce the behavior:

$ make test
go test -mod=readonly ./...
?       github.com/redhat-developer/kam/cmd/kam [no test files]
ok      github.com/redhat-developer/kam/pkg/cmd 5.787s
ok      github.com/redhat-developer/kam/pkg/cmd/environment     3.320s
?       github.com/redhat-developer/kam/pkg/cmd/genericclioptions       [no test files]
ok      github.com/redhat-developer/kam/pkg/cmd/service 4.843s
ok      github.com/redhat-developer/kam/pkg/cmd/ui      (cached)
ok      github.com/redhat-developer/kam/pkg/cmd/utility (cached)
?       github.com/redhat-developer/kam/pkg/cmd/version [no test files]
ok      github.com/redhat-developer/kam/pkg/cmd/webhook 7.523s
ok      github.com/redhat-developer/kam/pkg/pipelines   15.291s
ok      github.com/redhat-developer/kam/pkg/pipelines/argocd    2.650s
?       github.com/redhat-developer/kam/pkg/pipelines/argocd/operator/v1alpha1  [no test files]
?       github.com/redhat-developer/kam/pkg/pipelines/argocd/v1alpha1   [no test files]
?       github.com/redhat-developer/kam/pkg/pipelines/clientconfig      [no test files]
ok      github.com/redhat-developer/kam/pkg/pipelines/config    2.148s
ok      github.com/redhat-developer/kam/pkg/pipelines/deployment        (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/dryrun    (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/environments      6.482s
ok      github.com/redhat-developer/kam/pkg/pipelines/eventlisteners    2.416s
ok      github.com/redhat-developer/kam/pkg/pipelines/git       4.508s
?       github.com/redhat-developer/kam/pkg/pipelines/helper    [no test files]
ok      github.com/redhat-developer/kam/pkg/pipelines/imagerepo 2.668s
?       github.com/redhat-developer/kam/pkg/pipelines/ioutils   [no test files]
ok      github.com/redhat-developer/kam/pkg/pipelines/meta      (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/namespaces        (cached)
?       github.com/redhat-developer/kam/pkg/pipelines/pipelines [no test files]
ok      github.com/redhat-developer/kam/pkg/pipelines/resources (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/roles     (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/routes    (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/scm       1.221s
ok      github.com/redhat-developer/kam/pkg/pipelines/secrets   (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/statustracker     (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/tasks     (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/triggers  (cached)
ok      github.com/redhat-developer/kam/pkg/pipelines/webhook   0.901s
--- FAIL: TestWriteResources (0.03s)
    --- FAIL: TestWriteResources/Path_without_permission (0.00s)
        resources_test.go:45: error mismatch: got failed to MkDirAll for /test/myfile.yaml: mkdir /test: read-only file system, want failed to MkDirAll for /test/myfile.yaml: mkdir /test: permission denied
FAIL
FAIL    github.com/redhat-developer/kam/pkg/pipelines/yaml      1.008s
?       github.com/redhat-developer/kam/tools/cmd-docs  [no test files]
FAIL
make: *** [test] Error 1

Expected behavior
A clear and concise description of what you expected to happen.
make test should not report any error on macOS
Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Kam bootstrap reports failure in sealed secrets check

Describe the bug
A clear and concise description of what the bug is.

Pasted output is self explanatory

$ kam bootstrap --service-repo-url $SERVICE_REPO_URL --gitops-repo-url $GITOPS_REPO_URL --image-repo $GITOPS_REPO_URL --dockercfgjson $DOCKERCONFIGJSON_PATH --git-host-access-token $GITHUB_TOKEN --output bootstrapresources --push-to-git=true'
Checking dependencies
 •  Checking if Sealed Secrets is installed with the default configuration  ...

 ✗  Checking if Sealed Secrets is installed with the default configuration [49ms] [Please install Sealed Secrets Operator from OperatorHub]
[...]

To Reproduce
Steps to reproduce the behavior:

  1. Spinnup a cluster 4.5 or 4.6 or 4.7.
  2. Install sealed secrets operator as per the doc https://github.com/redhat-developer/kam/blob/master/docs/journey/day1/prerequisites/sealed_secrets.md
  3. Install pipeline operator as per the doc https://github.com/redhat-developer/kam/blob/master/docs/journey/day1/prerequisites/pipelines_operator.md
  4. Install argocd operator as per the doc https://github.com/redhat-developer/kam/blob/master/docs/journey/day1/prerequisites/argocd.md
  5. Follow these instructions too

Create your GitOps repository and leave it uninitialized.
Application Source repository (taxi is used as an example in this document)
The external image repository secret to authenticate image pushes on successful pipeline execution. To use quay.io, please follow prerequisites/quay.md
Build kam binary - make bin and put the binary in the PATH
Steps to create the git access token for GitHub or GitLab.

  1. Execute the command for bootstrapping the manifest
$ kam bootstrap \
  --service-repo-url https://github.com/<your organization>/taxi.git \
  --gitops-repo-url https://github.com/<your organization>/gitops.git \
  --image-repo quay.io/<username>/<image-repo> \
  --dockercfgjson ~/Downloads/<username>-auth.json \
  --git-host-access-token <your git access token> \
  --output <path to write GitOps resources>
  --push-to-git=true
  1. See error
Checking dependencies
 •  Checking if Sealed Secrets is installed with the default configuration  ...

 ✗  Checking if Sealed Secrets is installed with the default configuration [49ms] [Please install Sealed Secrets Operator from OperatorHub]

Expected behavior
A clear and concise description of what you expected to happen.
Sealed Secrets check should pass

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Cannot run `kam bootstrap` from Users $HOME directory in Mac.

Describe the bug
kam bootstrap returns the below error when executed from Users $HOME directory

 ✗  failed to create the gitops repository: "https://github.com/iam-veeramalla/gitops.git": failed to push bootstrapped resources: failed to add files to repository in "." "warning: could not open directory 'Library/Application Support/CallHistoryTransactions/': Operation not permitted\nwarning: could not open directory 'Library/Application Support/com.apple.sharedfilelist/': Operation not permitted\nwarning: could not open directory 'Library/Application Support/com.apple.TCC/': Operation not permitted\nwarning: could not open directory 'Library/Application Support/FileProvider/': Operation not permitted\nwarning: could not open directory 'Library/Application Support/CallHistoryDB/': Operation not permitted\nwarning: could not open directory 'Library/Autosave Information/': Operation not permitted\nwarning: could not open directory 'Library/IdentityServices/': Operation not permitted\nwarning: could not open directory 'Library/Messages/': Operation not permitted\nwarning: could not open directory 'Library/Sharing/': Operation not permitted\nwarning: could not open directory 'Library/Mail/': Operation not permitted\nwarning: could not open directory 'Library/Safari/': Operation not permitted\nwarning: could not open directory 'Library/Suggestions/': Operation not permitted\nwarning: could not open directory 'Library/Containers/com.apple.archiveutility/': Operation not permitted\nwarning: could not open directory 'Library/Containers/com.apple.Safari/': Operation not permitted\nwarning: could not open directory 'Library/PersonalizationPortrait/': Operation not permitted\nwarning: could not open directory 'Library/Metadata/CoreSpotlight/': Operation not permitted\nwarning: could not open directory 'Library/VoiceTrigger/SAT/': Operation not permitted\nwarning: could not open directory 'Library/Cookies/': Operation not permitted\nwarning: could not open directory 'Library/Caches/CloudKit/': Operation not permitted\nwarning: could not open directory '.Trash/': Operation not permitted\nerror: open(\"Library/Google/GoogleSoftwareUpdate/Stats/Keystone.stats\"): Permission denied\nerror: unable to index file 'Library/Google/GoogleSoftwareUpdate/Stats/Keystone.stats'\nfatal: adding files failed\n": exit status 128

To Reproduce
Steps to reproduce the behavior:

  1. Download kam binary to /opt folder[Can be anything else]
  2. cd $HOME
  3. Execute /opt/kam bootstrap [parameters] command from $HOME directory.

Example command:

/opt/kam_darwin_amd64 bootstrap \
  --service-repo-url https://github.com/iam-veeramalla/taxi.git \
  --gitops-repo-url https://github.com/iam-veeramalla/gitops.git \
  --image-repo docker.io/abhishek-f5/taxi \
  --git-host-access-token 199b98f8e192688af5a88c8c517b775edfd7872b\
  --dockercfgjson ~/.docker/config.json \

Expected behavior
kam should only try to access the config, environment and pipelines.yaml

Screenshots
NA

Minor documentation problems

Sealed Secrets Operator installation and configuration is incomplete

Describe the bug
A clear and concise description of what the bug is.
As per instructed in - https://github.com/redhat-developer/kam/blob/master/docs/journey/day1/prerequisites/sealed_secrets.md it only says the installation of the operator, however to run kam bootstrap ... Sealed Secrets instance creation is needed as a preq check.

To Reproduce
Steps to reproduce the behavior:
Follow steps as instructed - https://github.com/redhat-developer/kam/blob/master/docs/journey/day1/prerequisites/sealed_secrets.md

Expected behavior
Sealed Secrets Instance creation steps should be added to the doc

Screenshots
NA

Additional context
NA

OpenShift Pipelines Operator check fails for kam bootstrap command while using developer login

Describe the bug
A clear and concise description of what the bug is.

[...]
✓  Checking if ArgoCD Operator is installed with the default configuration [2s]
 ✗  Checking if OpenShift Pipelines Operator is installed with the default configuration [2s]
 ✗  failed to check for OpenShift Pipelines Operator: deployments.apps "openshift-pipelines-operator" is forbidden: User "developer" cannot get resource "deployments" in API group "apps" in the namespace "openshift-operators"

To Reproduce
Steps to reproduce the behavior:

  1. $ git lone https://github.com/redhat-developer/kam/
  2. $ cd kam
  3. $ mkdir auth
  4. $ cp <cluster_kubeconfig_file_path>/kubeconfig auth/kubeconfig
  5. $ cp <kubeadmin-password_file_path>/kubeadmin-password auth/kubeadmin-password
  6. $ make prepare-test-cluster
  7. $ oc login -u developer -p developer <api_server>
  8. $ kam bootstrap --service-repo-url https://github.com//taxi --gitops-repo-url https://github.com//gitops.git --image-repo quay.io//taxi --dockercfgjson ~/Downloads/-robot-auth.json --git-host-access-token <token_string> --output resources --push-to-git=true

Checking dependencies

✓ Checking if Sealed Secrets is installed with the default configuration [861ms]
✓ Checking if ArgoCD Operator is installed with the default configuration [2s]
✗ Checking if OpenShift Pipelines Operator is installed with the default configuration [2s]
✗ failed to check for OpenShift Pipelines Operator: deployments.apps "openshift-pipelines-operator" is forbidden: User "developer" cannot get resource "deployments" in API group "apps" in the namespace "openshift-operators"

Expected behavior
A clear and concise description of what you expected to happen.

bootstrap command should pass

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Missing how to build info

ReadMe (or any other doc) is missing information on how to build and test the project. It only has some info about how to do a PR.

Create an application/service in the new environment and push configuration to GitOps repository

Is your task related to a problem? Please describe.

Describe the solution you'd like

Add e2e test script for - https://github.com/redhat-developer/kam/tree/master/docs/journey/day2#create-an-applicationservice-in-the-new-environment and https://github.com/redhat-developer/kam/tree/master/docs/journey/day2#commit-and-push-configuration-to-gitops-repoository

Describe alternatives you've considered

Additional context

kam should trim leading and trailing spaces from input

Describe the bug
kam exits with error if the user provides answers with leading spaces in their response. Trailing spaces can pose problems as well.

To Reproduce
Steps to reproduce the behavior:

  1. Run kam bootstrap
  2. When prompted to enter the URL for your GitOps repository, purposely add a space before your gitops URL
  3. Hit enter

kam exits with an error

See output below:

kam bootstrap
  
Checking dependencies

 ✓  Checking if Sealed Secrets is installed with the default configuration [325ms]
 ✓  Checking if ArgoCD Operator is installed with the default configuration [721ms]
 ✓  Checking if OpenShift Pipelines Operator is installed with the default configuration [846ms]
  
Starting interactive prompt

? Provide the URL for your GitOps repository  https://github.com/keithchong/gitops9.git
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1fadcb7]

goroutine 1 [running]:
github.com/redhat-developer/kam/pkg/cmd/ui.EnterGitRepo(0xc0002ed820, 0x2659cf6)
	/Users/kchong/wrh/git/kam/pkg/cmd/ui/ui.go:26 +0x117
github.com/redhat-developer/kam/pkg/cmd.initiateInteractiveMode(0xc00007fd50, 0xc0002ed820, 0x2874620, 0xc000495500)
	/Users/kchong/wrh/git/kam/pkg/cmd/bootstrap.go:161 +0x9d
github.com/redhat-developer/kam/pkg/cmd.(*BootstrapParameters).Complete(0xc00007fd50, 0x265fca6, 0x9, 0xc0004fe2c0, 0x34268e8, 0x0, 0x0, 0xc00018fc00, 0x2659e0a)
	/Users/kchong/wrh/git/kam/pkg/cmd/bootstrap.go:112 +0x14c
github.com/redhat-developer/kam/pkg/cmd/genericclioptions.GenericRun(0x2874660, 0xc00007fd50, 0xc0004fe2c0, 0x34268e8, 0x0, 0x0)
	/Users/kchong/wrh/git/kam/pkg/cmd/genericclioptions/runnable.go:23 +0x6e
github.com/redhat-developer/kam/pkg/cmd.NewCmdBootstrap.func1(0xc0004fe2c0, 0x34268e8, 0x0, 0x0)
	/Users/kchong/wrh/git/kam/pkg/cmd/bootstrap.go:324 +0x5e
github.com/spf13/cobra.(*Command).execute(0xc0004fe2c0, 0x34268e8, 0x0, 0x0, 0xc0004fe2c0, 0x34268e8)
	/Users/kchong/go/pkg/mod/github.com/spf13/[email protected]/command.go:846 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc0004fe000, 0x1008285, 0xc0000ae058, 0x0)
	/Users/kchong/go/pkg/mod/github.com/spf13/[email protected]/command.go:950 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/kchong/go/pkg/mod/github.com/spf13/[email protected]/command.go:887
github.com/redhat-developer/kam/pkg/cmd.Execute()
	/Users/kchong/wrh/git/kam/pkg/cmd/kam.go:42 +0x2a
main.main()
	/Users/kchong/wrh/git/kam/cmd/kam/kam.go:8 +0x25

Expected behavior
kam should trim spaces. I discovered this problem when I copied and pasted the repo, and I inadvertantly copied a leading space.

Machines with no SSH Configuration with GitHub won't be able to run Kam bootstrap command

Describe the bug
With all the prerequisites are there, run the kam bootstrap command from machine with no SSH configuration, you will face following error:

failed to create the gitops repository: "https://github.com/gajanan-more/gitops.git": failed to push bootstrapped resources: failed push remote to repository "[email protected]:gajanan-more/gitops.git" "Bad owner or permissions on /home/gamore/.ssh/config\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n": exit status 128

To Reproduce
Steps to reproduce the behavior:

  1. Complete all the prerequisites
  2. Run the following command
kam bootstrap \
  --service-repo-url https://github.com/<your organization>/taxi.git \
  --gitops-repo-url https://github.com/<your organization>/gitops.git \
  --image-repo quay.io/<username>/<image-repo> \
  --dockercfgjson ~/Downloads/<username>-auth.json \
  --git-host-access-token <your git access token> \
  --output <path to write GitOps resources>
  --push-to-git=true
  1. You will see error mentioned above

Screenshots

Screenshot from 2020-12-23 17-38-07

kam should use Github push API instead of `git push` command

Is your feature request related to a problem? Please describe.
kam can make use of the github push api to push the files/folders it creates when --push-to-git=true flag is enabled. Right now, User has to add his public key to github account.

if out, err := e.execute(o.OutputPath, "git", "push", "-u", "origin", "main"); err != nil {

Describe the solution you'd like
Use the Github Push API.
https://docs.github.com/en/free-pro-team@latest/graphql/reference/objects#push

Describe alternatives you've considered
Its not a blocker as user can still get the things done by adding his public key to github account.

Additional context
Issue:

if out, err := e.execute(o.OutputPath, "git", "push", "-u", "origin", "main"); err != nil {

Solution towards the Issue:
https://docs.github.com/en/free-pro-team@latest/graphql/reference/objects#push

Highlight that it's not expected to work on Kubernetes (just now).

Describe the bug
Currently, this is dependent on the OpenShift Route model, which is not available in other distributions of Kubernetes.

To Reproduce
Generate and deploy, and attempt to create a webhook.

Expected behavior

It should create a webhook with a URL pointing back to the user's Kubernetes ingress.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

CLI Does not have bash completion

The kam CLI utility doesn't have completion generator

$ kam completion bash
Error: unknown command "completion" for "kam"
Run 'kam --help' for usage.
2021/01/14 14:25:52 unknown command "completion" for "kam"

This should be trivial as it's built into Cobra.

// completionCmd represents the completion command
var completionCmd = &cobra.Command{
	Use:   "completion [bash|zsh|fish|powershell]",
	Short: "Generates shell completion script.",
	Long: `Generates shell completion script for your shell environment

Example:

	source <(cli completion bash)
`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			cmd.Help()
			os.Exit(0)
		}
		switch args[0] {
		case "bash":
			cmd.Root().GenBashCompletion(os.Stdout)
		case "zsh":
			cmd.Root().GenZshCompletion(os.Stdout)
		case "fish":
			cmd.Root().GenFishCompletion(os.Stdout, true)
		case "powershell":
			cmd.Root().GenPowerShellCompletion(os.Stdout)
		default:
			cmd.Help()
		}
	},
}

Upload kam bits to prow artifacts directory

Is your feature request related to a problem? Please describe.
Uploading all platform kam bits to prow artifacts directory is to keep the binary that comprises the pr changes and can be shared publicly to test a particular fix.

Describe the solution you'd like
All platform bits should be available in prow artifacts directory for each pr

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
NA

Additional context
Add any other context or screenshots about the feature request here.
NA

Fix incorrect error message

Describe the bug
The error message that is presented to the user:
The secret length should 16 or more
is incorrect, and needs to be fixed.

To Reproduce
See Gagan's end of sprint review demo

Screen Shot 2020-09-16 at 9 51 03 AM

Expected behavior
The message should be changed to something like:
The length of the secret must be at least 16 characters

I asked Jake from the Documentation team, and he suggested this:
The secret's length must be 16 characters or more

Can't add app/service to a third environment via kam

This does not appear to be the same issue as #102

Describe the bug
After running the bootstrap command to create the two environments, dev and stage, with the taxi app already added to dev, I wanted to:

  1. add the taxi app to a new environment called prod.
  2. add the taxi app to the existing environment stage.
    The goal being that in the dev console, I would have the app-taxi app in three environments.

I noticed that the error happens also if step 1 and 2 above were reversed.

The error is:

duplicate source http://github.com/keithchong/taxi.git: environments.prod.apps.app-taxi.services.taxi, environments.stage.apps.app-taxi.services.taxi

To Reproduce
See screenshot below that shows the steps

Expected behavior
I should be able to add the app to the environment with no issue or error.

Screenshots
Here is the output of the kam commands:

kchong@Keiths-MacBook-Pro kamcli % ./kam bootstrap \
  --service-repo-url https://github.com/keithchong/taxi.git \
  --gitops-repo-url https://github.com/keithchong/gitops5.git \
  --image-repo quay.io/keithchong/taxi \
  --dockercfgjson ~/Downloads/keithchong-robot-auth.json \
  --git-host-access-token <myGitAccessToken> \
  --output /Users/kchong/wrh/kamcli/resources5 \
  --push-to-git=true

  
Checking dependencies

 ✓  Checking if Sealed Secrets is installed with the default configuration [720ms]
 ✓  Checking if ArgoCD Operator is installed with the default configuration [935ms]
 ✓  Checking if OpenShift Pipelines Operator is installed with the default configuration [1s]
  
Completing Bootstrap process

 ✓  Authentication tokens encrypted in secrets
 ✓  Pipelines tracker has been configured
 ✓  OpenShift Pipelines resources created
 ✓  Openshift Route for EventListener created
 ✓  Created dev, stage and CICD environments
 ✓  Created repository
 ✓  Bootstrapped OpenShift resources successfully

 Next Steps:
 Please refer to https://github.com/redhat-developer/kam/tree/master/docs to get started.
kchong@Keiths-MacBook-Pro kamcli % ./kam environment add \
  --env-name prod \
  --pipelines-folder /Users/kchong/wrh/kamcli/resources5
 ✓  Created Environment prod successfully.
kchong@Keiths-MacBook-Pro kamcli % ./kam service add \
  --env-name prod \
  --app-name app-taxi \
  --service-name taxi \
  --git-repo-url http://github.com/keithchong/taxi.git \
  --pipelines-folder /Users/kchong/wrh/kamcli/resources5
 ✓  Created Service taxi successfully at environment prod.
kchong@Keiths-MacBook-Pro kamcli % ./kam service add \
  --env-name stage \
  --app-name app-taxi \
  --service-name taxi \
  --git-repo-url http://github.com/keithchong/taxi.git \
  --pipelines-folder /Users/kchong/wrh/kamcli/resources5
 ✗  1 errors occurred:
duplicate source http://github.com/keithchong/taxi.git: environments.prod.apps.app-taxi.services.taxi, environments.stage.apps.app-taxi.services.taxi

Unable to create webhook

Describe the bug

kam  webhook create --env-name dev --service-name simple-nodejs-weather-app

fails with the following error

 ✗  unable to create webhook: failed to parse pipelines: 1 errors occurred:
invalid name "test-dev-app-simple-nodejs-weather-app-simple-nodejs-weather-app-binding": environments.test-dev.apps.app-simple-nodejs-weather-app.services.simple-nodejs-weather-app.pipelines.integration.binding
must be no more than 63 characters

When I look at the pipelines.yaml I can see that environments[0].apps[0].services[0].pipelines.integration.bindings[0] has value test-dev-app-simple-nodejs-weather-app-simple-nodejs-weather-app-binding but this value is generated by bootstrap command and it should not generate an erroneous value.

Kam bootstrap command reports: failed to create repository "gitops" in namespace

Describe the bug

✗  failed to create the gitops repository: "https://github.com/gajanan-more/gitops.git": failed to create repository "gitops" in namespace "": Repository creation failed.

To Reproduce
Steps to reproduce the behavior:

  1. Run command
kam bootstrap \
  --service-repo-url https://github.com/<your organization>/taxi.git \
  --gitops-repo-url https://github.com/<your organization>/gitops.git \
  --image-repo quay.io/<username>/<image-repo> \
  --dockercfgjson ~/Downloads/<username>-auth.json \
  --git-host-access-token <your git access token> \
  --output <path to write GitOps resources>
  --push-to-git=true

You will see error mentioned below,

✗  failed to create the gitops repository: "https://github.com/gajanan-more/gitops.git": failed to create repository "gitops" in namespace "": Repository creation failed.

Expected behavior
You should not receive any error.

[Doc] Creating webhook step is misleading

Describe the bug

This is a simple documentation change.

In the steps for Day 1 Operation, there is a step to create a web hook:

https://github.com/redhat-developer/kam/tree/master/docs/journey/day1#your-first-ci-run

$ kam webhook create
--access-token
--env-name tst-dev
--service-name taxi

After going through the previous steps, running this command as-is will result in an error message

✗ Unable to create webhook: failed to find Git repository URL in manifest

The correct command to run should be (simply replace tst-dev with dev)

$ kam webhook create
--access-token
--env-name dev
--service-name taxi

The tst prefix wasn't used or referenced previously.

Evaluate kam bootstrap flags

Is your task related to a problem? Please describe.

Verify test scenario manually for all flags of bootstrap command .

$ kam bootstrap -h
Bootstrap GitOps CI/CD Manifests

Usage:
  kam bootstrap [flags]

Examples:
  # Bootstrap OpenShift pipelines.
  kam bootstrap

Flags:
      --commit-status-tracker           Enable or disable the commit-status-tracker which reports the success/failure of your pipelineruns to GitHub/GitLab (default true)
      --dockercfgjson string            Filepath to config.json which authenticates the image push to the desired image registry  (default "~/.docker/config.json")
      --git-host-access-token string    Used to authenticate repository clones, and commit-status notifications (if enabled). Access token is encrypted and stored on local file system by keyring, will be updated/reused.
      --gitops-repo-url string          Provide the URL for your GitOps repository e.g. https://github.com/organisation/repository.git
      --gitops-webhook-secret string    Provide a secret that we can use to authenticate incoming hooks from your Git hosting service for the GitOps repository. (if not provided, it will be auto-generated)
  -h, --help                            help for bootstrap
      --image-repo string               Image repository of the form <registry>/<username>/<repository> or <project>/<app> which is used to push newly built images
      --output string                   Path to write GitOps resources (default ".")
      --overwrite                       Overwrites previously existing GitOps configuration (if any) on the local filesystem
  -p, --prefix string                   Add a prefix to the environment names(Dev, stage,prod,cicd etc.) to distinguish and identify individual environments
      --private-repo-driver string      If your Git repositories are on a custom domain, please indicate which driver to use github or gitlab
      --push-to-git                     If true, automatically creates and populates the gitops-repo-url with the generated resources
      --save-token-keyring              Explicitly pass this flag to update the git-host-access-token in the keyring on your local machine
      --sealed-secrets-ns string        Namespace in which the Sealed Secrets operator is installed, automatically generated secrets are encrypted with this operator (default "cicd")
      --sealed-secrets-svc string       Name of the Sealed Secrets Services that encrypts secrets (default "sealedsecretcontroller-sealed-secrets")
      --service-repo-url string         Provide the URL for your Service repository e.g. https://github.com/organisation/service.git
      --service-webhook-secret string   Provide a secret that we can use to authenticate incoming hooks from your Git hosting service for the Service repository. (if not provided, it will be auto-generated)

Describe the solution you'd like

Document those test scenario. Later we script those in e2e test.

Describe alternatives you've considered

Additional context

Unit test fails on master

Describe the bug
Unit test fails on master

To Reproduce
Steps to reproduce the behavior:

$ make test
go test ./...
?       github.com/redhat-developer/kam/cmd/kam [no test files]
ok      github.com/redhat-developer/kam/pkg/cmd 1.328s
ok      github.com/redhat-developer/kam/pkg/cmd/environment     2.016s
?       github.com/redhat-developer/kam/pkg/cmd/genericclioptions       [no test files]
ok      github.com/redhat-developer/kam/pkg/cmd/service 2.448s
ok      github.com/redhat-developer/kam/pkg/cmd/ui      2.395s
ok      github.com/redhat-developer/kam/pkg/cmd/utility 1.533s
?       github.com/redhat-developer/kam/pkg/cmd/version [no test files]
ok      github.com/redhat-developer/kam/pkg/cmd/webhook 2.926s
ok      github.com/redhat-developer/kam/pkg/pipelines   2.226s
ok      github.com/redhat-developer/kam/pkg/pipelines/argocd    0.995s
?       github.com/redhat-developer/kam/pkg/pipelines/argocd/operator/v1alpha1  [no test files]
?       github.com/redhat-developer/kam/pkg/pipelines/argocd/v1alpha1   [no test files]
?       github.com/redhat-developer/kam/pkg/pipelines/clientconfig      [no test files]
ok      github.com/redhat-developer/kam/pkg/pipelines/config    1.923s
ok      github.com/redhat-developer/kam/pkg/pipelines/deployment        1.901s
ok      github.com/redhat-developer/kam/pkg/pipelines/dryrun    5.164s
ok      github.com/redhat-developer/kam/pkg/pipelines/environments      1.886s
ok      github.com/redhat-developer/kam/pkg/pipelines/eventlisteners    1.783s
ok      github.com/redhat-developer/kam/pkg/pipelines/git       1.484s
?       github.com/redhat-developer/kam/pkg/pipelines/helper    [no test files]
ok      github.com/redhat-developer/kam/pkg/pipelines/imagerepo 2.129s
?       github.com/redhat-developer/kam/pkg/pipelines/ioutils   [no test files]
ok      github.com/redhat-developer/kam/pkg/pipelines/meta      1.265s
ok      github.com/redhat-developer/kam/pkg/pipelines/namespaces        1.632s
?       github.com/redhat-developer/kam/pkg/pipelines/pipelines [no test files]
ok      github.com/redhat-developer/kam/pkg/pipelines/resources 1.335s
ok      github.com/redhat-developer/kam/pkg/pipelines/roles     1.636s
ok      github.com/redhat-developer/kam/pkg/pipelines/routes    2.104s


--- FAIL: TestHostnameFromURL (0.00s)
    utility_test.go:63: error failed: got "parse https:/%/: invalid URL escape \"%/\"", want "parse \"https:/%/\": invalid 
URL escape \"%/\""


FAIL
FAIL    github.com/redhat-developer/kam/pkg/pipelines/scm       1.595s
ok      github.com/redhat-developer/kam/pkg/pipelines/secrets   0.984s
ok      github.com/redhat-developer/kam/pkg/pipelines/statustracker     0.696s
ok      github.com/redhat-developer/kam/pkg/pipelines/tasks     0.818s
ok      github.com/redhat-developer/kam/pkg/pipelines/triggers  1.108s
ok      github.com/redhat-developer/kam/pkg/pipelines/webhook   0.806s
?       github.com/redhat-developer/kam/pkg/pipelines/yaml      [no test files]
FAIL
make: *** [test] Error 1

Expected behavior
Unti test should pass

Screenshots
NA

Additional context
NA

[Doc] Describe what the <prefix> is for and how it is set

Describe the bug
This is a documentation bug.

There are references to <prefix> but it isn't being used or referenced consistently throughout the docs.

  1. It appears to start from here in the docs:

https://github.com/redhat-developer/kam/tree/master/docs/journey/day1#configuring-pipelines

Specifically,

config/<prefix>-cicd/base/07-templates/app-ci-build-from-push-template.yaml
config/<prefix>-cicd/base/06-bindings/github-push-binding.yaml

and

config/<prefix>-cicd/base/05-pipelines/app-ci-pipeline.yaml

but there is no mention of what it is for or how it is set.

  1. Related problem is: https://github.com/redhat-developer/kam/tree/master/docs/journey/day1#configuring-services

Specifically,

The configuration for these is written out to:
  -  environments/test-dev/services/taxi/base/config/
  -  environments/<prefix>-dev/apps/app-taxi/base/

The test-dev folder is not created. The dev folder exists.
Again, prefix is used here.

So the above should be changed to:

  • environments/dev/services/taxi/base/config/
  • environments/dev/apps/app-taxi/base/

because that is what is actually created in the filesystem.

  1. See https://github.com/redhat-developer/kam/tree/master/docs/journey/day1#changing-the-default-ci-run
    <prefix> is used in several places in this section as well

Bringing the bootstrapped environment up in CI

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Add e2e test script for https://github.com/redhat-developer/kam/tree/master/docs/journey/day1#bringing-the-bootstrapped-environment-up in feature file.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Improve story around people who want to build in each environment.

Describe the bug
kam crashes while trying to add a new service to an existing environment

To Reproduce
Steps to reproduce the behavior:

  1. Bootstrapped https://github.com/sbose78/graphtuitous using interactive mode

  2. Tried adding a service to an existing env.

kam service add --env-name stage --app-name app-graphtuitous --service-name graphtuitous --sealed-secrets-ns sealed-secrets --sealed-secrets-svc sealed-secrets-controller --image-repo=quay.io/shbose/graphtuitous
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x220ad2a]

goroutine 1 [running]:
github.com/redhat-developer/kam/pkg/pipelines.serviceResources(0xc0008f0780, 0x28ac100, 0xc0008fd110, 0xc00089bc20, 0xc0008f0780, 0x0, 0x0)
	/Users/sbose/kam/pkg/pipelines/service.go:112 +0x91a
github.com/redhat-developer/kam/pkg/pipelines.AddService(0xc00089bc20, 0x28ac100, 0xc0008fd110, 0xc0008fd110, 0xc000571ce0)
	/Users/sbose/kam/pkg/pipelines/service.go:42 +0xb4
github.com/redhat-developer/kam/pkg/cmd/service.(*AddServiceOptions).Run(0xc0000cb578, 0x0, 0x0)
	/Users/sbose/kam/pkg/cmd/service/add.go:49 +0x83
github.com/redhat-developer/kam/pkg/cmd/genericclioptions.GenericRun(0x2879d00, 0xc0000cb578, 0xc0009182c0, 0xc0008d24d0, 0x0, 0xb)
	/Users/sbose/kam/pkg/cmd/genericclioptions/runnable.go:25 +0xf2
github.com/redhat-developer/kam/pkg/cmd/service.newCmdAdd.func1(0xc0009182c0, 0xc0008d24d0, 0x0, 0xb)
	/Users/sbose/kam/pkg/cmd/service/add.go:67 +0x5e
github.com/spf13/cobra.(*Command).execute(0xc0009182c0, 0xc0008d2420, 0xb, 0xb, 0xc0009182c0, 0xc0008d2420)
	/Users/sbose/go/pkg/mod/github.com/spf13/[email protected]/command.go:846 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0xc0008b5600, 0x1007abf, 0xc0000a8058, 0x0)
	/Users/sbose/go/pkg/mod/github.com/spf13/[email protected]/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/sbose/go/pkg/mod/github.com/spf13/[email protected]/command.go:887
github.com/redhat-developer/kam/pkg/cmd.Execute()
	/Users/sbose/kam/pkg/cmd/kam.go:42 +0x27
main.main()
	/Users/sbose/kam/cmd/kam/kam.go:8 +0x20
kam version v0.0.14-11-g337dae1
sbose-mac:~ sbose$ which kam

Expected behavior

 ✓  Created Service graphtuitous successfully at environment stage.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.