cloud-native-toolkit / multi-tenancy-gitops

Provides our opinionated point of view on how GitOps can be used to manage the infrastructure, services and application layers of K8s based systems
https://cloudnativetoolkit.dev/adopting/use-cases/gitops/gitops-ibm-cloud-paks/
Apache License 2.0
110 stars 729 forks source link

OUTPUT_DIR=. ./create-repos.sh. #210

Open markalfy1 opened 2 years ago

markalfy1 commented 2 years ago

it creates multi-tenancy-gitops repo only for Mac:

brew install wget
brew install gh
Client Version: 4.7.13
Creating GitHub repositories and local clones in folder: .
Github user/org is mq-apic-demo
gh: Not Found (HTTP 404)
Repository multi-tenancy-gitops not found, creating from template and cloning
✓ Created repository mq-apic-demo/multi-tenancy-gitops on GitHub
Initialized empty Git repository in /Users/markalfy/git/mq-apic-demo-root/multi-tenancy-gitops/.git/
fatal: couldn't find remote ref refs/heads/master
exit status 128
rikgig commented 2 years ago

And when you re-run this script to get the other created, here is the error: Your Github CLI (gh) version is: 2.5.2 Please use oc client version 4.7 or 4.8 download from https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/ Creating GitHub repositories and local clones in folder: . Github user/org is MQ-Validation Repository multi-tenancy-gitops exists and already cloned... nothing to do error: pathspec 'master' did not match any file(s) known to git fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it

dthiesse commented 2 years ago

It worked for me yesterday. I guess double-check your client levels (oc & gh) and whether you are running the script from under your GitHub local directory. I got all 4 repos created in my fork and cloned successfully.

rikgig commented 2 years ago

Strange. I does fail over an over here. My gh has been updated this morning before running it.

Changing this in the create_repos.sh did the trick: From: gh repo create ${GIT_ORG}/multi-tenancy-gitops-infra --public --template https://github.com/cloud-native-toolkit/multi-tenancy-gitops-infra --clone

To: gh repo create ${GIT_ORG}/multi-tenancy-gitops --public --template https://github.com/cloud-native-toolkit/multi-tenancy-gitops gh repo clone ${GIT_ORG}/multi-tenancy-gitops

Now it works. We do a PR or more investigation?

dthiesse commented 2 years ago

Interesting and puzzling. Why don't you do a PR and we can let @hollisc and other reviewers decide. I'm glad you found a solution, and maybe we could avoid any problems for others by making the change.

rikgig commented 2 years ago

Sure is. Ok I'll do that (the PR). @hollisc is aware we were discussing on Webex and was able to show live both the problem and he suggested the gh fix :)

hollisc commented 2 years ago

@dthiesse , can you check what version of gh you are using? From checking with a few ppl, the issue appears to happen if using version 2.5.2

dthiesse commented 2 years ago

@hollisc I am using gh version 2.5.2 (2022-03-01)