pingidentity / pipeline-example-infrastructure

Other
3 stars 2 forks source link

Getting an error on installing kubectl step #30

Open jenniferstipe opened 2 years ago

jenniferstipe commented 2 years ago

I am trying to run this on Ubuntu (WSL). I am also using a self-hosted runner and docker kubernetes since I do not have access to a publicly accessible kubernetes cluster.

Everything works until I try to push the mydemo branch, in my runners I see this error:

0s Run ## Install and configure kubectl % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 43.5M 100 43.5M 0 0 112M 0 --:--:-- --:--:-- --:--:-- 112M error: EOF Please enter Username: Error: Process completed with exit code 1.

I thought this might be due to the default workflows (deploy.yaml and prune.yml) using hosted runners, so I updated them:

jobs: deploy: name: Deploy

uses hosted runner

#runs-on: ubuntu-latest
runs-on: [self-hosted, Linux]

Then I got this error:

Run ## Install and configure kubectl % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 50 43.5M 50 21.9M 0 0 30.3M 0 0:00:01 --:--:-- 0:00:01 30.3M 100 43.5M 100 43.5M 0 0 38.3M 0 0:00:01 0:00:01 --:--:-- 38.3M mkdir: cannot create directory ‘/home/jstipe/.kube’: File exists Error: Process completed with exit code 1.

So I deleted the .kube directory under /home/jstipe.

However I am back to the initial error:

1s Run ## Install and configure kubectl % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 28 43.5M 28 12.4M 0 0 17.0M 0 0:00:02 --:--:-- 0:00:02 16.9M 100 43.5M 100 43.5M 0 0 34.5M 0 0:00:01 0:00:01 --:--:-- 34.5M error: EOF Please enter Username: Error: Process completed with exit code 1.

The job is definitely running on my local computer (self-hosted). Any ideas?

jenniferstipe commented 2 years ago

What helped get me past the errors is I commented out the entire "Install Dependencies" section in deploy.yaml. Then I made sure anything that was run in that section was also run once in my ubuntu wsl environment. I'm still getting some CrashLoopBackOff errors in my PingFed pods but I'm at least getting further.

Are the deploy/prune yamls supposed to be running in a container?

samir-gandhi commented 2 years ago

Thanks for the feedback.

I'll look at this further in the morning or next week, but here are some initial thoughts.

Ultimately, the workload should deploy to your k8s cluster but it will download config from the profiles folder of your remote repo. Since your repo is private your SERVER_PROFILE_URL (Lines 20 and 22 here ) will need to include git user+PAT. https://devops.pingidentity.com/how-to/privateRepos/.

jenniferstipe commented 2 years ago

Ultimately, the workload should deploy to your k8s cluster but it will download config from the profiles folder of your remote repo. Since your repo is private your SERVER_PROFILE_URL (Lines 20 and 22 here ) will need to include git user+PAT. https://devops.pingidentity.com/how-to/privateRepos/.

Thanks, do I also need to update SERVER_PROFILE_ADMIN_URL: "https://github.com/${GITHUB_REPOSITORY}"?

samir-gandhi commented 2 years ago

Yup yup, any related occurrence.

jenniferstipe commented 2 years ago

Thanks, I have tried updating the helm/values.yml file but I get this error:

jstipe@COSLAPWSTIP:~/git/pipeline-example$ kubectl logs mydemo-pingdataconsole-7dddfb8fc-vgmnx ----- Starting hook: ./bootstrap.sh

Bootstrap

Using the default container user and group

Container user and group

user : ping (id: 9031)

group: root (id: 0)

----- Starting hook: /opt/entrypoint.sh Command: start-server Processing secrets in SECRETS_DIR (if any)... ################################################################################

Ping Identity DevOps Docker Image

IMAGE_VERSION: pingdataconsole-alpine_3.15.3-al11-9.0.0.1-220331-ce918

IMAGE_GIT_REV: ce9186ecadd68f5e6ccbe91d33771aaa280a63ae

STARTED: Fri Jun 17 17:58:52 UTC 2022

HOST_NAME: mydemo-pingdataconsole-7dddfb8fc-vgmnx

DOMAIN_NAME: localdomain

################################################################################ no local IN_DIR files (/opt/in) found.

----- Starting hook: /opt/staging/hooks/01-start-server.sh

----- Starting hook: /opt/staging/hooks/02-get-remote-server-profile.sh Getting SERVER_PROFILE git url: REDACTED branch: mydemo path: profiles/pingdataconsole Cloning into '/tmp/server-profile'... fatal: unable to access 'https://github.com/jenniferstipe/pipeline-example/': URL using bad/illegal format or missing URL

I tried the following variations in helm/values.yaml:

envs:

CHANGEME - hardcode this line

#SERVER_PROFILE_URL: "https://github.com/${GITHUB_REPOSITORY}"
#SERVER_PROFILE_URL: "https://myuser:myPAT@github.com/${GITHUB_REPOSITORY}"
#SERVER_PROFILE_URL: "https://myuser:myPAT@github.com/jenniferstipe/pipeline-example/"
SERVER_PROFILE_URL: "https://myuser:myPAT@github.com/jenniferstipe/pipeline-example.git"
## CHANGEME - hardcode this line
#SERVER_PROFILE_ADMIN_URL: "https://myuser:myPAT@github.com/${GITHUB_REPOSITORY}" 
#SERVER_PROFILE_ADMIN_URL: "https://myuser:myPAT@github.com/jenniferstipe/pipeline-example/" 
SERVER_PROFILE_ADMIN_URL: "https://myuser:myPAT@github.com/jenniferstipe/pipeline-example.git" 

Note: myuser:myPAT are fake values. I can clone the repo using the real values in the same format above so I'm unsure what the container doesn't like. Anything stand out to you?

jenniferstipe commented 2 years ago

FYI - I resolved the last post above it was because my branch was multiple commits behind. I just had to delete and check the branch out again from the prod branch to get it updated.