Skip to content

Instantly share code, notes, and snippets.

View snallami's full-sized avatar

Suresh Nallamilli snallami

  • Los angeles, CA
View GitHub Profile
@snallami
snallami / gist:6139703b6fa870d8dc26cc1ee9cbfdbf
Created June 26, 2018 03:07
ec2-user permissions in docker file
#!/bin/sh
groupadd --gid 500 ec2-user
useradd --gid 500 --uid 500 ec2-user
mkdir /data && chown ec2-user:ec2-user /data
mkdir /etc/sudoers.d/
echo "ec2-user ALL=(ALL) NOPASSWD: ALL">/etc/sudoers.d/ec2-user
Gopal Nallamilli Salary
April 2018: $12.00 ($10.00 Salary + $2.00 bonus)
May 2018 : $12.00 ($10.00 Salary + $2.00 bonus)
Total Sal: $24.00
@snallami
snallami / kill-scm-threads.groovy
Created January 6, 2017 20:27 — forked from andyjones/kill-scm-threads.groovy
Kills long running SCM polling threads in Jenkins
Jenkins.instance.getTrigger("SCMTrigger").getRunners().each()
{
item ->
long millis = Calendar.instance.time.time - item.getStartTime()
if(millis > (1000 * 60 * 60)) // 1000 millis in a second * 60 seconds in a minute * 3 minutes
{
Thread.getAllStackTraces().keySet().each()
{
tItem ->
import hudson.model.*
disableChildren(Hudson.instance.items)
def disableChildren(items) {
def daysToKeep = 14
def numToKeep = 10
def artifactDaysToKeep = -1
def artifactNumToKeep = -1
git config --global core.sshCommand 'ssh -i /home/ec2-user/.ssh/id_rsa_stage'
@snallami
snallami / i3
Created October 4, 2017 03:44
Mount i3 ephermal disk
create_cachefs() {
echo "${FUNCNAME[0]}"
BLOCK_DEVICE='/dev/nvme0n1'
NVME_CACHE_MOUNT_POINT='/cache-fs'
SERVICE_USER_NAME='tooladmin'
# Only set this up if we have an nvme ephemeral
if [[ ! -e ${BLOCK_DEVICE} ]] ; then
echo "FAILURE: Service needs a specific amazon instance type"
Jenkins.instance.pluginManager.plugins.sort { it.getDisplayName() }.each{
plugin ->
println ("(${plugin.getShortName()}): ${plugin.getVersion()}")
}
cat 004-HarFile.har | jq '[.log.entries[] | {time: .time, url: .request.url}]' | jq 'sort_by(.time)' > requestTime.json
@snallami
snallami / gist:88a3e82772c4f60bcc0e285104c0d423
Created May 1, 2017 18:42
My rough notes on CJOC + CJE setup
1) Need below plugins for shared agents to work
Operations Center OpenID Cluster Session Extension
Operations Center Cloud
CloudBees SSH Build Agents Plugin
2)
Safe alternative: use the host Docker daemon from within a container
The simple solution to allow a container process to start another container is to share the Docker socket of the host with the container, doing something like this:
docker run -v /var/run/docker.sock:/var/run/docker.sock -d --name some_container some_image
Assuming that Docker is installed in the image invoked, then the Docker client run within that container will be communicating with the Docker daemon running on the host.
Any containers created from within some_container would actually be created by the same Docker daemon that created some_container itself. Those new containers would be sibling containers, siblings to some_container.
Now there should be no worries about data corruption from nested storage drivers, or shared access to the Docker image cache.