Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
297d99f8
Commit
297d99f8
authored
Mar 31, 2014
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use blessed AMIs if they're available.
parent
104531c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
8 deletions
+47
-8
playbooks/roles/jenkins_admin/templates/edx/var/jenkins/jobs/build-ami/config.xml.j2
+5
-0
util/jenkins/build-ami.sh
+12
-1
util/vpc-tools/abbey.py
+30
-7
No files found.
playbooks/roles/jenkins_admin/templates/edx/var/jenkins/jobs/build-ami/config.xml.j2
View file @
297d99f8
...
...
@@ -46,6 +46,11 @@
<description></description>
<defaultValue></defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>
use_blessed
</name>
<description></description>
<defaultValue>
true
</defaultValue>
</hudson.model.BooleanParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
<com.sonyericsson.rebuild.RebuildSettings
plugin=
"rebuild@1.20"
>
...
...
util/jenkins/build-ami.sh
View file @
297d99f8
...
...
@@ -12,6 +12,7 @@
# - configuration_secure - the version of the secure repo to use
# - jenkins_admin_ec2_key - location of the ec2 key to pass to abbey
# - jenkins_admin_configuration_secure_repo - the git repo to use for secure vars
# - use_blessed - whether or not to use blessed AMIs
if
[[
"
$play
"
==
""
]]
;
then
echo
"No Play Specified. Nothing to Do."
...
...
@@ -32,6 +33,16 @@ if [[ -z $configuration_secure ]]; then
cd
..
fi
base_params
=
""
if
[[
-n
"
$base_ami
"
]]
;
then
base_params
=
"-b
$base_ami
"
fi
blessed_params
=
""
if
[[
"
$use_blessed
"
==
"true"
]]
;
then
blessed_params
=
"--blessed"
fi
cd
configuration
pip install
-r
requirements.txt
...
...
@@ -43,4 +54,4 @@ cat /var/tmp/$BUILD_ID-refs.yml
echo
"
$vars
"
>
/var/tmp/
$BUILD_ID
-extra-vars
.yml
cat
/var/tmp/
$BUILD_ID
-extra-vars
.yml
python
-u
abbey.py
-p
$play
-t
c1.medium
-d
$deployment
-e
$environment
-i
/edx/var/jenkins/.ssh/id_rsa
-b
$base_ami
--vars
/var/tmp/
$BUILD_ID
-extra-vars
.yml
--refs
/var/tmp/
$BUILD_ID
-refs
.yml
-c
$BUILD_NUMBER
--configuration-version
$configuration
--configuration-secure-version
$configuration_secure
-k
$jenkins_admin_ec2_key
--configuration-secure-repo
$jenkins_admin_configuration_secure_repo
python
-u
abbey.py
-p
$play
-t
c1.medium
-d
$deployment
-e
$environment
-i
/edx/var/jenkins/.ssh/id_rsa
$base_params
$blessed_params
--vars
/var/tmp/
$BUILD_ID
-extra-vars
.yml
--refs
/var/tmp/
$BUILD_ID
-refs
.yml
-c
$BUILD_NUMBER
--configuration-version
$configuration
--configuration-secure-version
$configuration_secure
-k
$jenkins_admin_ec2_key
--configuration-secure-repo
$jenkins_admin_configuration_secure_repo
util/vpc-tools/abbey.py
View file @
297d99f8
...
...
@@ -71,9 +71,6 @@ def parse_args():
help
=
"path to extra var file"
,
required
=
False
)
parser
.
add_argument
(
'--refs'
,
metavar
=
"GIT_REFS_FILE"
,
help
=
"path to a var file with app git refs"
,
required
=
False
)
parser
.
add_argument
(
'-a'
,
'--application'
,
required
=
False
,
help
=
"Application for subnet, defaults to admin"
,
default
=
"admin"
)
parser
.
add_argument
(
'--configuration-version'
,
required
=
False
,
help
=
"configuration repo branch(no hashes)"
,
default
=
"master"
)
...
...
@@ -85,9 +82,6 @@ def parse_args():
help
=
"repo to use for the secure files"
)
parser
.
add_argument
(
'-c'
,
'--cache-id'
,
required
=
True
,
help
=
"unique id to use as part of cache prefix"
)
parser
.
add_argument
(
'-b'
,
'--base-ami'
,
required
=
False
,
help
=
"ami to use as a base ami"
,
default
=
"ami-0568456c"
)
parser
.
add_argument
(
'-i'
,
'--identity'
,
required
=
False
,
help
=
"path to identity file for pulling "
"down configuration-secure"
,
...
...
@@ -108,6 +102,15 @@ def parse_args():
default
=
5
,
help
=
"How long to delay message display from sqs "
"to ensure ordering"
)
group
=
parser
.
add_mutually_exclusive_group
()
group
.
add_argument
(
'-b'
,
'--base-ami'
,
required
=
False
,
help
=
"ami to use as a base ami"
,
default
=
"ami-0568456c"
)
group
.
add_argument
(
'--blessed'
,
action
=
'store_true'
,
help
=
"Look up blessed ami for env-dep-play."
,
default
=
False
)
return
parser
.
parse_args
()
...
...
@@ -126,6 +129,21 @@ def get_instance_sec_group(vpc_id):
return
grp_details
[
0
]
.
id
def
get_blessed_ami
():
images
=
ec2
.
get_all_images
(
filters
=
{
'tag:environment'
:
args
.
environment
,
'tag:deployment'
:
args
.
deployment
,
'tag:play'
:
args
.
play
,
'tag:blessed'
:
True
}
)
if
len
(
images
)
!=
1
:
raise
Exception
(
"ERROR: Expected only one blessed ami, got {}
\n
"
.
format
(
len
(
images
)))
return
images
[
0
]
.
id
def
create_instance_args
():
"""
...
...
@@ -292,7 +310,7 @@ rm -rf $base_dir
'security_group_ids'
:
[
security_group_id
],
'subnet_id'
:
subnet_id
,
'key_name'
:
args
.
keypair
,
'image_id'
:
args
.
base_ami
,
'image_id'
:
base_ami
,
'instance_type'
:
args
.
instance_type
,
'instance_profile_name'
:
args
.
role_name
,
'user_data'
:
user_data
,
...
...
@@ -597,6 +615,11 @@ if __name__ == '__main__':
print
'You must be able to connect to sqs and ec2 to use this script'
sys
.
exit
(
1
)
if
args
.
blessed
:
base_ami
=
get_blessed_ami
()
else
:
base_ami
=
args
.
base_ami
try
:
sqs_queue
=
None
instance_id
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment