Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xpkg init provider-template-upjet does not result in a buildable repo #5789

Open
Tracked by #5387
jbw976 opened this issue Jun 14, 2024 · 6 comments
Open
Tracked by #5387

xpkg init provider-template-upjet does not result in a buildable repo #5789

jbw976 opened this issue Jun 14, 2024 · 6 comments
Assignees
Labels
bug Something isn't working crossplane-cli good first issue Good for newcomers user experience
Milestone

Comments

@jbw976
Copy link
Member

jbw976 commented Jun 14, 2024

What happened?

I was just trying to use xpkg init to get a fresh start of https://github.com/crossplane/upjet-provider-template going locally. The command succeeds like so:

❯ crossplane beta xpkg init provider-foo provider-template-upjet -d provider-foo
Initialized package "provider-foo" in directory "/Users/jared/Desktop/crossplane/provider-foo" from https://github.com/upbound/upjet-provider-template/tree/ff852aca552ccc12e18c11e41752bec3b2f1f64a (main)

But there appears to be something missing that is preventing this fresh local repo from being able to build and produce artifacts. Just running make fails because the local repo is not a git repository. After running git init, make will go into an endless loop of Initial setup complete. Running make again . . .:

❯ cd provider-foo
❯ make
fatal: not a git repository (or any of the parent directories): .git
make: *** [submodules] Error 128
❯ git init
Initialized empty Git repository in /Users/jared/Desktop/crossplane/provider-foo/.git/
❯ make
Initial setup complete. Running make again . . .
Initial setup complete. Running make again . . .
Initial setup complete. Running make again . . .
Initial setup complete. Running make again . . .

I believe this has to do something with the build submodule not getting populated, that folder is completely empty:

❯ cat .gitmodules
[submodule "build"]
	path = build
	url = https://github.com/crossplane/build
❯ ll build
total 0
drwxr-xr-x   2 jared  staff    64B Jun 14 10:10 .
drwxr-x---  26 jared  staff   832B Jun 14 10:10 ..

A couple areas to investigate more fully:

  • should the freshly init'd local folder have a .git dir and be a valid git repo?
  • why isn't the build submodule getting synced and populated?

How can we reproduce it?

Repro steps:

crossplane beta xpkg init provider-foo provider-template-upjet -d provider-foo
cd provider-foo
make

What environment did it happen in?

Crossplane version: v1.16.0

@jbw976
Copy link
Member Author

jbw976 commented Jun 14, 2024

Note this scenario works when using just a regular git clone followed by a make. The build submodule gets synced and make has targets to execute on successfully:

❯ git clone https://github.com/crossplane/upjet-provider-template.git
Cloning into 'upjet-provider-template'...
remote: Enumerating objects: 1480, done.
remote: Counting objects: 100% (331/331), done.
remote: Compressing objects: 100% (87/87), done.
remote: Total 1480 (delta 277), reused 259 (delta 244), pack-reused 1149
Receiving objects: 100% (1480/1480), 469.91 KiB | 2.41 MiB/s, done.
Resolving deltas: 100% (750/750), done.

❯ cd upjet-provider-template

❯ make
Submodule 'build' (https://github.com/crossplane/build) registered for path 'build'
Cloning into '/Users/jared/Desktop/crossplane/upjet-provider-template/build'...
Submodule path 'build': checked out 'b0dfb8fbe8c626e3e0f0b6efdfac926d750adf48'
Initial setup complete. Running make again . . .
10:19:15 [ .. ] installing up v0.18.0
10:19:18 [ OK ] installing up v0.18.0
10:19:19 [ .. ] go build linux_arm64
k8s.io/apimachinery/pkg/selection
golang.org/x/exp/maps
k8s.io/apimachinery/pkg/types
google.golang.org/protobuf/internal/flags
(continues so on and so forth...)

@EraKin575
Copy link

I would like to work on this issue

@jbw976
Copy link
Member Author

jbw976 commented Jun 17, 2024

awesome @EraKin575, thank you! I have assigned you to the issue now as you get started. Let us know if you need any support 😉

@jbw976 jbw976 added this to the v1.17 milestone Jun 17, 2024
@EraKin575
Copy link

awesome @EraKin575, thank you! I have assigned you to the issue now as you get started. Let us know if you need any support 😉

Thanks!I have a issue though, I am not able to build crossplane using Earthly 😐

@EraKin575
Copy link

Hi, @jbw976 ! I am able to reproduce the issue. It is going into the endless loop but I can't seem to find the "not a git repo" issue

@Jay179-sudo
Copy link

The problem you've described arises because you have not registered the submodule in the local git repository.

After you've initialized a git repository, delete the build folder and execute the following command. You have to be present within the directory.

git submodule add https://github.com/crossplane/build ./build

The build folder gets synced and populated now.

Now, if you execute the make command, it will work. However, if you have not committed anything yet to the git repo, you will come across this message. Your command will still work.
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

After making at least one commit to the git repo, this error will not be seen again. I have linked a StackOverflow post that explains this issue.

Ambiguous Argument Error StackOverflow

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crossplane-cli good first issue Good for newcomers user experience
Projects
Status: In Progress
Development

No branches or pull requests

3 participants