Giter VIP home page Giter VIP logo

Comments (11)

SchulteMarkus avatar SchulteMarkus commented on August 13, 2024 2

@craigatgoogle thanks for the feedback.
I see that it won't be trivial to support the requirement from the plugins point of view.
I had see the k8s plugin. I had hoped being able to avoid it, as it adds another layer of complexity, compared to a solution, that runs only in GCE VM instances.

I created kind of workaround for my requirement:
I am using Packer/Packer Google Compute Builder
to extend the CoreOS (stable) image, which is already present at GCE image marketplace. I am using CoreOS here, because in contrast to ContainerOptimizedOS, I am able to install binaries (though not recommended). I am installing OpenJDK11 into this image, and using the created custom image for my Jenkins slave. The final VM instance is capable of OpenJDK11 and Docker (only). Perfect for https://jenkins.io/doc/book/pipeline/docker/.
You can find the packer image template at https://gist.github.com/SchulteMarkus/4221cfa6059b9e4827c073017a9bac35

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

Thanks for bringing this up. Didn't realize it wasn't trivial to be running containers on GCE instances with the plugin when I first commented on the JIRA issue.

Right now, as you may know, the plugin SSH's directly to the VM. We programmatically insert a security key to the compute engine vm's instance metadata and have the other key when we SSH. Consequently, we won't be able to reach the container running on the VM.

However, this is an interesting use case. I can't guarantee we will implement it, but I will label it as a feature request.

from google-compute-engine-plugin.

SchulteMarkus avatar SchulteMarkus commented on August 13, 2024

Thanks for the update, Rachel.
In my opinion, this is THE usecase for the google-compute-engine-plugin. Using https://cloud.google.com/container-optimized-os/ in combination with https://jenkins.io/doc/book/pipeline/docker/ as Jenkins slave would be awesome.

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

Thanks for the extra information!

from google-compute-engine-plugin.

craigdbarber avatar craigdbarber commented on August 13, 2024

@SchulteMarkus thanks for the feedback. Fyi, the work to support this is non-trivial, so it will merit some further consideration. In the mean time, have you considered using the k8s plugin and running workloads in GKE? Running containers is what GKE excels at. We have a great solutions article which covers this use case here: https://cloud.google.com/solutions/jenkins-on-kubernetes-engine-tutorial

from google-compute-engine-plugin.

craigdbarber avatar craigdbarber commented on August 13, 2024

@SchulteMarkus thanks for sharing. I think in the interim, highlighting this workaround in the plugin docs could provide value to other users who share a similar requirement.

from google-compute-engine-plugin.

craigdbarber avatar craigdbarber commented on August 13, 2024

@SchulteMarkus may we use your JSON template in our documentation for a workaround?

from google-compute-engine-plugin.

SchulteMarkus avatar SchulteMarkus commented on August 13, 2024

from google-compute-engine-plugin.

mohammadidinani avatar mohammadidinani commented on August 13, 2024

@SchulteMarkus were you able to get this working? if yes how?

from google-compute-engine-plugin.

SchulteMarkus avatar SchulteMarkus commented on August 13, 2024

@SchulteMarkus were you able to get this working? if yes how?

I wasn't able to get this working.

from google-compute-engine-plugin.

mohammadidinani avatar mohammadidinani commented on August 13, 2024

i was able to get it to pass java issue but not able to redirect stdin to the container so that agent can come up. basically i am passing below init script to vm and wait for the image to load, once it is loaded, i run agent.jar, but jenkins to write stdin to remote agent to start it which i do not know how to achieve.

cat > /tmp/java <<'EOF'
#!/bin/bash

if [ "$1" == "-fullversion" ]; then
  echo $@
else
  while ! docker ps | grep IMAGE_NAME; do
    sleep 5
    docker ps
  done
  docker exec -it $(docker ps | grep IMAGE_NAME | cut -d ' ' -f 1 | tr -s ' ') 'java -jar /tmp/agent.jar'
fi
EOF

from google-compute-engine-plugin.

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.