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

hydros build image gives error https scheme is not supported #81

Open
jlewi opened this issue Mar 26, 2024 · 1 comment
Open

hydros build image gives error https scheme is not supported #81

jlewi opened this issue Mar 26, 2024 · 1 comment

Comments

@jlewi
Copy link
Owner

jlewi commented Mar 26, 2024

Here's the yaml

kind: Image
apiVersion: hydros.dev/v1alpha1
metadata:
  name: frontend
  namespace: foyle
  labels:
    env: dev
spec:
  image: us-west1-docker.pkg.dev/foyle-public/images/frontend
  source:
    - uri: https://github.com/jlewi/foyle.git
      mappings:
        - src: "/frontend/**/*"
  builder:
    gcb:
      project: foyle-public
      bucket : builds-foyle-public
      machineType: 'E2_HIGHCPU_8'
      dockerfile: /frontend/Dockerfile

Here's the stacktrace

Scheme https is not supported
github.com/jlewi/hydros/pkg/tarutil.copyLocalPath
	/Users/jlewi/git_hydros/pkg/tarutil/builder.go:96
github.com/jlewi/hydros/pkg/tarutil.Build
	/Users/jlewi/git_hydros/pkg/tarutil/builder.go:77
github.com/jlewi/hydros/pkg/images.(*Controller).Reconcile
	/Users/jlewi/git_hydros/pkg/images/controller.go:170
github.com/jlewi/hydros/pkg/images.ReconcileFile
	/Users/jlewi/git_hydros/pkg/images/controller.go:485
github.com/jlewi/hydros/cmd/commands.NewBuildCmd.func1
	/Users/jlewi/git_hydros/cmd/commands/build.go:20
github.com/spf13/cobra.(*Command).execute
	/Users/jlewi/go/pkg/mod/github.com/spf13/[email protected]/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/jlewi/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068
github.com/spf13/cobra.(*Command).Execute
	/Users/jlewi/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
main.main
	/Users/jlewi/git_hydros/cmd/main.go:151
runtime.main
	/opt/homebrew/Cellar/go/1.21.0/libexec/src/runtime/proc.go:267
runtime.goexit
	/opt/homebrew/Cellar/go/1.21.0/libexec/src/runtime/asm_arm64.s:1197
Failed to create tarball gs://builds-foyle-public/foyle-public/images/frontend.462efa18251584f9404a960132d62aa76ba1056a.tgz
github.com/jlewi/hydros/pkg/images.(*Controller).Reconcile
	/Users/jlewi/git_hydros/pkg/images/controller.go:171
github.com/jlewi/hydros/pkg/images.ReconcileFile
	/Users/jlewi/git_hydros/pkg/images/controller.go:485
github.com/jlewi/hydros/cmd/commands.NewBuildCmd.func1
	/Users/jlewi/git_hydros/cmd/commands/build.go:20
github.com/spf13/cobra.(*Command).execute
	/Users/jlewi/go/pkg/mod/github.com/spf13/[email protected]/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/jlewi/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068
github.com/spf13/cobra.(*Command).Execute
	/Users/jlewi/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
main.main
	/Users/jlewi/git_hydros/cmd/main.go:151
runtime.main
	/opt/homebrew/Cellar/go/1.21.0/libexec/src/runtime/proc.go:267
runtime.goexit
	/opt/homebrew/Cellar/go/1.21.0/libexec/src/runtime/asm_arm64.s:1197
@jlewi
Copy link
Owner Author

jlewi commented Mar 26, 2024

So we call tarutil.build

if err := tarutil.Build(transformed, tarFilePath); err != nil {

This should end up calling copyLocalPath here

if err := copyLocalPath(tw, s); err != nil {

The only scheme that is supported is file

if u.Scheme != "file" {

So why would this ever work with a git or https scheme?

Its because when we do build we automatically replace the remotes here

if err := c.replaceRemotes(ctx, image); err != nil {

So if there is a problem replacing the remote then we don't get a file URI.

At the very least we should probably surface a more actionable error message somewhere for the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant