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

Docker image should include the git binary for vendir #15

Closed
petewall opened this issue Nov 6, 2024 · 1 comment · Fixed by #16
Closed

Docker image should include the git binary for vendir #15

petewall opened this issue Nov 6, 2024 · 1 comment · Fixed by #16
Labels
enhancement This issue is a feature request

Comments

@petewall
Copy link
Contributor

petewall commented Nov 6, 2024

I'm trying to use vendir from the docker image with this config file:

---
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: alloyModules
    contents:
      - path: .
        git:
          url: https://github.com/grafana/alloy-modules
          ref: origin/main

But, it fails because git is not in the container image:

docker run --rm --volume "$(pwd):/src" --workdir /src ghcr.io/carvel-dev/docker-image:latest vendir sync -l
apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
  - git:
      ref: efc635083892036dd0cf2dad76a26d9ff716858f
      url: https://github.com/grafana/alloy-modules
    path: .
  path: alloyModules
kind: Config
minimumRequiredVersion: ""

vendir: Error: Syncing directory 'alloyModules':
  Syncing directory '.' with git contents:
    Fetching git repository:
      Git [init]: exec: "git": executable file not found in $PATH (stderr: )
make: *** [alloyModules/LICENSE] Error 1
@petewall petewall added carvel-triage This issue has not yet been reviewed for validity enhancement This issue is a feature request labels Nov 6, 2024
@carvel-bot carvel-bot added this to Carvel Nov 6, 2024
@petewall
Copy link
Contributor Author

petewall commented Nov 6, 2024

Adding git from inside the binary does make things work:

% docker run -it --rm -v $(pwd):/src --workdir /src ghcr.io/carvel-dev/docker-image:latest bash
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested k8s-monitoring-test/                  
root@450d01c0e025:/src# vendir sync -l;
Config with locks

apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
  - git:
      ref: efc635083892036dd0cf2dad76a26d9ff716858f
      url: https://github.com/grafana/alloy-modules
    path: .
  path: alloyModules
kind: Config
minimumRequiredVersion: ""

Fetching: alloyModules + . (git from https://github.com/grafana/alloy-modules@efc635083892036dd0cf2dad76a26d9ff716858f)

  --> git init

vendir: Error: Syncing directory 'alloyModules':
  Syncing directory '.' with git contents:
    Fetching git repository:
      Git [init]: exec: "git": executable file not found in $PATH (stderr: )
root@450d01c0e025:/src# vendir sync -l 
Config with locks

apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
  - git:
      ref: efc635083892036dd0cf2dad76a26d9ff716858f
      url: https://github.com/grafana/alloy-modules
    path: .
  path: alloyModules
kind: Config
minimumRequiredVersion: ""

Fetching: alloyModules + . (git from https://github.com/grafana/alloy-modules@efc635083892036dd0cf2dad76a26d9ff716858f)

  --> git init

vendir: Error: Syncing directory 'alloyModules':
  Syncing directory '.' with git contents:
    Fetching git repository:
      Git [init]: exec: "git": executable file not found in $PATH (stderr: )
root@450d01c0e025:/src# apt-get update && apt-get install git
...
After this operation, 39.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...
root@450d01c0e025:/src# vendir sync -l 
...
Succeeded
root@450d01c0e025:/src# 

petewall added a commit to petewall/docker-image that referenced this issue Nov 6, 2024
@github-project-automation github-project-automation bot moved this to Closed in Carvel Nov 6, 2024
@github-actions github-actions bot removed the carvel-triage This issue has not yet been reviewed for validity label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a feature request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant