-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlock_versions
More file actions
executable file
·50 lines (38 loc) · 1.53 KB
/
lock_versions
File metadata and controls
executable file
·50 lines (38 loc) · 1.53 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env -S uv --quiet run --script
# /// script
# dependencies = [
# ]
# ///
"""
This script locks specific versions of lambdas and containers as a part of the
release process of the terraform module.
Versions are written to a VERSIONS.json file in their respective module directories.
The terraform module will look at these files to determine the versions to deploy.
Usage:
./lock_versions VERSION_TAG
"""
import json
import sys
import os
def main():
if len(sys.argv) < 2:
print("ERROR: Version tag is required.")
print("Usage: ./lock_versions <version_tag>")
print("Example: ./lock_versions v1.0.0")
sys.exit(1)
version_tag = sys.argv[1]
script_dir = os.path.dirname(os.path.abspath(__file__))
# Write lambda version tag to services/VERSIONS.json
print("Writing lambda version tag to modules/services/VERSIONS.json...")
versions_path = f"{script_dir}/modules/services/VERSIONS.json"
lambda_versions = {"lambda_version_tag": version_tag}
with open(versions_path, "w") as f:
json.dump(lambda_versions, f, indent=4)
# Write brainstore version to brainstore-ec2/VERSIONS.json
print("Writing brainstore version to modules/brainstore-ec2/VERSIONS.json...")
brainstore_versions_path = f"{script_dir}/modules/brainstore-ec2/VERSIONS.json"
os.makedirs(os.path.dirname(brainstore_versions_path), exist_ok=True)
with open(brainstore_versions_path, "w") as f:
json.dump({"brainstore": version_tag}, f, indent=4)
if __name__ == "__main__":
main()