Skip to content

Instantly share code, notes, and snippets.

View burdandrei's full-sized avatar
👻

Andrei Burd burdandrei

👻
View GitHub Profile
@acsrujan
acsrujan / deploy_loadbalancer.sh
Last active December 4, 2016 19:11
Deploying to an ELB backed application when you have a deployment script to do on one instance.
$LOAD_BALANCER_NAME=""
Instance_ids=`aws elb describe-load-balancers --load-balancer-name $LOAD_BALANCER_NAME --query "LoadBalancerDescriptions[*].{ID:LoadBalancerName,InstanceId:Instances[*].InstanceId}[*]. {ELB:ID,InstanceId:InstanceId[*]}" --output=json |jq -r ".[].InstanceId|@csv"`
for $INSTANCE_ID in ${Instance_ids[@]}:
do
private_ip=`aws ec2 describe-instances --instance-id $id |jq -r '.Reservations[].Instances[] | .PrivateIpAddress'`
aws elb deregister-instances-from-load-balancer --load-balancer-name $LOAD_BALANCER_NAME --instances $INSTANCE_ID
`ssh $username@$private_ip` < deployment_script.sh
aws elb register-instances-with-load-balancer --load-balancer-name $LOAD_BALANCER_NAME --instances $INSTANCE_ID
done
@ysb33r
ysb33r / JenkinsBuildFlowObjects.groovy
Last active October 1, 2016 19:24
If you are working with Jenkins BuildFlow plugin you can get some useful information of the returned build() call.
// Given that you have kicked off a build according to the DSL syntax
def results = build('RUN_THIS_JOB')
// Get out the name of the job again
println results.name
// Get the build ID
println results.id
// Get the build URL
@ysb33r
ysb33r / JenkinsBuildFlow.groovy
Last active December 19, 2015 01:19
An example of a more complex build flow in Jenkins.
def partitions=6
def testResults
def buildResult
def staticAnalysisResult
def smokeTestResult
def performanceResult
def buildFlow= { buildResult= build( 'BUILDER' ) }
def performanceFlow= { performanceResult = build('PERFORMANCE')}