afzal442 / keptn-pg-killerway

This repo contains keptn CD walkthrough tutorial to understand the out-of-the-box demo.
https://agardnerit.github.io/thekindkeptn/full-tour.html
MIT License
8 stars 5 forks source link

Keptn Demo Broken #73

Closed agardnerIT closed 1 year ago

agardnerIT commented 1 year ago

There have now been 2 reports of the Keptn demo being broken:

Once I authenticate to Github the script creates a repo but then it fails:  
ubuntu $ ~/setup_keptn.sh

=================================================================================
 Creating brand new Git repo (keptndemo) on your GitHub.com account     
=================================================================================
✓ Created repository Someone/keptndemo on GitHub

=================================================================================
 Creating Keptn project (fulltour) and a Keptn service (helloservice)            
=================================================================================
Keptn CLI is already on the latest version ( 1.0.0 )! 
* Your Keptn CLI version: 1.0.0
* Keptn version 1.1.0 is available! Please visit https://keptn.sh/docs/1.1.x/operate/upgrade/ for more information.
* Your Keptn cluster version: 1.0.0
* To disable the daily version check, please execute:
 - keptn set config AutomaticVersionCheck false

Starting to create project
Error: Create project was unsuccessful.
upstream repository not found
agardnerIT commented 1 year ago

Seeing lots of this during install. Maybe temporary, may be important but it is a killercoda problem not Keptn:

E0124 23:13:02.297892   25726 memcache.go:106] couldn't get resource list for metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0124 23:13:02.325939   25726 memcache.go:255] couldn't get resource list for metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0124 23:13:02.367077   25726 memcache.go:106] couldn't get resource list for metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0124 23:13:02.423857   25726 memcache.go:255] couldn't get resource list for metrics.k8s.io/v1beta1: the server is currently unable to handle the request

Everything (eventually) starts up correctly: image image image

Keptn Auth Step

This works: image

Print Bridge Login Details

This works: image

Login to Bridge (Before Project Creation)

This works: image

Set Git Details

This works: image

Setup Keptn

This works (this time and for me): image

agardnerIT commented 1 year ago

Q on slack: The first thing I encountered was that it hangs for a LONG time at this step: ubuntu $ kubectl -n keptn-jes wait --for condition=Available=True --timeout=${POD_WAIT_TIMEOUT_MINS}m deployment/job-executor-service. It finally gets to "Installation Complete" after 11 minutes.

The Job Executor Service (JES) needs to communicate with Keptn so until all the pods in the keptn namespace are running, the JES pod won't start.

Unfortunately the startup time has as much to do with the underlying infrastructure (provided for free by Killercoda) so there isn't much we can do here.

agardnerIT commented 1 year ago

So what's happening?

A few possibilities I see:

1) The user is attempting to run setup_keptn.sh on a preexisting repo. DO NOT DO THIS. Let the demo create a new repo every time you re-run the setup_keptn.sh script. 2) The Git PAT token doesn't have full repo access 3) This is a temporary / transient issue with the connection to GitHub (see below for explanation)

When the setup_keptn.sh creates the project, it issues the keptn create project command via CLI. The logic here might need improvement in case of failure. I'm not sure, it may already retry on failure but the repo definitely does exist (it is created independently by the gh CLI command) so something is clearly going wrong.

From there, all the other errors are cascading symptoms. If the Keptn project doesn't exist, everything else is doomed to fail.

LeslieMurphy commented 1 year ago

Hi @agardnerIT

Regarding Slow startup time - I suggest adding a line into the script to tell the user "The job-executor-service takes up to 10 minutes to start; please be patient"

On the create project issue - item 1 is not it - I tried twice to make sure there was not a preexisting repo. Item 2 - is there some other access I need to enable besides "repo"?

image
LeslieMurphy commented 1 year ago

I tried again after adding almost every conceivable permission to the token. Still get same failure. A new GitHub repo was created but it is empty.

Starting to create project
Error: Create project was unsuccessful.
upstream repository not found
Starting to create service
Create service was unsuccessful
Error: Create service was unsuccessful. could not get stages of project fulltour: project not found
LeslieMurphy commented 1 year ago

Could it perhaps be that my username on GitHub is different than the userid? Grasping at straws.

ubuntu $ git clone https://github.com/LeslieMurphy/keptdemo3.git Cloning into 'keptdemo3'... Username for 'https://github.com': les.murphy@xxxxxxxxxxxxxxx.com Password for 'https://les.murphy@xxxxxxxxxxxxxxx.com@github.com': remote: Repository not found. fatal: repository 'https://github.com/LeslieMurphy/keptdemo3.git/' not found

ubuntu $ git clone https://github.com/LeslieMurphy/keptndemo3.git Cloning into 'keptndemo3'... warning: You appear to have cloned an empty repository.

agardnerIT commented 1 year ago

Oh... It could? Tbh I didn't know that was possible with GitHub :)

LeslieMurphy commented 1 year ago

I will try again and see if it accepts my username with the token

agardnerIT commented 1 year ago

set_git_details.sh currently creates the URL as:

export GIT_REPO=https://github.com/$GIT_USER/$GIT_NEW_REPO_NAME.git

So you might well have solved it.

agardnerIT commented 1 year ago

Also, there was a typo above. You wrote keptdemo3 and it is keptndemo3 with an n

LeslieMurphy commented 1 year ago

I know! I fat fingered it! It is WORKING when I use my username!

image

LeslieMurphy commented 1 year ago

image

LeslieMurphy commented 1 year ago

GitHub allows authentication using either the Username or email address. If the email is used in the Keptn script for the token credentials, the script will create a repo but subsequently will fail. Is there a way to improve the process to make it work in either case?

image

LeslieMurphy commented 1 year ago

Here is a summary of the issue:

image

agardnerIT commented 1 year ago

@LeslieMurphy we are updating to Keptn v1.1.0 and it might be nice to include this in that work (#74).

If I'm not mistaken, all we need here is to modify the set_git_details.sh and include a new additional parameter for GIT_EMAIL. Then if it is NOT set, we assume username and just use that, but if it IS set, we can accomodate your usecase.

Make sense?

LeslieMurphy commented 1 year ago

Hi Adam, are you proposing three prompts - one for email and one for username plus the token? Could you instead extract the username from github after creating the repo?

If you first install jq this will do the trick:

gh api 'https://api.github.com/user' | jq .login

Result after using my github email address for authentication is:

"LeslieMurphy"

agardnerIT commented 1 year ago

That's a much better idea. Thanks!

Would you like to raise the PR (I can help) or should I do it?

agardnerIT commented 1 year ago

@LeslieMurphy anything more to do here or can we close?

LeslieMurphy commented 1 year ago

I think we are all good on it. Sent from my iPhoneOn Mar 26, 2023, at 5:25 PM, Adam Gardner @.***> wrote: @LeslieMurphy anything more to do here or can we close?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>