dynamized the AMI to use for launching Hudson build slave

This commit is contained in:
EC2 Server committed 2021-05-10 14:37:04 +00:00
1 parent 531a39b49d
commit 0593a11ba3
2 files changed
+11 -4

No files matched your search

+6 -3
View File
@@ -1,9 +1,12 @@
#!/bin/bash
# Enable sudo for user hudson for this script by adding the following to /etc/sudoers.d/hudsoncanlaunchec2instances:
# hudson ALL = (root) NOPASSWD: /usr/local/bin/launchhudsonslave
# hudson ALL = (root) NOPASSWD: /usr/local/bin/launchhudsonslave-java11
# hudson ALL = (root) NOPASSWD: /usr/local/bin/getLatestImageOfType.sh
AWS=/usr/bin/aws
REGION=eu-west-1
#HUDSON_SLAVE_AMI_ID=ami-0c153e4928f340fe5
HUDSON_SLAVE_AMI_ID=ami-00183b2f76157870e
echo Launching instance...
HUDSON_SLAVE_AMI_ID=$( /usr/local/bin/getLatestImageOfType.sh hudson-slave )
echo Launching instance from AMI ${HUDSON_SLAVE_AMI_ID} ...
instanceid=`$AWS ec2 run-instances --image-id $HUDSON_SLAVE_AMI_ID --count 1 --instance-type c5d.4xlarge --key-name Axel --security-groups "Sailing Analytics App" --region $REGION --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=Hudson Ubuntu Slave}]' --instance-initiated-shutdown-behavior terminate | tee /tmp/slavelaunch.out | jq .Instances[0].InstanceId | sed -e 's/"//g'`
if [ "$instanceid" = "" ]; then
echo Error launching instance
+5 -1
View File
@@ -1,7 +1,11 @@
#!/bin/bash
# Enable sudo for user hudson for this script by adding the following to /etc/sudoers.d/hudsoncanlaunchec2instances:
# hudson ALL = (root) NOPASSWD: /usr/local/bin/launchhudsonslave
# hudson ALL = (root) NOPASSWD: /usr/local/bin/launchhudsonslave-java11
# hudson ALL = (root) NOPASSWD: /usr/local/bin/getLatestImageOfType.sh
AWS=/root/.local/bin/aws
REGION=eu-west-1
HUDSON_SLAVE_AMI_ID=ami-0b2277821ed687ab8
HUDSON_SLAVE_AMI_ID=$( /usr/local/bin/getLatestImageOfType.sh hudson-slave-11 )
echo Launching instance...
instanceid=`$AWS ec2 run-instances --image-id $HUDSON_SLAVE_AMI_ID --count 1 --instance-type c5d.4xlarge --key-name Axel --security-groups "Sailing Analytics App" --region $REGION --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=Hudson Ubuntu Slave Java 11}]' --instance-initiated-shutdown-behavior terminate | tee /tmp/slavelaunch.out | jq .Instances[0].InstanceId | sed -e 's/"//g'`
if [ "$instanceid" = "" ]; then