forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset_version
executable file
·38 lines (29 loc) · 960 Bytes
/
set_version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import os
import argparse
from subprocess import check_call
template_go = '''package beat
const defaultBeatVersion = "{}"
'''
template_packer = '''version: "{version}"
'''
def main():
parser = argparse.ArgumentParser(
description="Used to set the current version. Doesn't commit changes.")
parser.add_argument("version",
help="The new version")
args = parser.parse_args()
dir = os.path.dirname(os.path.realpath(__file__))
with open(dir + "/../libbeat/beat/version.go", "w") as f:
f.write(template_go.format(args.version))
version = args.version
with open(dir + "/packer/version.yml", "w") as f:
f.write(template_packer.format(
version=version,
))
# Updates all files with the new templates
os.chdir(dir + "/../")
print("Update build files")
check_call("make update", shell=True)
if __name__ == "__main__":
main()