Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
698c8374
Commit
698c8374
authored
Apr 16, 2015
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add script for generating commands needed for hotfix
parent
c5ce007a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
scripts/hotfix.py
+60
-0
No files found.
scripts/hotfix.py
0 → 100644
View file @
698c8374
#!/usr/bin/env python
"""
Script to generate alton and git commands for executing hotfixes
Commands for:
- cutting amis
- creating hotfix tag
The script should be run with the hotfix's git hash as a command-line argument.
i.e. `python scripts/hotfix.py <hotfix hash>`
"""
from
__future__
import
print_function
from
datetime
import
date
import
sys
import
argparse
import
textwrap
def
generate_alton_commands
(
hotfix_hash
):
"""
Generates commands for alton to cut amis from the git hash of the hotfix.
"""
template
=
textwrap
.
dedent
(
"""
@alton cut ami for stage-edx-edxapp from prod-edx-edxapp with edx_platform_version={hotfix_hash}
@alton cut ami for prod-edge-edxapp from prod-edge-edxapp with edx_platform_version={hotfix_hash}
@alton cut ami for prod-edx-edxapp from prod-edx-edxapp with edx_platform_version={hotfix_hash}
"""
)
return
template
.
strip
()
.
format
(
hotfix_hash
=
hotfix_hash
)
def
generate_git_command
(
hotfix_hash
):
"""
Generates command to tag the git hash of the hotfix.
"""
git_string
=
'git tag -a hotfix-{iso_date} -m "Hotfix for {msg_date}" {hotfix_hash}'
.
format
(
iso_date
=
date
.
today
()
.
isoformat
(),
msg_date
=
date
.
today
()
.
strftime
(
"
%
b
%
d,
%
Y"
),
hotfix_hash
=
hotfix_hash
,
)
return
git_string
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
"Generate alton and git commands for hotfixes"
)
parser
.
add_argument
(
"hash"
,
help
=
"git hash for hotfix"
)
args
=
parser
.
parse_args
()
hotfix_hash
=
args
.
hash
print
(
"
\n
Here are the alton commands to cut the hotfix amis:"
)
print
(
generate_alton_commands
(
hotfix_hash
))
print
(
"
\n
Here is the git command to generate the hotfix tag:"
)
print
(
generate_git_command
(
hotfix_hash
))
print
(
"
\n
Once you create the git tag, push the tag by running:"
)
print
(
"git push --tags
\n
"
)
if
__name__
==
'__main__'
:
main
()
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