Giter VIP home page Giter VIP logo

Comments (4)

nenadn-arnica avatar nenadn-arnica commented on September 26, 2024 2

I did this successfully some time ago, it's not difficult to do so.

I believe the image that I used was amd64/amazonlinux(uname -m needs to say x86_64, not aarch64 or whatever it is)

Start the docker container with the image above and run the commands below.

Here are the commands I ran, though if you execute them 1 by 1 they might not work, but regardless, you can see what the goal is from the commands:

  • yum install -y git zip which
  • mkdir myfolder
  • cd myfolder
  • mkdir bin etc lib libexec share
  • cd ..
  • cp -r /usr/bin/git* /usr/bin/fips* /usr/bin/scp /usr/bin/sftp /usr/bin/slogin /usr/bin/ssh* /usr/bin/xmlwf myfolder/bin/
  • cp -r /etc/alternatives/ /etc/pki /etc/prelink.conf.d/ /etc/ssh/ /etc/libaudit.conf myfolder/etc/
  • cp -r /usr/libexec/git-core/ /usr/libexec/openssh/ myfolder/libexec/
  • cp -r /usr/share/git-core/ /usr/share/licenses/ myfolder/share/
  • cp -r /usr/lib64/fipscheck/ /usr/lib64/nss/ /usr/lib64/lib* myfolder/lib
  • cd myfolder
  • mkdir lib64
  • cd ..
  • cp -r /usr/lib64/libpcre2-8.so.0 /myfolder/lib64/
  • cd myfolder
  • zip -yr ../layer.zip .

You can now copy the layer.zip file from the container to your host (google how to do that).

Now the lambda itself needs an env var:
GIT_EXEC_PATH: /opt/libexec/git-core (this tells git where to look for the binary or something like that)

When you do git clone, you need to specify a template, --template=/opt/share/git-core/templates
Example: git clone --template=/opt/share/git-core/templates https://github.com/aneagoie/background-generator.git

If you're pushing, you need to setup the git config stuff yourself
Note: I didn't setup the git config to be global because I got the error: fatal: $HOME not set

from git-lambda-layer.

ThompsonNJ avatar ThompsonNJ commented on September 26, 2024 1

As an update to this, it seems like we might be able to download your layer and reupload it, but since our account does not have cross-account permissions, we would have to do this in a roundabout way.

Did a test for this and I was able to use your layer but was having VPC issues with the git clone. To learn more about how the layer worked, I used awscli to download your layer and reupload it. However, it seems to work completely differently than referencing your layer directly by arn.

I keep getting an error saying "git" is not recognized as a command. I could eventually fix this by into /opts/bin, but I don't understand how you are able to just access /tmp in this way and it works without issues. Do you know why your layer is being put into /tmp?

from git-lambda-layer.

ThompsonNJ avatar ThompsonNJ commented on September 26, 2024

As an update to this, it seems like we might be able to download your layer and reupload it, but since our account does not have cross-account permissions, we would have to do this in a roundabout way. If we end up being able to go that route, would we just upload this zip file to a layer ourselves?
https://github.com/lambci/git-lambda-layer/blob/master/lambda2/layer.zip

I think our preferred route is still what I posted in the original question though. Ideally, we would like to download the binarys ourselves.

from git-lambda-layer.

ThompsonNJ avatar ThompsonNJ commented on September 26, 2024

Did a test for this and I was able to use your layer but was having VPC issues with the git clone. To learn more about how the layer worked, I used awscli to download your layer and reupload it. However, it seems to work completely differently than referencing your layer directly by arn.

I was able to get the git clone working just by providing a proxy config to the git command and was able to get the same functionality as your layer just by uploading the zip file exactly as it was downloaded.

I keep getting an error saying "git" is not recognized as a command. I could eventually fix this by into /opts/bin, but I don't understand how you are able to just access /tmp in this way and it works without issues. Do you know why your layer is being put into /tmp?

I misunderstood what your code was doing. After looking into the defaults /opts/bin and /opts/lib, I realized my layer extracted to a subfolder. It looks like even unzipping and zipping without any edits causes some of the files to be corrupted due to Windows so I had some issues around there. I ended up figuring all the above out except for how you are creating the original layer.

Is this the only thing you're doing to get the git files?
yum install -y git
Zipping them up, then uploading them?

from git-lambda-layer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.